#!/usr/bin/env  python2
__license__ = 'GPL v3'
__author__ = 'GabrieleMarini, based on Darko Miletic'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>, Gabriele Marini'
__version__ = 'v1.02 Marini Gabriele '
__date__ = '14062010'
__description__ = 'Italian daily newspaper'

'''
http://www.corrieredellosport.it/
'''
from calibre.web.feeds.news import BasicNewsRecipe


class Auto(BasicNewsRecipe):
    __author__ = 'Gabriele Marini'
    description = 'Auto and Formula 1'

    cover_url = 'http://www.auto.it/res/imgs/logo_Auto.png'

    title = u'Auto'
    publisher = 'CONTE Editore'
    category = 'Sport'

    language = 'it'
    timefmt = '[%a, %d %b, %Y]'

    oldest_article = 60
    max_articles_per_feed = 30
    use_embedded_content = False
    recursion = 10

    remove_javascript = True
    no_stylesheets = True

    html2lrf_options = [
        '--comment', description, '--category', category, '--publisher', publisher, '--ignore-tables'
    ]

    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + \
        description + '"\ntags="' + category + '"\nlinearize_tables=True'

    keep_only_tags = [
        dict(name='h2', attrs={'class': ['tit_Article y_Txt']}),
        dict(name='h2', attrs={'class': ['tit_Article']}),
        dict(name='div', attrs={'class': ['box_Img newsdet_new ']}),
        dict(name='div', attrs={'class': ['box_Img newsdet_as ']}),
        dict(name='table', attrs={'class': ['table_A']}),
        dict(name='div', attrs={'class': ['txt_Article txtBox_cms']}),
        dict(name='testoscheda')]

    feeds = [
        (u'Tutte le News',  u'http://www.auto.it/rss/articoli.xml'),
        (u'Prove su Strada',  u'http://www.auto.it/rss/prove+6.xml'),
        (u'Novit\xe0',    u'http://www.auto.it/rss/novita+3.xml')
    ]
