__license__ = 'GPL v3'
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
'''
www.defensenews.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class DefenseNews(BasicNewsRecipe):
    title = 'Defense News'
    __author__ = 'Darko Miletic'
    description = 'Find late-breaking defense news from the leading defense news weekly'
    publisher = 'Gannett Government Media Corporation'
    oldest_article = 31
    max_articles_per_feed = 200
    no_stylesheets = True
    encoding = 'cp1252'
    use_embedded_content = False
    language = 'en'
    remove_empty_feeds = True
    publication_type = 'newspaper'
    ignore_duplicate_articles = {'url'}
    masthead_url = 'http://www.defensenews.com/images/logo_defensenews2.jpg'
    extra_css             = """
                               body{font-family: Arial,Helvetica,sans-serif }
                               img{margin-bottom: 0.4em; display:block}
                               .info{font-size: small; color: gray}
                            """
    remove_attributes = ['style', 'lang']

    keep_only_tags = [
        dict(attrs={'class': ['ody-hgroup', 'ody-article']}),
    ]
    remove_tags = [
        dict(name=['meta', 'link']),
        dict(attrs={'class': ['toolbar', 'toolsShareWrap', 'ody-bo-sm ',
                              'ody-comments', 'ody-related-links', 'left', 'right']}),
        dict(id=['factsMore', 'ody-nextstoryslider']),
    ]

    feeds = [

    (u'Europe', u'http://www.defensenews.com/rss/europe'),
    (u'Americas', u'http://www.defensenews.com/rss/americas'),
    (u'Asia & Pacific rim', u'http://www.defensenews.com/rss/asia-pacific-rim'),
    (u'Middle east & Africa', u'http://www.defensenews.com/rss/middle-east-africa'),
    (u'Air', u'http://www.defensenews.com/rss/air-warfare'),
    (u'Land', u'http://www.defensenews.com/rss/land-warfare'),
    (u'Naval', u'http://www.defensenews.com/rss/naval-warfare')
    ]
