Merge lp:~tomek3d/calibre/kalibrator into lp:calibre

Proposed by Tomasz Długosz
Status: Merged
Merged at revision: 14506
Proposed branch: lp:~tomek3d/calibre/kalibrator
Merge into: lp:calibre
Diff against target: 117 lines (+29/-16)
3 files modified
.bzrignore (+1/-1)
recipes/fronda.recipe (+6/-3)
recipes/gosc_niedzielny.recipe (+22/-12)
To merge this branch: bzr merge lp:~tomek3d/calibre/kalibrator
Reviewer Review Type Date Requested Status
Kovid Goyal Pending
Review via email: mp+151373@code.launchpad.net
To post a comment you must log in.
lp:~tomek3d/calibre/kalibrator updated
13582. By Tomasz Długosz

some improvements in gosc_niedzielny.recipe

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-11-10 10:51:21 +0000
3+++ .bzrignore 2013-03-03 00:31:24 +0000
4@@ -37,7 +37,7 @@
5 calibre_plugins/
6 recipes/.git
7 recipes/.gitignore
8-recipes/README
9+recipes/README.md
10 recipes/katalog_egazeciarz.recipe
11 recipes/tv_axnscifi.recipe
12 recipes/tv_comedycentral.recipe
13
14=== modified file 'recipes/fronda.recipe'
15--- recipes/fronda.recipe 2013-02-19 17:07:32 +0000
16+++ recipes/fronda.recipe 2013-03-03 00:31:24 +0000
17@@ -1,7 +1,7 @@
18 #!/usr/bin/env python
19
20 __license__ = 'GPL v3'
21-__copyright__ = u'2010-2012, Tomasz Dlugosz <tomek3d@gmail.com>'
22+__copyright__ = u'2010-2013, Tomasz Dlugosz <tomek3d@gmail.com>'
23 '''
24 fronda.pl
25 '''
26@@ -68,7 +68,8 @@
27 article_url = 'http://www.fronda.pl' + article_a['href']
28 article_title = self.tag_to_string(article_a)
29 articles[genName].append( { 'title' : article_title, 'url' : article_url, 'date' : article_date })
30- feeds.append((genName, articles[genName]))
31+ if articles[genName]:
32+ feeds.append((genName, articles[genName]))
33 return feeds
34
35 keep_only_tags = [
36@@ -82,8 +83,10 @@
37 dict(name='h3', attrs={'class':'block-header article comments'}),
38 dict(name='ul', attrs={'class':'comment-list'}),
39 dict(name='ul', attrs={'class':'category'}),
40+ dict(name='ul', attrs={'class':'tag-list'}),
41 dict(name='p', attrs={'id':'comments-disclaimer'}),
42 dict(name='div', attrs={'style':'text-align: left; margin-bottom: 15px;'}),
43- dict(name='div', attrs={'style':'text-align: left; margin-top: 15px;'}),
44+ dict(name='div', attrs={'style':'text-align: left; margin-top: 15px; margin-bottom: 30px;'}),
45+ dict(name='div', attrs={'class':'related-articles content'}),
46 dict(name='div', attrs={'id':'comment-form'})
47 ]
48
49=== modified file 'recipes/gosc_niedzielny.recipe'
50--- recipes/gosc_niedzielny.recipe 2012-05-15 04:10:12 +0000
51+++ recipes/gosc_niedzielny.recipe 2013-03-03 00:31:24 +0000
52@@ -2,7 +2,8 @@
53 #!/usr/bin/env python
54
55 __license__ = 'GPL v3'
56-__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com'
57+__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com \
58+ 2013, Tomasz Długosz, tomek3d@gmail.com'
59
60 from calibre.web.feeds.news import BasicNewsRecipe
61 from calibre.ptempfile import PersistentTemporaryFile
62@@ -12,9 +13,9 @@
63 class GN(BasicNewsRecipe):
64 EDITION = 0
65
66- __author__ = 'Piotr Kontek'
67- title = u'Gość niedzielny'
68- description = 'Weekly magazine'
69+ __author__ = 'Piotr Kontek, Tomasz Długosz'
70+ title = u'Gość Niedzielny'
71+ description = 'Ogólnopolski tygodnik katolicki'
72 encoding = 'utf-8'
73 no_stylesheets = True
74 language = 'pl'
75@@ -38,17 +39,25 @@
76 first = True
77 for p in main_section.findAll('p', attrs={'class':None}, recursive=False):
78 if first and p.find('img') != None:
79- article = article + '<p>'
80- article = article + str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/')
81- article = article + '<font size="-2">'
82+ article += '<p>'
83+ article += str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/')
84+ article += '<font size="-2">'
85 for s in p.findAll('span'):
86- article = article + self.tag_to_string(s)
87- article = article + '</font></p>'
88+ article += self.tag_to_string(s)
89+ article += '</font></p>'
90 else:
91- article = article + str(p).replace('src="/files/','src="http://www.gosc.pl/files/')
92+ article += str(p).replace('src="/files/','src="http://www.gosc.pl/files/')
93 first = False
94+ limiter = main_section.find('p', attrs={'class' : 'limiter'})
95+ if limiter:
96+ article += str(limiter)
97
98- html = unicode(title) + unicode(authors) + unicode(article)
99+ html = unicode(title)
100+ #sometimes authors are not filled in:
101+ if authors:
102+ html += unicode(authors) + unicode(article)
103+ else:
104+ html += unicode(article)
105
106 self.temp_files.append(PersistentTemporaryFile('_temparse.html'))
107 self.temp_files[-1].write(html)
108@@ -65,7 +74,8 @@
109 if img != None:
110 a = img.parent
111 self.EDITION = a['href']
112- self.title = img['alt']
113+ #this was preventing kindles from moving old issues to 'Back Issues' category:
114+ #self.title = img['alt']
115 self.cover_url = 'http://www.gosc.pl' + img['src']
116 if year != date.today().year or not first:
117 break

Subscribers

People subscribed via source and target branches