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

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

from calibre.web.feeds.news import BasicNewsRecipe


class ChipRo(BasicNewsRecipe):
    title = u'Chip Online'
    __author__ = u'Silviu Cotoar\u0103'
    description = 'Chip Online'
    publisher = 'Chip Online'
    oldest_article = 5
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Reviste,IT'
    encoding = 'utf-8'
    cover_url = 'http://www.chip.ro/images/logo.png'

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

    keep_only_tags = [
        dict(name='h2', attrs={'class': 'contentheading clearfix'}), dict(name='span', attrs={
            'class': 'createby'}), dict(name='div', attrs={'class': 'article-content'})
    ]

    remove_tags = [
        dict(name='div', attrs={'class': ['sharemecompactbutton']}), dict(name='div', attrs={'align': ['left']}), dict(name='div', attrs={
            'align': ['center']}), dict(name='th', attrs={'class': ['pagenav_prev']}), dict(name='table', attrs={'class': ['pagenav']})
    ]

    feeds = [
        (u'Feeds', u'http://www.chip.ro/index.php?option=com_ninjarsssyndicator&feed_id=9&format=raw')
    ]

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