from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = 'zotzot'
__docformat__ = 'restructuredtext en'

from calibre.web.feeds.news import BasicNewsRecipe


class Oregonian(BasicNewsRecipe):
    title = u'The Oregonian'
    oldest_article = 2
    max_articles_per_feed = 100
    language = 'en'
    __author__ = 'Zotzot'
    description = 'Portland, Oregon local newspaper'
    publisher = 'Advance Publications'
    category = 'news, Portland'
    cover_url = 'http://bit.ly/gUgxGd'
    no_stylesheets = True
    masthead_url = 'http://bit.ly/eocL70'
    remove_tags = [dict(name='div', attrs={'class': ['footer', 'content']})]
    use_embedded_content = False
    remove_tags_before = dict(id='article')
    remove_tags_after = dict(id='article')
    feeds = [
        # (u'Timbers', u'feed://blog.oregonlive.com/timbers_impact/atom.xml'),
        (u'News', u'http://blog.oregonlive.com/news_impact/atom.xml'),
        (u'Opinion', u'http://blog.oregonlive.com/opinion_impact/atom.xml'),
        (u'Living', u'http://blog.oregonlive.com/living_impact/atom.xml'),
        (u'Sports', u'http://blog.oregonlive.com/sports_impact/atom.xml'),
        (u'Business', u'http://blog.oregonlive.com/business_impact/atom.xml')]

    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
'''


def get_article_url(self, article):
    url = BasicNewsRecipe.get_article_url(self, article)
    if '/video/' not in url:
        return url
