#!/usr/bin/env  python
__license__     = 'GPL v3'
__author__      = 'Lorenzo Vigentini'
__copyright__   = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
__version__     = 'v1.01'
__date__        = '14, January 2010'
__description__ = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day.'

'''
http://www.computeractive.co.uk/
'''

from calibre.web.feeds.news import BasicNewsRecipe

class computeractive(BasicNewsRecipe):
    __author__    = 'Lorenzo Vigentini'
    description   = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day.'
    cover_url     = 'http://images.pcworld.com/images/common/header/header-logo.gif'

    title          = 'Computer act!ve'
    publisher      = 'Incisive media'
    category       = 'PC, video, computing, product reviews, editing, cameras, production'

    language       = 'en'
    timefmt        = '[%a, %d %b, %Y]'

    oldest_article        = 7
    max_articles_per_feed = 25
    use_embedded_content  = False
    recursion             = 10

    remove_javascript     = True
    no_stylesheets        = True

    keep_only_tags     = [
                            dict(name='div', attrs={'id':'main'})
                        ]

    remove_tags        = [
                            dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight']}),
                            dict(name='div', attrs={'class':['buyIt','detailMpu']}),
                            dict(name='a', attrs={'class':'largerImage'})
                        ]

    feeds          = [
                       (u'General content', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/all'),
                       (u'News', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/news'),
                       (u'Downloads', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/downloads'),
                       (u'Hardware', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/hardware'),
                       (u'Software', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/software'),
                       (u'Competitions', u'http://www.v3.co.uk/feeds/rss20/personal-technology/competitions')
                     ]


    extra_css = '''
                h1 {font-family:Arial,Helvetica,sans-serif; font-size:20px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;}
                h2 {font-family:Arial,Helvetica,sans-serif; font-size:18px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; }
                h3 {color:#333333;font-family:Arial,Helvetica,sans-serif; font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;}
                h4 {color:#333333; font-family:Arial,Helvetica,sans-serif;font-size:14px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;}
                h5 {color:#333333; font-family:Arial,Helvetica,sans-serif; font-size:12px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;text-transform:uppercase;}
                .newsdate {color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:italic; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
                .author {color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
                p {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:10px;}
                .breadcrumbs {margin:0 0 0.6em 0;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:8px;}
                #breadcrumbsLeft {width:360px; }
                .breadcrumbs ul {color:#999; display:inline; margin:1em 0 0 0; padding:0; list-style:none; }
                .breadcrumbs li { display:inline; }
                .breadcrumbs a:link, .breadcrumbs a:visited { color:#999; text-decoration:none; }
                .breadcrumbs a:hover, .breadcrumbs a:active { color:#999; text-decoration:underline; }
                #postHeader #reviewDetails { padding-left: 0px; }
                #reviewDetails { float:left; margin:0 0 0 10px; padding:0; width:574px; border-top:1px dotted #0071BC; }
        	#reviewDetails div { margin:0; padding:0; }
		#reviewDetailsLeft { float:left; width:334px; margin:0 10px 0 0; padding:0; }
		#reviewDetailsRight { float:right; width:230px; margin:0; padding:0; }
    		#reviewDetails div h2 { font-size:1.2em; float:none; margin:0.5em 0 0.5em 0; padding:0; }
		#reviewDetails #verdict { width:334px; float:left; margin:0; padding:0; }
		#reviewDetails #ratings, #reviewDetails #price { width:230px; float:left; margin:0; padding:0; }
		#reviewDetails #ratings img { border:0; margin:0; padding:0; }
		#verdict p strong { width:334px; float:left; margin:0 0 0.25em; padding:0; }
		#verdict ul { width:334px; float:left; margin:0; padding:0; }
		#verdict li { width:334px; float:left; list-style:none; clear:left; margin:0 4px 0.3em 0px; padding:0 0 0 12px;}
		html > body #verdict li { width:322px; }
                #post { margin-bottom:2em; clear:both; }
                #post .content p { margin:1em 0; line-height:1.5em; }
                #post p a:link { color:#005599; text-decoration:none; font-weight:bold; }
                #post p a:hover, #post p a:active { color:#cc0000; text-decoration:underline; }
                #post p a:visited { color:#003366; text-decoration:none; font-weight:bold; }
                #postHeader .author { font-weight:normal; margin:1em 8px 0.25em 0; }
                #postHeader .postMetaData { color:#666; margin:0 8px 0 0; }
                '''

