
__license__ = 'GPL v3'
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
'''
cvecezla.wordpress.com
'''

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


class CveceZla(BasicNewsRecipe):
    title = 'Cvece zla i naopakog'
    __author__ = 'Darko Miletic'
    description = 'Haoticnost razmisljanja poradja haoticnost pisanja. Muzika, stripovi, igre, knjige, generalno glupiranje...'
    oldest_article = 7
    max_articles_per_feed = 100
    language = 'sr'
    encoding = 'utf-8'
    no_stylesheets = True
    use_embedded_content = False
    publication_type = 'blog'
    extra_css = ' @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} body{font-family: "Trebuchet MS",Trebuchet,Verdana,sans1,sans-serif} .article_description{font-family: sans1, sans-serif} img{display: block } '  # noqa

    conversion_options = {
        'comment': description, 'tags': 'igre, muzika, film, blog, Srbija', 'publisher': 'Mehmet Krljic', 'language': language
    }

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

    remove_tags_before = dict(attrs={'class': 'navigation'})
    remove_tags_after = dict(attrs={'class': 'commentlist'})
    remove_tags = [
        dict(attrs={'class': ['postmetadata alt', 'sharedaddy sharedaddy-dark sd-like-enabled sd-sharing-enabled',
                              'reply', 'navigation']}), dict(attrs={'id': 'respond'})
    ]

    feeds = [(u'Clanci', u'http://cvecezla.wordpress.com/feed/')]

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup
