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

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

from calibre.web.feeds.news import BasicNewsRecipe


class BabyOnline(BasicNewsRecipe):
    title = u'Baby Online'
    __author__ = u'Silviu Cotoar\u0103'
    description = u'De la p\u0103rinte la p\u0103rinte'
    publisher = u'Baby Online'
    oldest_article = 50
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Reviste,Copii,Mame'
    encoding = 'utf-8'
    cover_url = 'http://www.babyonline.ro/images/default/logo.gif'

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

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

    remove_tags = [
        dict(name='div', attrs={'id': 'bar_nav'}),
        dict(name='div', attrs={'id': 'service_send'}),
        dict(name='div', attrs={'id': 'other_videos'}),
        dict(name='div', attrs={'class': 'dot_line_yellow'}),
        dict(name='a', attrs={'class': 'print'}),
        dict(name='a', attrs={'class': 'email'}),
        dict(name='a', attrs={'class': 'YM'}),
        dict(name='a', attrs={'class': 'comment'}),
        dict(name='div', attrs={'class': 'tombstone_cross'}),
        dict(name='span', attrs={'class': 'liketext'})
    ]

    remove_tags_after = [
        dict(name='div', attrs={'id': 'service_send'})
    ]

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

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