#!/usr/pkg/bin/python3.13

__license__ = 'GPL v3'
__copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
'''
cinebel.be
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Cinebel(BasicNewsRecipe):
    title = u'Cinebel'
    __author__ = u'Lionel Bergeret'
    description = u'Cinema news from Belgium in French'
    publisher = u'cinebel.be'
    category = 'news, cinema, movie, Belgium'
    oldest_article = 15
    language = 'fr'

    max_articles_per_feed = 20
    no_stylesheets = True
    use_embedded_content = False
    timefmt = ' [%d %b %Y]'
    filterDuplicates = True

    keep_only_tags = [
        dict(name='span', attrs={'class': 'movieMainTitle'}), dict(name='div', attrs={'id': 'filmPoster'}), dict(
            name='div', attrs={'id': 'filmDefinition'}), dict(name='div', attrs={'id': 'synopsis'})
    ]

    feeds = [

    (u'Les sorties de la semaine', u'http://www.cinebel.be/Servlets/RssServlet?languageCode=fr&rssType=0'),
    (u'Top 10', u'http://www.cinebel.be/Servlets/RssServlet?languageCode=fr&rssType=2')
    ]

    def preprocess_html(self, soup):
        for alink in soup.findAll('a', href=True):
            tstr = "Site officiel: " + alink['href']
            alink.replaceWith(tstr)
        return soup

    def get_cover_url(self):
        cover_url = 'http://www.cinebel.be/portal/resources/common/logo_index.gif'
        return cover_url
