#!/usr/bin/env  python2

__license__ = 'GPL v3'
__author__ = 'teepel <teepel44@gmail.com>'

'''
rynek-kolejowy.pl
'''

from calibre.web.feeds.news import BasicNewsRecipe


class rynek_kolejowy(BasicNewsRecipe):
    title = u'Rynek Kolejowy'
    __author__ = 'teepel <teepel44@gmail.com>'
    language = 'pl'
    description = u'Rynek Kolejowy - kalendarium wydarzeń branży kolejowej, konferencje, sympozja, targi kolejowe, krajowe i zagraniczne.'
    masthead_url = 'http://p.wnp.pl/images/i/partners/rynek_kolejowy.gif'
    remove_empty_feeds = True
    oldest_article = 1
    max_articles_per_feed = 100
    remove_javascript = True
    no_stylesheets = True

    keep_only_tags = []
    keep_only_tags.append(dict(name='div', attrs={'id': 'mainContent'}))

    remove_tags = []
    remove_tags.append(dict(name='div', attrs={'class': 'right no-print'}))
    remove_tags.append(dict(name='div', attrs={'id': 'font-size'}))
    remove_tags.append(dict(name='div', attrs={'class': 'no-print'}))

    extra_css = '''.wiadomosc_title{ font-size: 1.4em; font-weight: bold; }'''

    feeds = [(u'Wiadomości', u'http://www.rynek-kolejowy.pl/rss/rss.php')]

    def print_version(self, url):
        segment = url.split('/')
        urlPart = segment[3]
        return 'http://www.rynek-kolejowy.pl/drukuj.php?id=' + urlPart
