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

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

from calibre.web.feeds.news import BasicNewsRecipe


class Mediafax(BasicNewsRecipe):
    title = 'Mediafax'
    __author__ = 'Silviu Cotoar\u0103'
    description = '\u0218tiri din Rom\u00e2nia'
    publisher = 'Mediafax'
    oldest_article = 5
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Stiri,Romania'
    encoding = 'utf-8'
    cover_url = 'http://storage0.dms.mpinteractiv.ro/media/1/1/1706/4134575/2/logo-mediafax-mass-media-news.jpg?width=400'

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

    keep_only_tags = [dict(name='div', attrs={'class': 'news tabs-container'})]

    remove_tags = [dict(name='ul', attrs={'class': ['CategoryNews']}), dict(name='div', attrs={'class': ['read']})]

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

    feeds = [('Actualitate', 'http://www.mediafax.ro/rss/')]

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