__license__   = 'GPL v3'
__author__    = u'Marc Toensing'

from calibre.web.feeds.news import BasicNewsRecipe

class GamespotCom(BasicNewsRecipe):

    title = u'Gamespot.com Reviews'
    description = 'review articles from gamespot.com'
    language = 'en'
    __author__ = u'Marc T\xf6nsing'

    oldest_article = 7
    max_articles_per_feed = 40
    remove_empty_feeds = True
    no_stylesheets = True
    no_javascript = True

    feeds =  [
               ('All Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5'),
               ('PC Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=5'),
               ('XBOX 360 Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1029'),
               ('Wii Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1031'),
               ('PlayStation 3 Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1028'),
               ('PlayStation 2 Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=7'),
               ('PlayStation Portable Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1024'),
               ('Nintendo DS Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1026'),
               ('iPhone Reviews', 'http://www.gamespot.com/rss/game_updates.php?type=5&platform=1049'),
             ]

    remove_tags = [
            dict(name='div', attrs={'class':'top_bar'}),
            dict(name='div', attrs={'class':'video_embed'})
            ]

    def get_cover_url(self):
        return 'http://image.gamespotcdn.net/gamespot/shared/gs5/gslogo_bw.gif'

    def get_article_url(self, article):
        return article.get('link') + '?print=1'
