#!/usr/bin/env  python2
__license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini'
__copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
__description__ = 'Daily newspaper from Spain'
__version__ = 'v1.01'
__date__ = '14, January 2010'

'''
http://www.nortecastilla.es/
'''

from calibre.web.feeds.news import BasicNewsRecipe


class norteCastilla(BasicNewsRecipe):
    author = 'Lorenzo Vigentini'
    description = 'Daily newspaper from Spain'

    cover_url = 'http://www.nortecastilla.es/img/rd.logo_nortecastilla.png'
    title = u'NorteCastilla '
    publisher = 'Vocento'
    category = 'News, politics, culture, economy, general interest'

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

    oldest_article = 1
    max_articles_per_feed = 25

    use_embedded_content = False
    recursion = 10

    remove_javascript = True
    no_stylesheets = True

    keep_only_tags = [
        dict(name='div', attrs={'class': ['articulo', 'photo']})
    ]

    remove_tags = [
        dict(name='div', attrs={
             'class': ['contenido_form_articulo', 'colC_articulo', 'publiEspecial']}),
        dict(name='div', attrs={
             'class': ['tags_relacionados', 'form_art form_opina', 'adds', 'comentarios']}),
        dict(name='span', attrs={'class': 'contenido_form_articulo'}),
        dict(name='div', attrs={'id': 'publi1_noxtrum'}),
        dict(name='a', attrs={'class': ['nav_fgH_ant', 'nav_fgH_sig']})
    ]

    feeds = [
        (u'Ultima hora', u'http://www.nortecastilla.es/rss/feeds/ultima.xml'),
        (u'Portada', u'http://www.nortecastilla.es/portada.xml'),
        (u'Espana', u'http://www.nortecastilla.es/img/rss_descarga.gif'),
        (u'Mundo', u'http://www.nortecastilla.es/rss/feeds/mundo.xml'),
        (u'Economia', u'http://www.nortecastilla.es/rss/feeds/economia.xml'),
        (u'Deportes', u'http://www.nortecastilla.es/rss/feeds/deportes.xml'),
        (u'Vida y ocio', u'http://www.nortecastilla.es/rss/feeds/ocio.xml'),
        (u'Cultura', u'http://www.nortecastilla.es/rss/feeds/cultura.xml'),
        (u'Television',
         u'http://www.nortecastilla.es/rss/feeds/television.xml'),
        (u'Contraportada',
         u'http://www.nortecastilla.es/rss/feeds/contraportada.xml')
    ]

    extra_css = '''
                    .articulo{clear:both; padding:0 2px 0 6px}
                    .art_head{clear:both;}
                    .articulo .overhead{ color:#C00; font-size:10px; text-transform:uppercase;}
                    .articulo .headline{ color:#036; font-size:36px; font-weight:normal;}
                    .articulo .headline a,.articulo .headline a:hover{ color:#036; cursor:default; text-decoration:none;}
                    .articulo .subhead{ color:#686868; font-size:16px; font-weight:normal; margin:0 0 5px 0}
                    .articulo .byline a{ color:#8E8E8E;}
                    .articulo .barhead{ font-size:14px;font-weight:normal; padding:0 0 15px 0}
                    .articulo .text{ font-size:14px;font-weight:normal;}
                    .articulo .text .p{ line-height:18px; padding:0 0 15px 0}
                    .articulo .text .p a{ text-decoration:underline; color:#036}
                    .articulo .text .p a:hover{ text-decoration:none; color:#cc0000}
                    .articulo .pbox{text-align:left; margin:0 auto 0 10px; text-align:left;}
                    .articulo .photo-alt1,.colC_articulo .photo{text-align:center; margin:0 auto; background-color:#F2F2F2;}
                    .articulo .photo-alt1 img,.colC_articulo .photo img{text-align:center; margin:0 auto;}
                    .articulo .photo-caption a{ color:#666;}
                    .fotogaleriasH .photo {background-color:#DCDCDC;margin:0 auto;padding:5px 0 0;text-align:center;}
                    .fotogaleriasH .photo img {display: block; margin:0 auto;text-align:center;}
                '''
