__license__   = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
digitaljournal.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class DigitalJournal(BasicNewsRecipe):
    title                 = 'Digital Journal'
    __author__            = 'Darko Miletic'
    description           = 'A Global Citizen Journalism News Network'
    category              = 'news, politics, USA, world'
    publisher             = 'Digital Journal'
    oldest_article        = 2
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'utf8'
    language              = 'en'
      
    conversion_options = {  
                             'comments'        : description
                            ,'tags'            : category
                            ,'language'        : language
                            ,'publisher'       : publisher
                         }

    keep_only_tags   = [dict(name='div', attrs={'class':['article','body']})]

    remove_tags     = [dict(name=['object','table'])]
                         
    feeds = [ 
                (u'Latest News'  , u'http://digitaljournal.com/rss/?feed=latest_news'                   )
               ,(u'Business'     , u'http://digitaljournal.com/rss/?feed=top_news&depname=Business'     )
               ,(u'Entertainment', u'http://digitaljournal.com/rss/?feed=top_news&depname=Entertainment')
               ,(u'Environment'  , u'http://digitaljournal.com/rss/?feed=top_news&depname=Environment'  )
               ,(u'Food'         , u'http://digitaljournal.com/rss/?feed=top_news&depname=Food'         )
               ,(u'Health'       , u'http://digitaljournal.com/rss/?feed=top_news&depname=Health'       )
               ,(u'Internet'     , u'http://digitaljournal.com/rss/?feed=top_news&depname=Internet'     )
               ,(u'Politics'     , u'http://digitaljournal.com/rss/?feed=top_news&depname=Politics'     )
               ,(u'Religion'     , u'http://digitaljournal.com/rss/?feed=top_news&depname=Religion'     )
               ,(u'Science'      , u'http://digitaljournal.com/rss/?feed=top_news&depname=Science'      )
               ,(u'Sports'       , u'http://digitaljournal.com/rss/?feed=top_news&depname=Sports'       )
               ,(u'Technology'   , u'http://digitaljournal.com/rss/?feed=top_news&depname=Technology'   )
               ,(u'World'        , u'http://digitaljournal.com/rss/?feed=top_news&depname=World'        )
               ,(u'Arts'         , u'http://digitaljournal.com/rss/?feed=top_news&depname=Arts'         )
            ]
          
    def print_version(self, url):
        return url.replace('digitaljournal.com/','digitaljournal.com/print/')
        
