__license__ = 'GPL v3'
__copyright__ = '2010, Anton Gillert <atx at binaryninja.de>'

'''
Fetch Heise Open.
'''
from calibre.web.feeds.news import BasicNewsRecipe


class HeiseOpenDe(BasicNewsRecipe):

    title = 'Heise Open'
    description = 'Opensource news from Germany'
    __author__ = 'Anton Gillert'
    use_embedded_content = False
    language = 'de'
    timefmt = ' [%d %b %Y]'
    max_articles_per_feed = 40
    no_stylesheets = True

    feeds = [('Heise Open', 'http://www.heise.de/open/news/news-atom.xml')]

    def print_version(self, url):
        return url + '?view=print'

    remove_tags = [dict(id='navi_top'),
                   dict(id='navi_bottom'),
                   dict(name='div', attrs={'class': 'navi_top_logo'}),
                   dict(name='img', attrs={
                        'src': '/open/icons/open_logo_2009_weiss.gif'}),
                   dict(name='h5', attrs={'style': 'margin: 0.5em 0;'}),
                   dict(name='p', attrs={'class': 'news_datum'}),
                   dict(name='p', attrs={'class': 'size80'})]
    remove_tags_after = [dict(name='p', attrs={'class': 'size80'})]

    def get_cover_url(self):
        return 'http://www.heise.de/open/icons/open_logo_2009_weiss.gif'
