New recipe for Press by Darko Miletic

This commit is contained in:
Kovid Goyal 2009-02-18 10:03:09 -08:00
parent 1d5aaaf830
commit e5b151aa69
4 changed files with 70 additions and 1 deletions

View File

@ -310,6 +310,8 @@ def create_cover_image(src, dest, screen_size, rescale_cover=True):
def process_title_page(mi, filelist, htmlfilemap, opts, tdir): def process_title_page(mi, filelist, htmlfilemap, opts, tdir):
old_title_page = None old_title_page = None
f = lambda x : os.path.normcase(os.path.normpath(x)) f = lambda x : os.path.normcase(os.path.normpath(x))
if not isinstance(mi.cover, basestring):
mi.cover = None
if mi.cover: if mi.cover:
if f(filelist[0].path) == f(mi.cover): if f(filelist[0].path) == f(mi.cover):
old_title_page = htmlfilemap[filelist[0].path] old_title_page = htmlfilemap[filelist[0].path]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -29,7 +29,7 @@ recipe_modules = ['recipe_' + r for r in (
'jb_online', 'estadao', 'o_globo', 'vijesti', 'elmundo', 'the_oz', 'jb_online', 'estadao', 'o_globo', 'vijesti', 'elmundo', 'the_oz',
'honoluluadvertiser', 'starbulletin', 'exiled', 'indy_star', 'dna', 'honoluluadvertiser', 'starbulletin', 'exiled', 'indy_star', 'dna',
'pobjeda', 'chicago_breaking_news', 'glasgow_herald', 'linuxdevices', 'pobjeda', 'chicago_breaking_news', 'glasgow_herald', 'linuxdevices',
'hindu', 'cincinnati_enquirer', 'physics_world', 'hindu', 'cincinnati_enquirer', 'physics_world', 'pressonline',
)] )]
import re, imp, inspect, time, os import re, imp, inspect, time, os

View File

@ -0,0 +1,67 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
pressonline.rs
'''
import re
from calibre.web.feeds.recipes import BasicNewsRecipe
class PressOnline(BasicNewsRecipe):
title = 'Press Online'
__author__ = 'Darko Miletic'
description = 'Press Online portal dnevnih novina Press.Najnovije vesti iz Srbije i sveta,Sport,Dzet Set,Politika,Hronika,Komenteri,Zabava,Slike,Video,Horoskop,Nagradne igre,Kvizovi,Igrice'
publisher = 'Press Publishing group'
category = 'news, politics, Serbia'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
encoding = 'utf8'
use_embedded_content = True
cover_url = 'http://www.pressonline.rs/img/logo.gif'
language = _('Serbian')
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: serif1, serif}'
html2lrf_options = [
'--comment', description
, '--category', category
, '--publisher', publisher
]
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
feeds = [
(u'Vesti Dana' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=37')
,(u'Politika' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=29')
,(u'U Fokusu' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=33')
,(u'Globus' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=40')
,(u'Komentar Dana' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=62')
,(u'Hronika' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=39')
,(u'Regioni' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=56')
,(u'Republika Srpska', u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=51')
,(u'Beograd' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=43')
,(u'Dzet-Set Svet' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=41')
,(u'Lifestyle' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=42')
,(u'Sport' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=44')
,(u'Press Magazine' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=63')
,(u'Lola' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=70')
,(u'Duplerica' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=72')
,(u'Presspedia' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=80')
,(u'Kolumne' , u'http://www.pressonline.rs/page/stories/sr.html?view=rss&sectionId=57')
]
def preprocess_html(self, soup):
soup.html['xml:lang'] = 'sr-Latn-RS'
soup.html['lang'] = 'sr-Latn-RS'
mtag = '<meta http-equiv="Content-Language" content="sr-Latn-RS"/>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
soup.head.insert(0,mtag)
img = soup.find('img')
if img:
del img['align']
return soup