# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai

__license__ = 'GPL v3'
__copyright__ = '2009-2012, Darko Miletic <darko.miletic at gmail.com>'

'''
24sata.rs
'''

import re
from calibre.web.feeds.recipes import BasicNewsRecipe


class Ser24Sata(BasicNewsRecipe):
    title = '24 Sata - Sr'
    __author__ = 'Darko Miletic'
    description = '24 sata portal vesti iz Srbije'
    publisher = 'Ringier d.o.o.'
    category = 'news, politics, entertainment, Serbia'
    oldest_article = 2
    max_articles_per_feed = 100
    no_stylesheets = True
    encoding = 'utf-8'
    use_embedded_content = False
    language = 'sr'
    publication_type = 'newsportal'
    extra_css             = """
                               @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
                               body{font-family: serif1, serif}
                            """

    conversion_options = {
        'comment': description, 'tags': category, 'publisher': publisher, 'language': language
    }

    preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]

    feeds = [
        (u'Vesti', u'http://www.24sata.rs/rss/vesti.xml'),
        (u'Sport', u'http://www.24sata.rs/rss/sport.xml'),
        (u'Šou', u'http://www.24sata.rs/rss/sou.xml'),
        (u'Specijal', u'http://www.24sata.rs/rss/specijal.xml'),
        (u'Novi Sad', u'http://www.24sata.rs/rss/ns.xml')
    ]

    def print_version(self, url):
        dpart, spart, apart = url.rpartition('/')
        return dpart + '/print/' + apart
