#!/usr/pkg/bin/python3.13
__license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini'
__copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
__version__ = 'v1.01'
__date__ = '14, January 2010'
__description__ = 'CIO is the leading information brand for today s busy chief information officer. '

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

from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ptempfile import PersistentTemporaryFile


class cio(BasicNewsRecipe):
    __author__ = 'Lorenzo Vigentini'
    description = 'CIO is the leading information brand for today\'s busy chief information officer.'
    cover_url = 'http://media.cio.co.uk/graphics/shared/cio-logo.gif'

    title = 'CIO '
    publisher = 'IDG Communication'
    category = 'IT, technology, business, industry'

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

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

    remove_javascript = True
    no_stylesheets = True

    temp_files = []
    articles_are_obfuscated = True

    def get_obfuscated_article(self, url):
        br = self.get_browser()
        br.open(url)
        response = br.follow_link(url_regex='&print&intcmp=ROSATT2$', nr=0)
        html = response.read()
        self.temp_files.append(PersistentTemporaryFile('_fa.html'))
        self.temp_files[-1].write(html)
        self.temp_files[-1].close()
        return self.temp_files[-1].name

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

    feeds = [
        (u'News', u'http://www.cio.co.uk/rss/feeds/cio-news.xml'),
        (u'Debate', u'http://www.cio.co.uk/rss/feeds/cio-debate.xml'),
        (u'Analysis', u'http://www.cio.co.uk/rss/feeds/cio-analysis.xml'),
        (u'Opinion', u'http://www.cio.co.uk/rss/feeds/cio-opinion.xml'),
        (u'In-Depth', u'http://www.cio.co.uk/rss/feeds/cio-in-depth.xml'),
        (u'Change management',
         u'http://www.cio.co.uk/rss/feeds/cio-change-management-management.xml'),
        (u'Regulatory compliance',
         u'http://www.cio.co.uk/rss/feeds/cio-regulatory-compliance-management.xml'),
        (u'Business strategy',
         u'http://www.cio.co.uk/rss/feeds/cio-business-strategy-management.xml'),
        (u'Technology', u'http://www.cio.co.uk/rss/feeds/cio-technology-management.xml'),
        (u'Security', u'http://www.cio.co.uk/rss/feeds/cio-security-management.xml'),
        (u'Soft skills', u'http://www.cio.co.uk/rss/feeds/cio-soft-skills-management.xml'),
        (u'The CIO career',
         u'http://www.cio.co.uk/rss/feeds/cio-cio-career-management.xml'),
        (u'Budgets', u'http://www.cio.co.uk/rss/feeds/cio-budgets-management.xml'),
        (u'Supplier management',
         u'http://www.cio.co.uk/rss/feeds/cio-supplier-management-management.xml'),
        (u'Board politics',
         u'http://www.cio.co.uk/rss/feeds/cio-board-politics-management.xml'),
        (u'Enterprise software',
         u'http://www.cio.co.uk/rss/feeds/cio-enterprise-software-technology.xml'),
        (u'Mobile and wireless',
         u'http://www.cio.co.uk/rss/feeds/cio-mobile-wireless-technology.xml'),
        (u'Security', u'http://www.cio.co.uk/rss/feeds/cio-security-technology.xml'),
        (u'Storage', u'http://www.cio.co.uk/rss/feeds/cio-storage-technology.xml'),
        (u'Desktop and client',
         u'http://www.cio.co.uk/rss/feeds/cio-desktop-client-technology.xml'),
        (u'Outsourcing', u'http://www.cio.co.uk/rss/feeds/cio-outsourcing-technology.xml'),
        (u'Internet and e-commerce',
         u'http://www.cio.co.uk/rss/feeds/cio-internet-technology.xml'),
        (u'Database management',
         u'http://www.cio.co.uk/rss/feeds/cio-database-management-technology.xml'),
        (u'Communications and networking ',
         u'http://www.cio.co.uk/rss/feeds/cio-communication-networking-technology.xml'),
        (u'Grid computing',
         u'http://www.cio.co.uk/rss/feeds/cio-grid-computing-cloud-technology.xml'),
        (u'Enterprise search',
         u'http://www.cio.co.uk/rss/feeds/cio-enterprise-search-technology.xml'),
        (u'CRM ', u'http://www.cio.co.uk/rss/feeds/cio-crm-technology.xml'),
        (u'Ade McCormack ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-ade-mccormack.xml'),
        (u'Andy Hayler ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-andy-hayler.xml'),
        (u'CEB ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-ceb.xml'),
        (u'CIO Staff ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-cio-staff.xml'),
        (u'Dave Pepperell ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-dave-pepperell.xml'),
        (u'Elliot Limb ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-elliot-limb.xml'),
        (u'Freeform Dynamics ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-freeform-dynamics.xml'),
        (u'Giles Nelson ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-giles-nelson.xml'),
        (u'Mark Chillingworth ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-mark-chillingworth.xml'),
        (u'Martin Veitch ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-martin-veitch.xml'),
        (u'Mike Altendorf ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-mike-altendorf.xml'),
        (u'Richard Steel ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-richard-steel.xml'),
        (u'Richard Sykes ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-richard-sykes.xml'),
        (u'Rob Llewellyn ',
         u'http://www.cio.co.uk/rss/feeds/cio-opinion-rob-llewellyn.xml'),
        (u'Free thinking ',
         u'http://www.cio.co.uk/rss/feeds/cio-blog-free-thinking.xml'),
        (u'Leading CIOs ',
         u'http://www.cio.co.uk/rss/feeds/cio-blog-leading-cios.xml'),
        (u'CIO News View ',
         u'http://www.cio.co.uk/rss/feeds/cio-blog-cio-news-view.xml'),
        (u'CIO Blog ', u'http://www.cio.co.uk/rss/feeds/cio-blog-cio-blog.xml'),
        (u'Transformation CIO ',
         u'http://www.cio.co.uk/rss/feeds/cio-blog-transformation-cio.xml')
    ]
