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

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

from calibre.web.feeds.news import BasicNewsRecipe

class Tvmania(BasicNewsRecipe):
    title                 = u'TVmania'
    __author__            = u'Silviu Cotoar\u0103'
    description           = u'Programe TV'
    publisher             = u'TVmania'
    oldest_article        = 25
    language              = 'ro'
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    category              = 'Ziare,Reviste,TV'
    encoding              = 'utf-8'
    cover_url             = 'http://www.tvmania.ro/wp-content/themes/tvmania/images/logo.png'

    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':'articol'})
                        , dict(name='font', attrs={'class':'mic'})
                        , dict(name='div', attrs={'id':'header_recomandari'})
                        , dict(name='div', attrs={'class':'main-image'})
                        , dict(name='div', attrs={'id':'articol_recomandare'})

                     ]

    remove_tags = [
                          dict(name='div', attrs={'class':['iLikeThis']})
                        , dict(name='span', attrs={'class':['tag-links']})
                  ]

    remove_tags_after = [
                              dict(name='div', attrs={'class':['iLikeThis']})
                            , dict(name='span', attrs={'class':['tag-links']})
                        ]

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

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