#!/usr/bin/env python

__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
dailyreckoning.com
'''
from calibre.web.feeds.news import BasicNewsRecipe


class dailyreckoning_us(BasicNewsRecipe):
    title = 'The Daily Reckoning - US edition'
    __author__ = 'Darko Miletic'
    description = 'Worldwide business and financial news and articles'
    publisher = 'Agora Financial, LLC.'
    category = 'news, business, finances, money, banking'
    oldest_article = 7
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf-8'
    language = 'en'
    extra_css = ' #BlogTitle{font-size: x-large; font-weight: bold} #BlogDate{font-size: small} '

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

    feeds = [(u'Articles', u'http://feeds.feedburner.com/dailyreckoning?format=xml')]

    keep_only_tags = [dict(name='div', attrs={'id': 'Outline'})]

    remove_tags = [
        dict(name=['object', 'link', 'base']), dict(
            name='hr', attrs={'class': 'Divider'})
    ]

    remove_tags_after = dict(name='hr', attrs={'class': 'Divider'})

    def get_article_url(self, article):
        return article.get('feedburner_origlink', article.get('link'))

    def print_version(self, url):
        return url + 'print/'
