
__license__   = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
www.kamerabild.se
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Kamerabild(BasicNewsRecipe):
    title                 = 'Kamera & Bild'
    __author__            = 'Darko Miletic'
    description           = 'Photo News from Sweden'
    publisher             = 'politiken.dk'
    category              = 'news, photograph, Sweden'
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    remove_empty_feeds    = True
    use_embedded_content  = False
    encoding              = 'utf8'
    language              = 'sv'

    extra_css = ' body{font-family: Verdana,Arial,Helvetica,sans-serif } .title{font-weight: bold} .pricerunnerAdContainer{border-bottom: 1px solid; border-top: 1px solid; margin-top: 0.5em; margin-bottom: 0.5em} .elementTeaserKicker{font-weight: bold; color: #AE0A10} '

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

    feeds              = [(u'Articles', u'http://www.kamerabild.se/cmlink/Nyheter-fran-KAMERA-BILD-1.43315.xml')]
    keep_only_tags     = [dict(name='div',attrs={'class':'container'})]
    remove_tags_after = dict(name='div',attrs={'class':'editor'})
    remove_tags        = [
                            dict(name=['object','link','iframe'])
                           ,dict(name='div',attrs={'class':['pricerunner_head','sideBar','img']})
                         ]

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


