From 0f5b96c51b8dc0d9515d1177ed5cb094edd0806a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Mar 2011 09:29:09 -0700 Subject: [PATCH 1/4] The Bay Citizen by noah --- resources/recipes/bay_citizen.recipe | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 resources/recipes/bay_citizen.recipe diff --git a/resources/recipes/bay_citizen.recipe b/resources/recipes/bay_citizen.recipe new file mode 100644 index 0000000000..e6a6c2b63d --- /dev/null +++ b/resources/recipes/bay_citizen.recipe @@ -0,0 +1,46 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class TheBayCitizen(BasicNewsRecipe): + title = 'The Bay Citizen' + language = 'en' + __author__ = 'noah' + description = 'The Bay Citizen' + publisher = 'The Bay Citizen' + INDEX = u'http://www.baycitizen.org' + category = 'news' + oldest_article = 2 + max_articles_per_feed = 20 + no_stylesheets = True + masthead_url = 'http://media.baycitizen.org/images/layout/logo1.png' + feeds = [('Main Feed', 'http://www.baycitizen.org/feeds/stories/')] + keep_only_tags = [dict(name='div', attrs={'class':'story'})] + remove_tags = [ + dict(name='div', attrs={'class':'socialBar'}), + dict(name='div', attrs={'id':'text-resize'}), + dict(name='div', attrs={'class':'story relatedContent'}), + dict(name='div', attrs={'id':'comment_status_loading'}), + ] + + def append_page(self, soup, appendtag, position): + pager = soup.find('a',attrs={'class':'stry-next'}) + if pager: + nexturl = self.INDEX + pager['href'] + soup2 = self.index_to_soup(nexturl) + texttag = soup2.find('div', attrs={'class':'body'}) + for it in texttag.findAll(style=True): + del it['style'] + newpos = len(texttag.contents) + self.append_page(soup2,texttag,newpos) + texttag.extract() + appendtag.insert(position,texttag) + + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + self.append_page(soup, soup.body, 3) + garbage = soup.findAll(id='story-pagination') + [trash.extract() for trash in garbage] + garbage = soup.findAll('em', 'cont-from-prev') + [trash.extract() for trash in garbage] + return soup From 6b6d91e8543ab7069c89fe2d025687e8ae46eed3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Mar 2011 09:34:03 -0700 Subject: [PATCH 2/4] Salt Lake City Tribune by Charles Holbert --- resources/recipes/sltrib.py | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 resources/recipes/sltrib.py diff --git a/resources/recipes/sltrib.py b/resources/recipes/sltrib.py new file mode 100644 index 0000000000..a6701ae296 --- /dev/null +++ b/resources/recipes/sltrib.py @@ -0,0 +1,56 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1278347258(BasicNewsRecipe): + title = u'Salt Lake City Tribune' + __author__ = 'Charles Holbert' + oldest_article = 7 + max_articles_per_feed = 100 + + description = '''Utah's independent news source since 1871''' + publisher = 'http://www.sltrib.com/' + category = 'news, Utah, SLC' + language = 'en' + encoding = 'utf-8' + #delay = 1 + #simultaneous_downloads = 1 + remove_javascript = True + use_embedded_content = False + no_stylesheets = True + + #masthead_url = 'http://www.sltrib.com/csp/cms/sites/sltrib/assets/images/logo_main.png' + #cover_url = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg9/lg/UT_SLT.jpg' + + keep_only_tags = [dict(name='div',attrs={'id':'imageBox'}) + ,dict(name='div',attrs={'class':'headline'}) + ,dict(name='div',attrs={'class':'byline'}) + ,dict(name='p',attrs={'class':'TEXT_w_Indent'})] + + feeds = [(u'SL Tribune Today', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=All'), + (u'Utah News', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=UtahNews'), + (u'Business News', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Money'), + (u'Technology', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Technology'), + (u'Most Popular', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rsspopular.csp'), + (u'Sports', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Sports')] + + extra_css = ''' + .headline{font-family:Arial,Helvetica,sans-serif; font-size:xx-large; font-weight: bold; color:#0E5398;} + .byline{font-family:Arial,Helvetica,sans-serif; color:#333333; font-size:xx-small;} + .storytext{font-family:Arial,Helvetica,sans-serif; font-size:medium;} + ''' + + def print_version(self, url): + seg = url.split('/') + x = seg[5].split('-') + baseURL = 'http://www.sltrib.com/csp/cms/sites/sltrib/pages/printerfriendly.csp?id=' + s = baseURL + x[0] + return s + + def get_cover_url(self): + cover_url = None + href = 'http://www.newseum.org/todaysfrontpages/hr.asp?fpVname=UT_SLT&ref_pge=lst' + soup = self.index_to_soup(href) + div = soup.find('div',attrs={'class':'tfpLrgView_container'}) + if div: + cover_url = div.img['src'] + return cover_url + From e705eb0f52cc29d2591b3a757f108808e957ecb2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Mar 2011 09:57:53 -0700 Subject: [PATCH 3/4] Remove Alt+N,P shortcuts since they apparently don't work on all machines --- src/calibre/gui2/dialogs/metadata_single.py | 8 ++++---- src/calibre/gui2/metadata/single.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index 3715d27bfc..9efe7f7160 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -469,19 +469,19 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog): self.ts_tooltips = (ok_tooltip, bad_tooltip) self.row_delta = 0 if prev: - self.prev_button = QPushButton(QIcon(I('back.png')), _('&Previous'), + self.prev_button = QPushButton(QIcon(I('back.png')), _('Previous'), self) self.button_box.addButton(self.prev_button, self.button_box.ActionRole) - tip = _('Save changes and edit the metadata of %s')%prev + tip = (_('Save changes and edit the metadata of %s')+' [Alt+Left]')%prev self.prev_button.setToolTip(tip) self.prev_button.clicked.connect(partial(self.next_triggered, -1)) self.prev_button.setShortcut(QKeySequence('Alt+Left')) if next_: - self.next_button = QPushButton(QIcon(I('forward.png')), _('&Next'), + self.next_button = QPushButton(QIcon(I('forward.png')), _('Next'), self) self.button_box.addButton(self.next_button, self.button_box.ActionRole) - tip = _('Save changes and edit the metadata of %s')%next_ + tip = (_('Save changes and edit the metadata of %s')+' [Alt+Right]')%next_ self.next_button.setToolTip(tip) self.next_button.clicked.connect(partial(self.next_triggered, 1)) self.next_button.setShortcut(QKeySequence('Alt+Right')) diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index d2b932c7ec..3b6dd0e253 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -43,11 +43,11 @@ class MetadataSingleDialogBase(ResizableDialog): self) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) - self.next_button = QPushButton(QIcon(I('forward.png')), _('&Next'), + self.next_button = QPushButton(QIcon(I('forward.png')), _('Next'), self) self.next_button.setShortcut(QKeySequence('Alt+Right')) self.next_button.clicked.connect(partial(self.do_one, delta=1)) - self.prev_button = QPushButton(QIcon(I('back.png')), _('&Previous'), + self.prev_button = QPushButton(QIcon(I('back.png')), _('Previous'), self) self.prev_button.setShortcut(QKeySequence('Alt+Left')) From 137b55589382046dc5604ee17715709c0a1b37e4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Mar 2011 10:05:16 -0700 Subject: [PATCH 4/4] Various Romanian news sources by Silviu Cotoara --- resources/images/news/avantaje.png | Bin 0 -> 924 bytes resources/images/news/onemagazine.png | Bin 0 -> 316 bytes resources/images/news/pcworldro.png | Bin 0 -> 386 bytes resources/images/news/protvmagazin.png | Bin 0 -> 251 bytes resources/images/news/psychologies.png | Bin 0 -> 750 bytes resources/images/news/tvmania.png | Bin 0 -> 379 bytes resources/images/news/viva.png | Bin 0 -> 747 bytes resources/recipes/avantaje.recipe | 57 +++++++++++++++++ resources/recipes/onemagazine.recipe | 72 ++++++++++++++++++++++ resources/recipes/pcworldro.recipe | 67 ++++++++++++++++++++ resources/recipes/protvmagazin.recipe | 71 +++++++++++++++++++++ resources/recipes/psychologies.recipe | 59 ++++++++++++++++++ resources/recipes/thai_post_daily.recipe | 1 + resources/recipes/tvmania.recipe | 72 ++++++++++++++++++++++ resources/recipes/viva.recipe | 75 +++++++++++++++++++++++ resources/template-functions.json | 1 + 16 files changed, 475 insertions(+) create mode 100644 resources/images/news/avantaje.png create mode 100644 resources/images/news/onemagazine.png create mode 100644 resources/images/news/pcworldro.png create mode 100644 resources/images/news/protvmagazin.png create mode 100644 resources/images/news/psychologies.png create mode 100644 resources/images/news/tvmania.png create mode 100644 resources/images/news/viva.png create mode 100644 resources/recipes/avantaje.recipe create mode 100644 resources/recipes/onemagazine.recipe create mode 100644 resources/recipes/pcworldro.recipe create mode 100644 resources/recipes/protvmagazin.recipe create mode 100644 resources/recipes/psychologies.recipe create mode 100644 resources/recipes/tvmania.recipe create mode 100644 resources/recipes/viva.recipe diff --git a/resources/images/news/avantaje.png b/resources/images/news/avantaje.png new file mode 100644 index 0000000000000000000000000000000000000000..79f83c26657eb3ab20dd2c5dbadcb4b53d6fe433 GIT binary patch literal 924 zcmV;N17rM&P)YwJq00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D12IWNK~zXft(Hwl z6k!<0r=ku)hk_1*;KfUaAUXsdx^(K?sY9oZQHKTD-L?n~6Bi^fERn)PL}5sTBo#$r zuzf0+U`QV#wcoq0>wdc*W50La-ErNSb(}33hLw5V|NDQw{?DUq{O>O?#;_Rc$z0WofQ~ht{$#7eL_TijxIhoH-Ey6LVxOx1FBX)8$H~Fm@=oXIo zm*0bXF9#H7aNku>>d%yx6X6c8_@ubGPq<&Mn1XI15_lqcX{~N0x>h> z14~16l28-GXogT$5fyiFA!31;d$J%o@=iLQ8LdfriKw<$vk zkeHevrV7zxw>A;K{INjfbLnS1Gx~`Pn3|RrWA$FI?*y?~K~Rh|CHbudQS-Vr#BwB^ z>U%@~5Di*0bg);?jBP{|fe7HHj4b6%a&5;^_Zsb4IXy>y|9BqBlZdgd5e{1`g_)Xg zsyY?Oat+Z%&(X-{YSuZZS9oE1$@JDLB6BLZ=ZfrEIhc&r$%~V6Bn6CI7Ls^ka-3ZF4x=?r#Yl0(mK6B@TgrlTNzYK^Qs;a4gmMLUnp@VU+}!3g;h+dzjm?VVQD%F3As^|y*`plhUI zgl*XX*c7y#gtlQVsct5MLT!!8P0VwpzOk&io*Tp6xc8tA5MhDhp)ebE2fPyk+&(~v yviE1L=ZtQ_$@a1h{ literal 0 HcmV?d00001 diff --git a/resources/images/news/onemagazine.png b/resources/images/news/onemagazine.png new file mode 100644 index 0000000000000000000000000000000000000000..61ce048c3061bbff754ac0a25ab4112e849a08c5 GIT binary patch literal 316 zcmV-C0mJ@@P)>fCIzd$?pcx?(umck?0%8INh-8Zenhng4Tr6X?Q3RY6 zo&5aX%h|qbQcC)zfOIXff! z60gO{89CMBg3~J}n=~nxDt^fZLkyAWU8NPf zyQXZ#9+`UJDbGaJsweGtf1!=%IXRYiQ;%~i)&tMFoTu?l|J-Y}Ilci_<)Py@w+jjY O0000%?Be9?zP#)zH0<{D+^VeXA}rjxyyPxC?AFxOQe5N? z9OQDIzB;0<4)H*!m+T6^Rob0l+ z+)h;NmYn1&G~_-+^zQ7`US!m!r0gCf+;VixDm=`(yxcNG^v=}GQe51QjNB3&@E#T{ z00001bW%=J06^y0W&i*Hlu1NER2Y?&jzJScFcgGSK{}0~n0Q(ts-i8W`2YW{&!q=W z-F>r%Z{E%oI64`DsfY;2)VE<3t@3<3A{aNB~Tk8}=n@t|*&wQZ{qh(iM?hQP-ww@A=iik$&{4&|$J|JSM&R?pwD?u5;j_4t@SRB1s&Vq$@Uot8>4G?o@45LQvBEZWg7CZS-z zHz8w029PLM8F#V8Rz>^~TtmZwyb7N=QMl3D5D_jkRqF&9iCxl=4=QF8@;OsD(cch> z5ioL4aZoddJ+aeFF`8~BrYUtZQ$o{)7!0M|EKOJ!VbR_m?ndrJvx*rKMp|Q{5XAzp z{hovj!qV`Gh8>n>SadLRt&1GD4p-4fPK*14j``rXcz*UT>$X#f3 zAlMbYU~)}qw^TWl^ms;$gAu^?hkexA5DcG-^;sdf6)^``=*fICN^3$1f{CZkgiGNn z70VzdAfzf8f;~CZh*QI2u0xQiP^mG+g{B|@e_h0IV$|ZaGtd}!&^|j&@3Oq3mX_3spvY<`XTKn*WykjOJDQnn#l-r5`!NHT5em3geBdzjSnfNUPs_nh)gdYdkvhD(ahm7nB|x zaqQfEd}h`2Ycw~Rl;1G+-#68yPK4LD)VRe|txn7IdF^c1 zLQ8M>-khs3_>#){?2Yc!m5x2`!1wNM{Wz`os9)ZsSEKWmsh|G3`ReNGC02Z4xb5Vn w*_O6#oqBEoc=G#7CRctwwPjBG9*-2Qu@(O<_YB;JS}OpXuQK2rtT+?@2X{mnLjV8( literal 0 HcmV?d00001 diff --git a/resources/images/news/tvmania.png b/resources/images/news/tvmania.png new file mode 100644 index 0000000000000000000000000000000000000000..022267f88507818d9585021ab19cd4eec22d04fe GIT binary patch literal 379 zcmV->0fhdEP)HHP>ttL~aiWA!p$nc|KDJS7czB+1dHNot>HO&1N%;NPi(Tdf%@sKg1@k;uOc2 z#+t+>Q@l(i522~*4eVkxzzwWL;BpYb5Bv<$DQ;reRP`#}MEqW_U4y2o-{TIp@CCn8 z$)k44O;vxyE!<8e54$y34gCqv@VTk#^%nR^fFI4D({CO2u@u`09*4aZ=hyHQZ&S(7 z=eTwTeGI}rOC=xTEAEEx6;5zZ2Lw{dr_Q@D4)+VJG*!KW4ct#9AGZkx{+0=*K?Vn* zw=qg3zwX5UGf3kgnP>IQpKic|F8HDhM$YG8F7Gf-C4cxIf+Jk-`1Y}P5g2-x{+Sjg Z_zibqWK1t_rZ@lq002ovPDHLkV1iYPpvnLM literal 0 HcmV?d00001 diff --git a/resources/images/news/viva.png b/resources/images/news/viva.png new file mode 100644 index 0000000000000000000000000000000000000000..e01fc6125ec954e79eeba1027e178773a968e3d3 GIT binary patch literal 747 zcmVcO4J{ewN`yZh1T2x)mL7^fOu#UC}6ZHPanb*zyP56 z$>)?Gnxb~60Db3fWd;SSlu>t`Z2c;Q zM<2uPyNBv)$AN%=&cYcYHAoV?o6T!Z(P#wd2e=)dqd+0ME z8O^We5fxGsMOE1T=+pczb0Bc%!_x!`U@?#Z-T5UVo`1xQ-j6F3lY5B<@&5h%yYK~n zzi@f@BzAchm;*6 dRc!A#{{idBg#fM<7uNs)002ovPDHLkV1ghtTf+bV literal 0 HcmV?d00001 diff --git a/resources/recipes/avantaje.recipe b/resources/recipes/avantaje.recipe new file mode 100644 index 0000000000..9a48616fa1 --- /dev/null +++ b/resources/recipes/avantaje.recipe @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +avantaje.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Avantaje(BasicNewsRecipe): + title = u'Avantaje' + __author__ = u'Silviu Cotoar\u0103' + description = u'' + publisher = u'Avantaje' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,Stiri' + encoding = 'utf-8' + cover_url = 'http://www.avantaje.ro/images/default/logo.gif' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + keep_only_tags = [ + dict(name='div', attrs={'id':'articol'}) + , dict(name='div', attrs={'class':'gallery clearfix'}) + , dict(name='div', attrs={'align':'justify'}) + ] + + remove_tags = [ + dict(name='div', attrs={'id':['color_sanatate_box']}) + , dict(name='div', attrs={'class':['nav']}) + , dict(name='div', attrs={'class':['voteaza_art']}) + , dict(name='div', attrs={'class':['bookmark']}) + , dict(name='div', attrs={'class':['links clearfix']}) + , dict(name='div', attrs={'class':['title']}) + ] + + remove_tags_after = [ + dict(name='div', attrs={'class':['title']}) + ] + + feeds = [ + (u'Feeds', u'http://feeds.feedburner.com/Avantaje') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/onemagazine.recipe b/resources/recipes/onemagazine.recipe new file mode 100644 index 0000000000..73dd50141a --- /dev/null +++ b/resources/recipes/onemagazine.recipe @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +onemagazine.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Onemagazine(BasicNewsRecipe): + title = u'The ONE' + __author__ = u'Silviu Cotoar\u0103' + description = u'Be the ONE, not anyone ..' + publisher = u'The ONE' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,Femei' + encoding = 'utf-8' + cover_url = 'http://www.onemagazine.ro/images/logo_rss.jpg' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'class':'article'}) + , dict(name='div', attrs={'class':'gallery clearfix'}) + , dict(name='div', attrs={'align':'justify'}) + ] + + remove_tags = [ + dict(name='p', attrs={'class':['info']}) + , dict(name='table', attrs={'class':['connect_widget_interactive_area']}) + , dict(name='span', attrs={'class':['photo']}) + , dict(name='div', attrs={'class':['counter']}) + , dict(name='div', attrs={'class':['carousel']}) + , dict(name='div', attrs={'class':['jcarousel-container jcarousel-container-horizontal']}) + ] + + remove_tags_after = [ + dict(name='table', attrs={'class':['connect_widget_interactive_area']}) + ] + + feeds = [ + (u'Feeds', u'http://www.onemagazine.ro/rss') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/pcworldro.recipe b/resources/recipes/pcworldro.recipe new file mode 100644 index 0000000000..89ddbaf21d --- /dev/null +++ b/resources/recipes/pcworldro.recipe @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +pcworld.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Pcworld(BasicNewsRecipe): + title = u'PC World' + __author__ = u'Silviu Cotoar\u0103' + description = u'IT' + publisher = u'PC World' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Stiri,IT' + encoding = 'utf-8' + cover_url = 'http://www.pcworld.ro/img/ui/header-logo.gif' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'id':'content_page'}) + , dict(name='div', attrs={'class':'box_center content_body'}) + ] + + remove_tags = [ + dict(name='h3', attrs={'class':['breadcrumb']}) + , dict(name='div', attrs={'class':['box_center voteaza']}) + ] + + remove_tags_after = [ + dict(name='div', attrs={'class':['box_center voteaza']}) + ] + + feeds = [ + (u'Feeds', u'http://www.pcworld.ro/contents/pcworld.rss') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/protvmagazin.recipe b/resources/recipes/protvmagazin.recipe new file mode 100644 index 0000000000..fbdb7465fc --- /dev/null +++ b/resources/recipes/protvmagazin.recipe @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +protvmagazin.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Protvmagazin(BasicNewsRecipe): + title = u'ProTv Magazin' + __author__ = u'Silviu Cotoar\u0103' + description = u'Ghid TV' + publisher = u'ProTv Magazin' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,TV' + encoding = 'utf-8' + cover_url = 'http://www.protvmagazin.ro/images/logo.png' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'class':'box gradient'}) + ] + + remove_tags = [ + dict(name='p', attrs={'class':['title']}) + , dict(name='div', attrs={'id':['online_only']}) + , dict(name='div', attrs={'class':['show_article_rating']}) + , dict(name='ul', attrs={'class':['breadcrumbs']}) + , dict(name='p', attrs={'class':['tags']}) + ] + + remove_tags_after = [ + dict(name='table', attrs={'class':['connect_widget_interactive_area']}) + , dict(name='p', attrs={'class':['tags']}) + , dict(name='dev', attrs={'class':['connect_widget_sample_connections clearfix']}) + ] + + feeds = [ + (u'Feeds', u'http://www.protvmagazin.ro/rss/articole-noi') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/psychologies.recipe b/resources/recipes/psychologies.recipe new file mode 100644 index 0000000000..1b69a2ed9e --- /dev/null +++ b/resources/recipes/psychologies.recipe @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +psychologies.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Psychologies(BasicNewsRecipe): + title = u'Psychologies' + __author__ = u'Silviu Cotoar\u0103' + description = u'Psihologie \u015fi Dezvoltare Personal\u0103..' + publisher = u'Psychologies' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,Psihologie' + encoding = 'utf-8' + cover_url = 'http://www.psychologies.ro/images/default/logo.gif' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'class':'nav'}) + , dict(name='div', attrs={'id':'textarticol'}) + + ] + + feeds = [ + (u'Feeds', u'http://feeds.feedburner.com/Psychologies') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/thai_post_daily.recipe b/resources/recipes/thai_post_daily.recipe index 2be17cc37f..4523a9331a 100644 --- a/resources/recipes/thai_post_daily.recipe +++ b/resources/recipes/thai_post_daily.recipe @@ -3,6 +3,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1299054026(BasicNewsRecipe): title = u'Thai Post Daily' __author__ = 'Chotechai P.' + language = 'th' oldest_article = 7 max_articles_per_feed = 100 cover_url = 'http://upload.wikimedia.org/wikipedia/th/1/10/ThaiPost_Logo.png' diff --git a/resources/recipes/tvmania.recipe b/resources/recipes/tvmania.recipe new file mode 100644 index 0000000000..a2d9fcc060 --- /dev/null +++ b/resources/recipes/tvmania.recipe @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +tvmania.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Tvmania(BasicNewsRecipe): + title = u'TVmania' + __author__ = u'Silviu Cotoar\u0103' + description = u'Programe TV' + publisher = u'TVmania' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,TV' + encoding = 'utf-8' + cover_url = 'http://www.tvmania.ro/wp-content/themes/tvmania/images/logo.png' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'class':'articol'}) + , dict(name='font', attrs={'class':'mic'}) + , dict(name='div', attrs={'id':'header_recomandari'}) + , dict(name='div', attrs={'class':'main-image'}) + , dict(name='div', attrs={'id':'articol_recomandare'}) + + ] + + remove_tags = [ + dict(name='div', attrs={'class':['iLikeThis']}) + , dict(name='span', attrs={'class':['tag-links']}) + ] + + remove_tags_after = [ + dict(name='div', attrs={'class':['iLikeThis']}) + , dict(name='span', attrs={'class':['tag-links']}) + ] + + feeds = [ + (u'Feeds', u'http://www.tvmania.ro/feed') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/recipes/viva.recipe b/resources/recipes/viva.recipe new file mode 100644 index 0000000000..df697ea298 --- /dev/null +++ b/resources/recipes/viva.recipe @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2011, Silviu Cotoar\u0103' +''' +viva.ro +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Viva(BasicNewsRecipe): + title = u'Viva' + __author__ = u'Silviu Cotoar\u0103' + description = u'Vedete si evenimente' + publisher = u'Viva' + oldest_article = 25 + language = 'ro' + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + category = 'Ziare,Reviste,Femei' + encoding = 'utf-8' + cover_url = 'http://www.viva.ro/images/default/viva.gif' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} + .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} + .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} + .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + + keep_only_tags = [ + dict(name='div', attrs={'class':'articol'}) + , dict(name='div', attrs={'class':'gallery clearfix'}) + , dict(name='div', attrs={'align':'justify'}) + ] + + remove_tags = [ + dict(name='div', attrs={'class':['breadcrumbs']}) + , dict(name='div', attrs={'class':['links clearfix']}) + , dict(name='a', attrs={'id':['img_arrow_right']}) + , dict(name='img', attrs={'id':['zoom']}) + , dict(name='div', attrs={'class':['foto_counter']}) + , dict(name='div', attrs={'class':['gal_select clearfix']}) + ] + + remove_tags_after = [ + dict(name='div', attrs={'class':['links clearfix']}) + ] + + feeds = [ + (u'Vedete', u'http://feeds.feedburner.com/viva-Vedete') + ,(u'Evenimente', u'http://feeds.feedburner.com/viva-Evenimente') + ,(u'Frumusete', u'http://feeds.feedburner.com/viva-Beauty-Fashion') + ,(u'Noutati', u'http://feeds.feedburner.com/viva-Noutati') + ] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/resources/template-functions.json b/resources/template-functions.json index fe4379d701..c19627c6c7 100644 --- a/resources/template-functions.json +++ b/resources/template-functions.json @@ -16,6 +16,7 @@ "template": "def evaluate(self, formatter, kwargs, mi, locals, template):\n template = template.replace('[[', '{').replace(']]', '}')\n return formatter.__class__().safe_format(template, kwargs, 'TEMPLATE', mi)\n", "print": "def evaluate(self, formatter, kwargs, mi, locals, *args):\n print args\n return None\n", "titlecase": "def evaluate(self, formatter, kwargs, mi, locals, val):\n return titlecase(val)\n", + "subitems": "def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index):\n if not val:\n return ''\n si = int(start_index)\n ei = int(end_index)\n items = [v.strip() for v in val.split(',')]\n rv = set()\n for item in items:\n component = item.split('.')\n try:\n if ei == 0:\n rv.add('.'.join(component[si:]))\n else:\n rv.add('.'.join(component[si:ei]))\n except:\n pass\n return ', '.join(sorted(rv, key=sort_key))\n", "sublist": "def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):\n if not val:\n return ''\n si = int(start_index)\n ei = int(end_index)\n val = val.split(sep)\n try:\n if ei == 0:\n return sep.join(val[si:])\n else:\n return sep.join(val[si:ei])\n except:\n return ''\n", "test": "def evaluate(self, formatter, kwargs, mi, locals, val, value_if_set, value_not_set):\n if val:\n return value_if_set\n else:\n return value_not_set\n", "eval": "def evaluate(self, formatter, kwargs, mi, locals, template):\n from formatter import eval_formatter\n template = template.replace('[[', '{').replace(']]', '}')\n return eval_formatter.safe_format(template, locals, 'EVAL', None)\n",