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

__copyright__ = '2011-2016, Darko Miletic <darko.miletic at gmail.com>'
'''
www.iprofesional.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class iProfesional(BasicNewsRecipe):
    title = 'iProfesional.com'
    __author__ = 'Darko Miletic'
    description = 'Las ultimas noticias sobre profesionales'
    publisher = 'Emprendimientos Corporativos S.A.'
    category = 'news, IT, impuestos, negocios, politics, Argentina'
    oldest_article = 2
    max_articles_per_feed = 200
    no_stylesheets = True
    encoding = 'utf8'
    use_embedded_content = False
    language = 'es_AR'
    remove_empty_feeds = True
    publication_type = 'newsportal'
    masthead_url = 'http://www.iprofesional.com/img/header/logoiprofesional.png'
    extra_css = '''
                               body{font-family: "Open Sans", sans-serif}
                               img{margin-bottom: 0.4em; display:block}
                               .tituloprincipal{font-family: WhitneyBold, Arial, sans-serif;
                                                font-weight: bold;
                                                font-size: x-large;
                                                display: block; margin-bottom: 1em;}
                               .bajadanh{font-size: small; display: block; margin-bottom: 1em;}
                            '''

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

    keep_only_tags = [
        dict(name='div', attrs={'class': lambda x: x and 'tituloprincipal' in x.split()}),
        dict(name='div', attrs={'class': lambda x: x and 'bajadanh' in x.split()}),
        dict(name='div', attrs={'class': lambda x: x and 'datosautornh' in x.split()}),
        dict(name='div', attrs={'class': lambda x: x and 'fotonotanh' in x.split()}),
        dict(name='div', attrs={'class': lambda x: x and 'contenidonotanh' in x.split()}),
    ]
    remove_tags = [dict(name=['meta', 'link', 'base', 'embed', 'object', 'iframe'])]

    feeds = [
        ('Ultimas noticias', 'http://feeds.feedburner.com/iprofesional-principales-noticias'),
        ('Finanzas', 'http://feeds.feedburner.com/iprofesional-finanzas'),
        ('Impuestos', 'http://feeds.feedburner.com/iprofesional-impuestos'),
        ('Negocios', 'http://feeds.feedburner.com/iprofesional-economia'),
        ('Comercio Exterior', 'http://feeds.feedburner.com/iprofesional-comercio-exterior'),
        ('Tecnologia', 'http://feeds.feedburner.com/iprofesional-tecnologia'),
        ('Management', 'http://feeds.feedburner.com/iprofesional-managment'),
        ('Marketing', 'http://feeds.feedburner.com/iprofesional-marketing'),
        ('Legales', 'http://feeds.feedburner.com/iprofesional-legales'),
        ('Autos', 'http://feeds.feedburner.com/iprofesional-autos'),
        ('Vinos', 'http://feeds.feedburner.com/iprofesional-vinos-bodegas'),
    ]
