#!/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__ = '  '
__date__ = '14-06-2010'
__description__ = 'Italian daily newspaper'

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


class ilCorrieredelloSport(BasicNewsRecipe):
    __author__ = 'Gabriele Marini'
    description = 'Italian daily newspaper'

    cover_url = 'http://edicola.corrieredellosport.it/newsmem/corsport/prima/nazionale_prima.jpg'

    title = u'Il Corriere dello Sport'
    publisher = 'CORRIERE DELLO SPORT s.r.l. '
    category = 'Sport'

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

    oldest_article = 10
    max_articles_per_feed = 100
    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='h1', attrs={'class': ['tit_Article']}),
        dict(name='h1', attrs={'class': ['tit_Article_mondiali']}),
        dict(name='div', attrs={'class': ['box_Img']}),
        dict(name='p', attrs={'class': ['summary', 'text']})]

    feeds = [
        (u'Primo Piano',  u'http://www.corrieredellosport.it/rss/primo_piano.xml'),
        (u'Calcio',  u'http://www.corrieredellosport.it/rss/Calcio-3.xml'),
        (u'Formula 1',    u'http://www.corrieredellosport.it/rss/Formula-1-7.xml'),
        (u'Moto',         u'http://www.corrieredellosport.it/rss/Moto-8.xml'),
        (u'Piu visti',    u'http://www.corrieredellosport.it/rss/piu_visti.xml')
    ]
