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

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

from calibre.web.feeds.news import BasicNewsRecipe


class Onemagazine(BasicNewsRecipe):
    title = u'The ONE'
    __author__ = u'Silviu Cotoar\u0103'
    description = u'Be the ONE, not anyone ..'
    publisher = u'The ONE'
    oldest_article = 25
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Reviste,Femei'
    encoding = 'utf-8'
    cover_url = 'http://www.onemagazine.ro/images/logo_rss.jpg'

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

    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
                    .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center}
                    .story{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
                '''

    keep_only_tags = [
        dict(name='div', attrs={'class': 'article'}), dict(name='div', attrs={
            'class': 'gallery clearfix'}), dict(name='div', attrs={'align': 'justify'})
    ]

    remove_tags = [
        dict(name='p', attrs={'class': ['info']}), dict(name='table', attrs={'class': ['connect_widget_interactive_area']}), dict(name='span', attrs={'class': ['photo']}), dict(name='div', attrs={'class': ['counter']}), dict(name='div', attrs={'class': ['carousel']}), dict(name='div', attrs={'class': ['jcarousel-container jcarousel-container-horizontal']})  # noqa
    ]

    remove_tags_after = [
        dict(name='table', attrs={
             'class': ['connect_widget_interactive_area']})
    ]

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

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