#!/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__ = 'Macworld is an independent journal not affiliated with Apple Computer.'

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

from calibre.web.feeds.news import BasicNewsRecipe

temp_files = []
articles_are_obfuscated = True

class macWorld(BasicNewsRecipe):
    __author__    = 'Lorenzo Vigentini'
    description   = 'Macworld is an independent journal not affiliated with Apple Computer.'
    cover_url     = 'http://images.macworld.com/images/templates/v4/mw-logo.gif'

    title          = 'Mac World '
    publisher      = 'IDG Communication'
    category       = 'Apple, Mac, video, computing, product reviews, editing, cameras, production'

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

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

    remove_javascript     = True
    no_stylesheets        = True

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

    remove_tags        = [
                            {'class':['toolBar','mac_tags','toolBar  btmTools','textAds']},
                            dict(name='p', attrs={'class':'breadcrumbs'}),
                            dict(id=['breadcrumb','sidebar','comments','topContentWrapper',
                                    'rightColumn', 'aboveFootPromo', 'storyCarousel']),
                            {'class':lambda x: x and ('tools' in x or 'toolBar'
                                in x)}

                        ]

    feeds          = [
                       (u'MacWorld Headlines', u'http://rss.macworld.com/macworld/news'),
                       (u'How-To', u'http://rss.macworld.com/macworld/howto'),
                       (u'Security', u'http://rss.macworld.com/macworld/topics/security'),
                       (u'MAC IT', u'http://rss.macworld.com/macworld/topics/mac_it'),
                       (u'Business Mac', u'http://rss.macworld.com/macworld/topics/business_mac'),
                       (u'Reviews', u'http://rss.macworld.com/macworld/reviews'),
                       (u'Products: Mac', u'http://rss.macworld.com/macworld/products/mac'),
                       (u'Products: iPod', u'http://rss.macworld.com/macworld/products/ipod'),
                       (u'Products: iPhone', u'http://rss.macworld.com/macworld/products/iphone'),
                       (u'Products: Software', u'http://rss.macworld.com/macworld/products/mac/software'),
                       (u'OSX Hints', u'http://rss.macworld.com/macworld/weblogs/macosxhints'),
                       (u'Mac Gems', u'http://rss.macworld.com/macworld/weblogs/macgems'),
                       (u'Mac 911', u'http://rss.macworld.com/macworld/weblogs/mac911'),
                       (u'Game Room', u'http://rss.macworld.com/macworld/topics/games'),
                       (u'Editos notes', u'http://rss.macworld.com/macworld/weblogs/editors'),
                       (u'Creative notes', u'http://rss.macworld.com/macworld/weblogs/creative'),
                       (u'Playlist', u'http://rss.macworld.com/macworld/weblogs/ipodblog'),
                       (u'Mobile', u'http://rss.macworld.com/macworld/weblogs/mobile'),
                       (u'From the lab', u'http://rss.macworld.com/macworld/weblogs/macworldlab'),
                       (u'MacUser', u'http://rss.macworld.com/macworld/weblogs/macuser')
                     ]

    extra_css = '''
                h1 {color:#008852;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; line-height:18px;}
                h2 {color:#4D4D4D;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; line-height:16px; }
                h3 {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif; font-size:15px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px;}
                h4 {color:#333333; font-family:Arial,Helvetica,sans-serif;font-size:13px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; }
                h5 {color:#333333; font-family:Arial,Helvetica,sans-serif; font-size:11px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; 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;}
                .articleInfo {color:#4D4D4D;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;}
                img {align:left;}
                '''
