from __future__ import with_statement

__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__copyright__ = '2012 Josh Hall<jwtheiv@gmail.com>'
__docformat__ = 'restructuredtext en'

from calibre.web.feeds.news import BasicNewsRecipe


class BaltimoreSun(BasicNewsRecipe):
    title = 'The Baltimore Sun'
    __author__ = 'Kovid Goyal'
    description = 'Complete local news and blogs from Baltimore'
    language = 'en_US'
    version = 2.5
    compress_news_images = True
    compress_news_images_auto_size = 8
    oldest_article = 1
    max_articles_per_feed = 100
    use_embedded_content = False
    no_stylesheets = True
    remove_javascript = True
    remove_empty_feeds = True
    auto_cleanup = False

    ignore_duplicate_articles = {'title'}
    keep_only_tags = [
        dict(name=['div'], attrs={'class': ['trb_ar_hl', 'trb_ar_hl_t', 'trb_ar_la', 'trb_ar_by', 'trb_ar_dateline', 'trb_ar_page']}),
    ]
    remove_tags = [
        dict(name=['meta', 'link']),
    ]

    feeds = [
        # News ##
        ('Top Headlines', 'http://feeds.feedburner.com/baltimoresun/news/rss2'),
        ('Breaking News', 'http://feeds.feedburner.com/baltimoresun/news/local/annearundel/rss2'),
        ('Top Maryland', 'http://feeds.feedburner.com/baltimoresun/news/local/rss2'),
        ('Baltimore City', 'http://feeds.feedburner.com/baltimoresun/news/local/baltimore_city/rss20xml'),
        ('Education', 'http://feeds.feedburner.com/baltimoresun/news/education/rss2'),
        ('Local Politics', 'http://feeds.feedburner.com/baltimoresun/news/local/politics/rss2'),
        ('Weather', 'http://feeds.feedburner.com/baltimoresun/news/weather/site/rss2'),
        ('Nation/world', 'http://feeds.feedburner.com/baltimoresun/news/nationworld/rss2'),
        # Sports##
        ('Top Sports', 'http://feeds.feedburner.com/baltimoresun/sports/rss2'),
        ('Orioles/Baseball', 'http://www.baltimoresun.com/sports/orioles/rss2.0.xml'),
        ('Ravens/Football', 'http://feeds.feedburner.com/baltimoresun/sports/football/rss2'),
        # Entertainment ##
        ('Arts & Theater', 'http://feeds.feedburner.com/baltimoresun/entertainment/galleriesmuseums/rss2'),
        ('Movies', 'http://www.baltimoresun.com/entertainment/movies/rss2.0.xml'),
        ('Music & Nightlife', 'http://www.baltimoresun.com/entertainment/music/rss2.0.xml'),
        ('Restaurants & Food', 'http://www.baltimoresun.com/entertainment/dining/rss2.0.xml'),
        ('TV/Media', 'http://www.baltimoresun.com/entertainment/tv/rss2.0.xml'),
        # Life ##
        ('Health&Wellness', 'http://www.baltimoresun.com/health/rss2.0.xml'),
        ('Home & Garden', 'http://www.baltimoresun.com/features/home-garden/rss2.0.xml'),
        ('Living Green', 'http://www.baltimoresun.com/features/green/rss2.0.xml'),
        ('Fashion', 'http://www.baltimoresun.com/features/fashion/rss2.0.xml'),
        ('Travel', 'http://www.baltimoresun.com/travel/rss2.0.xml'),
        # Business ##
        ('Top Business', 'http://www.baltimoresun.com/business/rss2.0.xml'),
        ('Technology', 'http://www.baltimoresun.com/business/technology/rss2.0.xml'),
        ('Real Estate', 'http://www.baltimoresun.com/classified/realestate/rss2.0.xml'),
        ('Investing', 'http://www.baltimoresun.com/business/money/rss2.0.xml'),
        # Opinion##
        ('Sun Editorials', 'http://www.baltimoresun.com/news/opinion/editorial/rss2.0.xml'),
        ('Op/Ed', 'http://www.baltimoresun.com/news/opinion/oped/rss2.0.xml'),
        # News Blogs ##
        ('InsideEd', 'http://www.baltimoresun.com/news/maryland/education/blog/rss2.0.xml'),
        ('Maryland Politics', 'http://www.baltimoresun.com/news/maryland/politics/blog/rss2.0.xml'),
        ('Maryland Weather', 'http://www.baltimoresun.com/news/weather/weather-blog/rss2.0.xml'),
        ('Second Opinion', 'http://www.baltimoresun.com/news/opinion/second-opinion-blog/rss2.0.xml'),
        ('Sun Investigates', 'http://www.baltimoresun.com/news/maryland/sun-investigates/rss2.0.xml'),
        ("You Don't Say", 'http://www.baltimoresun.com/news/language-blog/rss2.0.xml'),
        # Business Blogs ##
        ('BaltTech', 'http://www.baltimoresun.com/business/technology/blog/rss2.0.xml'),
        ('Consuming Interests', 'http://www.baltimoresun.com/business/consuming-interests-blog/rss2.0.xml'),
        ('The Real Estate Wonk', 'http://www.baltimoresun.com/business/real-estate/wonk/rss2.0.xml'),
        # Entertainment Blogs ##
        ('ArtSmash', 'http://www.baltimoresun.com/entertainment/arts/artsmash/rss2.0.xml'),
        ('Midnight Sun', 'http://www.baltimoresun.com/entertainment/music/midnight-sun-blog/rss2.0.xml'),
        ('Read Street', 'http://www.baltimoresun.com/features/books/read-street/rss2.0.xml'),
        ('Z on TV', 'http://www.baltimoresun.com/entertainment/tv/z-on-tv-blog/rss2.0.xml'),
        # Life Blogs ##
        ('Baltimore Insider', 'http://www.baltimoresun.com/features/baltimore-insider-blog/rss2.0.xml'),
        ('Picture of Health', 'http://www.baltimoresun.com/health/blog/rss2.0.xml'),
        # Sports Blogs ##
        ('Orioles Insider', 'http://baltimore.feedsportal.com/c/34255/f/623100/index.rss'),
        ('Ravens Insider', 'http://www.baltimoresun.com/sports/ravens/ravens-insider/rss2.0.xml'),
        ('The Schmuck Stops Here', 'http://www.baltimoresun.com/sports/schmuck-blog/rss2.0.xml'),
    ]
