From f4b885568343944d66950935df887f276eaa3b4f Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Sun, 19 Sep 2010 21:46:13 -0300 Subject: [PATCH 1/7] KOBO: Fix issue where books that are read were getting their status reset to Unread --- src/calibre/devices/kobo/driver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 762a05d193..1171b74f5c 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -443,9 +443,9 @@ class KOBO(USBMS): # Reset Im_Reading list in the database if oncard == 'carda': - query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ContentID like \'file:///mnt/sd/%\'' + query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ReadStatus = 1 and ContentID like \'file:///mnt/sd/%\'' elif oncard != 'carda' and oncard != 'cardb': - query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ContentID not like \'file:///mnt/sd/%\'' + query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ReadStatus = 1 and ContentID not like \'file:///mnt/sd/%\'' try: cursor.execute (query) From 0fa7eef131080297085c0f4224907e351fc8e7fb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Sep 2010 19:01:53 -0600 Subject: [PATCH 2/7] Tagesanzeiger by noxxx --- resources/recipes/tagesan.recipe | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 resources/recipes/tagesan.recipe diff --git a/resources/recipes/tagesan.recipe b/resources/recipes/tagesan.recipe new file mode 100644 index 0000000000..8514162598 --- /dev/null +++ b/resources/recipes/tagesan.recipe @@ -0,0 +1,45 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1284927619(BasicNewsRecipe): + title = u'Tagesanzeiger' + publisher = u'Tamedia AG' + oldest_article = 2 + __author__ = 'noxxx' + max_articles_per_feed = 100 + description = 'tagesanzeiger.ch: Nichts verpassen' + category = 'News, Politik, Nachrichten, Schweiz, Zürich' + language = 'de' + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + remove_tags = [ + dict(name='img') + ,dict(name='div',attrs={'class':['swissquote ad','boxNews','centerAD','contentTabs2','sbsLabel']}) + ,dict(name='div',attrs={'id':['colRightAd','singleRight','singleSmallRight','MailInfo','metaLine','sidebarSky','contentFooter','commentInfo','commentInfo2','commentInfo3','footerBottom','clear','boxExclusiv','singleLogo','navSearch','headerLogin','headerBottomRight','horizontalNavigation','subnavigation','googleAdSense','footerAd','contentbox','articleGalleryNav']}) + ,dict(name='form',attrs={'id':['articleMailForm','commentform']}) + ,dict(name='div',attrs={'style':['position:absolute']}) + ,dict(name='script',attrs={'type':['text/javascript']}) + ,dict(name='p',attrs={'class':['schreiben','smallPrint','charCounter','caption']}) + ] + feeds = [ + (u'Front', u'http://www.tagesanzeiger.ch/rss.html') + ,(u'Zürich', u'http://www.tagesanzeiger.ch/zuerich/rss.html') + ,(u'Schweiz', u'http://www.tagesanzeiger.ch/schweiz/rss.html') + ,(u'Ausland', u'http://www.tagesanzeiger.ch/ausland/rss.html') + ,(u'Digital', u'http://www.tagesanzeiger.ch/digital/rss.html') + ,(u'Wissen', u'http://www.tagesanzeiger.ch/wissen/rss.html') + ,(u'Panorama', u'http://www.tagesanzeiger.ch/panorama/rss.html') + ,(u'Wirtschaft', u'http://www.tagesanzeiger.ch/wirtschaft/rss.html') + ,(u'Sport', u'http://www.tagesanzeiger.ch/sport/rss.html') + ,(u'Kultur', u'http://www.tagesanzeiger.ch/kultur/rss.html') + ,(u'Leben', u'http://www.tagesanzeiger.ch/leben/rss.html') + ,(u'Auto', u'http://www.tagesanzeiger.ch/auto/rss.html')] + + def print_version(self, url): + return url + '/print.html' + From 77da36f05c3e09654650133671c1d7f904d8a7d0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Sep 2010 23:51:14 -0600 Subject: [PATCH 3/7] Add prologue and epilogue to default chapter detection regex --- src/calibre/ebooks/conversion/plumber.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 3ea2926461..395447edba 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -241,7 +241,7 @@ OptionRecommendation(name='toc_filter', OptionRecommendation(name='chapter', recommended_value="//*[((name()='h1' or name()='h2') and " - r"re:test(., 'chapter|book|section|part\s+', 'i')) or @class " + r"re:test(., 'chapter|book|section|part|prologue|epilogue\s+', 'i')) or @class " "= 'chapter']", level=OptionRecommendation.LOW, help=_('An XPath expression to detect chapter titles. The default ' 'is to consider

or

tags that contain the words ' From 656c88792ddeb760cf7ed562ad54bce81d17f77e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Sep 2010 08:29:25 -0600 Subject: [PATCH 4/7] The Marker by Marbs --- resources/recipes/the_marker.recipe | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 resources/recipes/the_marker.recipe diff --git a/resources/recipes/the_marker.recipe b/resources/recipes/the_marker.recipe new file mode 100644 index 0000000000..e5f1ffc761 --- /dev/null +++ b/resources/recipes/the_marker.recipe @@ -0,0 +1,52 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1283848012(BasicNewsRecipe): + description = 'TheMarker Financial News in Hebrew' + __author__ = 'TonyTheBookworm, Marbs' + cover_url = 'http://static.ispot.co.il/wp-content/upload/2009/09/themarker.jpg' + title = u'TheMarker' + language = 'he' + simultaneous_downloads = 5 + remove_javascript = True + timefmt = '[%a, %d %b, %Y]' + oldest_article = 1 + remove_tags = [dict(name='tr', attrs={'bgcolor':['#738A94']}) ] + max_articles_per_feed = 10 + extra_css='body{direction: rtl;} .article_description{direction: rtl; } a.article{direction: rtl; } .calibre_feed_description{direction: rtl; }' + feeds = [(u'Head Lines', u'http://www.themarker.com/tmc/content/xml/rss/hpfeed.xml'), + (u'TA Market', u'http://www.themarker.com/tmc/content/xml/rss/sections/marketfeed.xml'), + (u'Real Estate', u'http://www.themarker.com/tmc/content/xml/rss/sections/realEstaterfeed.xml'), + (u'Wall Street & Global', u'http://www.themarker.com/tmc/content/xml/rss/sections/wallsfeed.xml'), + (u'Law', u'http://www.themarker.com/tmc/content/xml/rss/sections/lawfeed.xml'), + (u'Media', u'http://www.themarker.com/tmc/content/xml/rss/sections/mediafeed.xml'), + (u'Consumer', u'http://www.themarker.com/tmc/content/xml/rss/sections/consumerfeed.xml'), + (u'Career', u'http://www.themarker.com/tmc/content/xml/rss/sections/careerfeed.xml'), + (u'Car', u'http://www.themarker.com/tmc/content/xml/rss/sections/carfeed.xml'), + (u'High Tech', u'http://www.themarker.com/tmc/content/xml/rss/sections/hightechfeed.xml'), + (u'Investor Guide', u'http://www.themarker.com/tmc/content/xml/rss/sections/investorGuidefeed.xml')] + + def print_version(self, url): + split1 = url.split("=") + weblinks = url + + if weblinks is not None: + for link in weblinks: + #--------------------------------------------------------- + #here we need some help with some regexpressions + #we are trying to find it.themarker.com in a url + #----------------------------------------------------------- + re1='.*?' # Non-greedy match on filler + re2='(it\\.themarker\\.com)' # Fully Qualified Domain Name 1 + rg = re.compile(re1+re2,re.IGNORECASE|re.DOTALL) + m = rg.search(url) + + + if m: + split2 = url.split("article/") + print_url = 'http://it.themarker.com/tmit/PrintArticle/' + split2[1] + + else: + print_url = 'http://www.themarker.com/ibo/misc/printFriendly.jhtml?ElementId=%2Fibo%2Frepositories%2Fstories%2Fm1_2000%2F' + split1[1]+'.xml' + + return print_url From bc82ea61032bf7f1d2564674f0a7174df4b3dab4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Sep 2010 09:28:39 -0600 Subject: [PATCH 5/7] Add button to Edit metadata dialog to trim borders from the cover --- imgsrc/trim.svg | 688 ++++++++++++++++++++ resources/images/trim.png | Bin 0 -> 2553 bytes src/calibre/gui2/dialogs/metadata_single.py | 19 + src/calibre/gui2/dialogs/metadata_single.ui | 11 + 4 files changed, 718 insertions(+) create mode 100644 imgsrc/trim.svg create mode 100644 resources/images/trim.png diff --git a/imgsrc/trim.svg b/imgsrc/trim.svg new file mode 100644 index 0000000000..8c8810fc66 --- /dev/null +++ b/imgsrc/trim.svg @@ -0,0 +1,688 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Oxygen team + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/trim.png b/resources/images/trim.png new file mode 100644 index 0000000000000000000000000000000000000000..3cb93adfa670c8353a95b6d2b5d49180db4340e6 GIT binary patch literal 2553 zcmb_eXH=8f7X1>CCSYt7Nr+;oj(|K=q=q(B0Y#*@V1SWcLQeq!L8$@;a44f9#W4hd zpoBUgp$#Y?5HeCknk0Y(5CoDJ-;ek2{d?=2bN5;Mu6x&B=iVPX-Ok2LOyrCR003eZ z<|a3JNcdSo0=%_L-+O=u0w^mp6M*|O%3CY*06>^zVPbeI=66=fa5mKJG_Bp?Bdbob z*2gUC??=YJaeuyFH=GB@e2PJ_URZ&tnNHhM|}EKJukhn?Dch^V{$IP&d3- zWIQ|%hwdCkm9Ii$Wx3Tr%;9O|gSonMvlHtV+w9%tbU3wo(QuR|$D~82EUpvubo|9_zz0xPq_uz>tenN)M`fv>1`N2@!%}qO z;Rl`i`1p0MPF*UPfHd@+xkjBRE!nd56#bs2DSEsYGJU8R)sQF$Bq9#GE-1$L_)CF% zrCPWvbXZX8b_Jpp`>j*T-441|En8{QFNQ;pf+@_bU2vP`y{H#{y4*dw9s`bFV5i}P92?@7waB&GC z|4bRZK6;XXyT#0o74~&UrI}AIDIVYUkA%vINO&vCA-H0wOO$|ngq%r`oYC`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S5jV_yUWrC?{slvX^Hx7E7p;DX4dTlzS zX1|}7h9RIU?#ekyAY%W_IQ0*@-$TaHee>m1!uxBy7dEB0T!+!>#mPnumtHyxI$f&4 z>EEsx)bIyEfy+g-Zv*_RK!kb#cv+=OyW@-<<^?tB9)@rkhsF;5IU4$`)Kg!nNIlGvAgP^GD z@e48Af5d<1#LrSsqP{D@fL`o@olyw5tI@*pDcoTD1B}689I7?>h#dhElQ{I9i5*6L z9&S6utIWI$k|;ViPD8oMD1jm7BL;6qX0Ez)L6AMOw%@NbHA;^YA8kde;wZMM<(VMq zd&k-)r^bI3W&O1rQnL45zvu%zHK(IJt2R*Pga{<(uVu+A2C!{gq{wX7v&yE%ToE82 zaX6B~Wm)AOtin&=u^VGmocC=JE1kI4{~Q%QIDgRRV4U}E=B$>=hGRqgbvIS=ur=g2 zHx(6#7)_O!mloF-4v{JDSDvCALuIh0td}%%B~DVK=;)ABGwO&+W?gRUoroy<`Bw_t zFc$4s2?`#1pWYXJ&h^Fhq^|kB;GDhDv;3;n9(u&p*(tVI2-zj?`YnsXxs#3wY?(f4oA4 zN=xL%%dygpcW>8A46rH?;61#1t9z~tUf0@uxV9iuU9Kd + + + + Remove border (if any) from cover + + + + :/images/trim.png:/images/trim.png + + + From 231aab95614acf5ab738ee4a949b52d312a28383 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Sep 2010 09:37:15 -0600 Subject: [PATCH 6/7] WSJ: Don't error out if a single section fails --- resources/recipes/wsj_free.recipe | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/recipes/wsj_free.recipe b/resources/recipes/wsj_free.recipe index 7f3664f1c4..df8234e8e2 100644 --- a/resources/recipes/wsj_free.recipe +++ b/resources/recipes/wsj_free.recipe @@ -54,10 +54,13 @@ class WallStreetJournal(BasicNewsRecipe): def wsj_add_feed(self,feeds,title,url): self.log('Found section:', title) - if url.endswith('whatsnews'): - articles = self.wsj_find_wn_articles(url) - else: - articles = self.wsj_find_articles(url) + try: + if url.endswith('whatsnews'): + articles = self.wsj_find_wn_articles(url) + else: + articles = self.wsj_find_articles(url) + except: + articles = [] if articles: feeds.append((title, articles)) return feeds From 8bd686628966bb3f8948377d8be7b4cadd78b433 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Sep 2010 09:40:47 -0600 Subject: [PATCH 7/7] ... --- resources/recipes/wsj.recipe | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/recipes/wsj.recipe b/resources/recipes/wsj.recipe index fd5e977d10..88e07bcea3 100644 --- a/resources/recipes/wsj.recipe +++ b/resources/recipes/wsj.recipe @@ -70,13 +70,16 @@ class WallStreetJournal(BasicNewsRecipe): def wsj_add_feed(self,feeds,title,url): self.log('Found section:', title) - if url.endswith('whatsnews'): - articles = self.wsj_find_wn_articles(url) - else: - articles = self.wsj_find_articles(url) + try: + if url.endswith('whatsnews'): + articles = self.wsj_find_wn_articles(url) + else: + articles = self.wsj_find_articles(url) + except: + articles = [] if articles: feeds.append((title, articles)) - return feeds + return feeds def parse_index(self): soup = self.wsj_get_index() @@ -99,7 +102,7 @@ class WallStreetJournal(BasicNewsRecipe): url = 'http://online.wsj.com' + a['href'] feeds = self.wsj_add_feed(feeds,title,url) title = 'What''s News' - url = url.replace('pageone','whatsnews') + url = url.replace('pageone','whatsnews') feeds = self.wsj_add_feed(feeds,title,url) else: title = self.tag_to_string(a) @@ -141,7 +144,7 @@ class WallStreetJournal(BasicNewsRecipe): articles = [] flavorarea = soup.find('div', attrs={'class':lambda x: x and 'ahed' in x}) - if flavorarea is not None: + if flavorarea is not None: flavorstory = flavorarea.find('a', href=lambda x: x and x.startswith('/article')) if flavorstory is not None: flavorstory['class'] = 'mjLinkItem'