#!/usr/bin/env  python2
# -*- coding: utf-8 -*-

__license__ = 'GPL v3'
__copyright__ = u'2011, Silviu Cotoar\u0103'
'''
romanialibera.ro
'''

from calibre.web.feeds.news import BasicNewsRecipe


class RomaniaLibera(BasicNewsRecipe):
    title = u'Rom\u00e2nia Liber\u0103'
    __author__ = u'Silviu Cotoar\u0103'
    description = u'Rom\u00e2nia Liber\u0103'
    publisher = u'Rom\u00e2nia Liber\u0103'
    oldest_article = 5
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Stiri'
    encoding = 'utf-8'
    cover_url = 'http://www.romanialibera.ro/templates/lilac/images/sigla_1.gif'

    conversion_options = {
        'comments': description, 'tags': category, 'language': language, 'publisher': publisher
    }

    keep_only_tags = [
        dict(name='div', attrs={'id': 'articol'})
    ]

    remove_tags = [
        dict(name='div', attrs={'id': ['art_actions']}), dict(name='div', attrs={'class': ['stats']}), dict(name='div', attrs={'class': ['data']}), dict(name='div', attrs={'class': ['autori']}), dict(name='div', attrs={'class': ['banda_explicatii_text']}), dict(name='td', attrs={'class': ['connect_widget_vertical_center connect_widget_button_cell']}), dict(name='div', attrs={'class': ['aceeasi_tema']}), dict(name='div', attrs={'class': ['art_after_text']}), dict(name='div', attrs={'class': ['navigare']}), dict(name='div', attrs={'id': ['art_text_left']})  # noqa
    ]

    remove_tags_after = [
        dict(name='div', attrs={'class': 'art_after_text'})
    ]

    feeds = [
        (u'Feeds', u'http://www.romanialibera.ro/rss.xml')
    ]

    def preprocess_html(self, soup):
        return self.adeify_images(soup)
