From cadbff1290439a5c4994ea47a0a8aa0bdd58dae0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 12 Oct 2011 20:31:43 +0530 Subject: [PATCH 1/9] Fix #872875 (dilbert update) --- recipes/dilbert.recipe | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/dilbert.recipe b/recipes/dilbert.recipe index 56aa4af8c9..ed2771debf 100644 --- a/recipes/dilbert.recipe +++ b/recipes/dilbert.recipe @@ -2,6 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Darko Miletic ' ''' http://www.dilbert.com +DrMerry added cover Image 2011-11-12 ''' from calibre.web.feeds.recipes import BasicNewsRecipe @@ -9,7 +10,7 @@ import re class DilbertBig(BasicNewsRecipe): title = 'Dilbert' - __author__ = 'Darko Miletic and Starson17' + __author__ = 'Darko Miletic and Starson17 contribution of DrMerry' description = 'Dilbert' reverse_article_order = True oldest_article = 15 @@ -20,6 +21,7 @@ class DilbertBig(BasicNewsRecipe): publisher = 'UNITED FEATURE SYNDICATE, INC.' category = 'comic' language = 'en' + cover_url = 'http://dilbert.com/mobile/mobile/dilbert.app.icon.png' conversion_options = { 'comments' : description From 24ccb1a56277018fd531ec7303ba582cd3d92201 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 07:17:07 +0530 Subject: [PATCH 2/9] ... --- src/calibre/devices/interface.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/calibre/devices/interface.py b/src/calibre/devices/interface.py index ad21632a50..bed5a0b77c 100644 --- a/src/calibre/devices/interface.py +++ b/src/calibre/devices/interface.py @@ -464,6 +464,13 @@ class DevicePlugin(Plugin): ''' pass + def prepare_addable_books(self, paths): + ''' + Given a list of paths, returns another list of paths. These paths + point to addable versions of the books. + ''' + return paths + class BookList(list): ''' A list of books. Each Book object must have the fields @@ -518,9 +525,3 @@ class BookList(list): ''' raise NotImplementedError() - def prepare_addable_books(self, paths): - ''' - Given a list of paths, returns another list of paths. These paths - point to addable versions of the books. - ''' - return paths From b6fab126dc5dea7df86d458d0a5c47ac6971c183 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 07:36:30 +0530 Subject: [PATCH 3/9] Fix Gosc Niedzielny --- recipes/gosc_niedzielny.recipe | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/recipes/gosc_niedzielny.recipe b/recipes/gosc_niedzielny.recipe index 12942f0f8a..371eef3407 100644 --- a/recipes/gosc_niedzielny.recipe +++ b/recipes/gosc_niedzielny.recipe @@ -10,16 +10,17 @@ import re class GN(BasicNewsRecipe): EDITION = 0 - + __author__ = 'Piotr Kontek' - title = u'Gość niedzielny' + title = unicode('Gość niedzielny') description = 'Weekly magazine' encoding = 'utf-8' no_stylesheets = True language = 'pl' remove_javascript = True - temp_files = [] - + temp_files = [] + simultaneous_downloads = 1 + articles_are_obfuscated = True def get_obfuscated_article(self, url): @@ -27,9 +28,9 @@ class GN(BasicNewsRecipe): br.open(url) source = br.response().read() page = self.index_to_soup(source) - + main_section = page.find('div',attrs={'class':'txt doc_prnt_prv'}) - + title = main_section.find('h2') info = main_section.find('div', attrs={'class' : 'cf doc_info'}) authors = info.find(attrs={'class':'l'}) @@ -41,17 +42,17 @@ class GN(BasicNewsRecipe): article = article + str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/') article = article + '' for s in p.findAll('span'): - article = article + self.tag_to_string(s) + article = article + self.tag_to_string(s) article = article + '

' else: article = article + str(p).replace('src="/files/','src="http://www.gosc.pl/files/') first = False - + html = unicode(title) + unicode(authors) + unicode(article) - - self.temp_files.append(PersistentTemporaryFile('_temparse.html')) - self.temp_files[-1].write(html) - self.temp_files[-1].close() + + self.temp_files.append(PersistentTemporaryFile('_temparse.html')) + self.temp_files[-1].write(html) + self.temp_files[-1].close() return self.temp_files[-1].name def find_last_issue(self): @@ -68,7 +69,7 @@ class GN(BasicNewsRecipe): if not first: break first = False - + def parse_index(self): self.find_last_issue() soup = self.index_to_soup('http://www.gosc.pl' + self.EDITION) @@ -94,16 +95,16 @@ class GN(BasicNewsRecipe): def find_articles(self, main_block): for a in main_block.findAll('div', attrs={'class':'prev_doc2'}): - art = a.find('a') - yield { + art = a.find('a') + yield { 'title' : self.tag_to_string(art), 'url' : 'http://www.gosc.pl' + art['href'].replace('/doc/','/doc_pr/'), 'date' : '', 'description' : '' } for a in main_block.findAll('div', attrs={'class':'sr-document'}): - art = a.find('a') - yield { + art = a.find('a') + yield { 'title' : self.tag_to_string(art), 'url' : 'http://www.gosc.pl' + art['href'].replace('/doc/','/doc_pr/'), 'date' : '', From dff33cf99b7557257d9491fdb34272506600ef91 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 08:06:05 +0530 Subject: [PATCH 4/9] Fix #872945 (Geek and poke small update) --- recipes/geek_poke.recipe | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/recipes/geek_poke.recipe b/recipes/geek_poke.recipe index 7f5117b586..7a241db407 100644 --- a/recipes/geek_poke.recipe +++ b/recipes/geek_poke.recipe @@ -1,6 +1,6 @@ from calibre.web.feeds.news import BasicNewsRecipe import re -from calibre.utils.magick import Image +from calibre.utils.magick import Image, create_canvas class AdvancedUserRecipe1307556816(BasicNewsRecipe): title = u'Geek and Poke' @@ -11,7 +11,7 @@ class AdvancedUserRecipe1307556816(BasicNewsRecipe): oldest_article = 31 max_articles_per_feed = 100 language = u'en' - simultaneous_downloads = 5 + simultaneous_downloads = 1 #delay = 1 timefmt = ' [%a, %d %B, %Y]' summary_length = -1 @@ -22,6 +22,7 @@ class AdvancedUserRecipe1307556816(BasicNewsRecipe): remove_javascript = True remove_empty_feeds = True publication_type = 'blog' + masthead_url = None conversion_options = { 'comments' : '' ,'tags' : category @@ -44,28 +45,38 @@ class AdvancedUserRecipe1307556816(BasicNewsRecipe): (r'yimg\.com'), (r'scorecardresearch\.com')] - preprocess_regexps = [(re.compile(r'(

( |\s)*

|]*>Tweet|]*>|)', re.DOTALL|re.IGNORECASE),lambda match: ''), + preprocess_regexps = [(re.compile(r'(

( |\s)*

|]*>Tweet|]*>|||]*>[^<]*[^<]*)', re.DOTALL|re.IGNORECASE),lambda match: ''), (re.compile(r'( |\s\s)+\s*', re.DOTALL|re.IGNORECASE),lambda match: ' '), - (re.compile(r']*>([^<]*)[^>]*(]*>)', re.DOTALL|re.IGNORECASE), lambda match: match.group(2) + '
' + match.group(1) + '
'), (re.compile(r'(]*>)]>((?!', re.DOTALL|re.IGNORECASE),lambda match: match.group(1) + match.group(2) + ''), - (re.compile(r'(]*alt="([^"]*)"[^>]*>)', re.DOTALL|re.IGNORECASE),lambda match: match.group(1) + '
' + match.group(2) + ''), + (re.compile(r'(]*alt="([^"]*)"[^>]*>)', re.DOTALL|re.IGNORECASE),lambda match: '
' + match.group(2) + '
' + match.group(1) + '
'), (re.compile(r'()+', re.DOTALL|re.IGNORECASE),lambda match: '
'), - (re.compile(r'', re.DOTALL), lambda m: '') ] - extra_css = 'body, h3, p, #MERRYdate, h1, div, span{margin:0px; padding:0px} h3.entry-header{font-size: 0.8em} div.entry-body{font-size: 0.7em} #MERRYdate {font-size: 0.5em}' + extra_css = 'body, h3, p, div, span{margin:0px; padding:0px} h3.entry-header{font-size: 0.8em} div.entry-body{font-size: 0.7em}' def postprocess_html(self, soup, first): for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] img = Image() img.open(iurl) - width, height = img.size - #print 'img is: ', iurl, 'width is: ', width, 'height is: ', height + #width, height = img.size + #print '***img is: ', iurl, '\n****width is: ', width, 'height is: ', height img.trim(0) - img.save(iurl) + #width, height = img.size + #print '***TRIMMED img width is: ', width, 'height is: ', height + left=0 + top=0 + border_color='#ffffff' width, height = img.size - #print 'img is: ', iurl, 'width is: ', width, 'height is: ', height + #print '***retrieved img width is: ', width, 'height is: ', height + height_correction = 1.17 + canvas = create_canvas(width, height*height_correction,border_color) + canvas.compose(img, left, top) + #img = canvas + #img.save(iurl) + canvas.save(iurl) + #width, height = canvas.size + #print '***NEW img width is: ', width, 'height is: ', height return soup feeds = ['http://feeds.feedburner.com/GeekAndPoke?format=xml'] From e802938b5e96ef7845ce232a77a99aa5ed2b05ff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 09:00:04 +0530 Subject: [PATCH 5/9] ... --- recipes/gosc_niedzielny.recipe | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/recipes/gosc_niedzielny.recipe b/recipes/gosc_niedzielny.recipe index 371eef3407..1538e7fc2c 100644 --- a/recipes/gosc_niedzielny.recipe +++ b/recipes/gosc_niedzielny.recipe @@ -10,17 +10,17 @@ import re class GN(BasicNewsRecipe): EDITION = 0 - + __author__ = 'Piotr Kontek' - title = unicode('Gość niedzielny') + title = u'Gość niedzielny' description = 'Weekly magazine' encoding = 'utf-8' no_stylesheets = True language = 'pl' remove_javascript = True - temp_files = [] + temp_files = [] simultaneous_downloads = 1 - + articles_are_obfuscated = True def get_obfuscated_article(self, url): @@ -28,9 +28,9 @@ class GN(BasicNewsRecipe): br.open(url) source = br.response().read() page = self.index_to_soup(source) - + main_section = page.find('div',attrs={'class':'txt doc_prnt_prv'}) - + title = main_section.find('h2') info = main_section.find('div', attrs={'class' : 'cf doc_info'}) authors = info.find(attrs={'class':'l'}) @@ -42,17 +42,17 @@ class GN(BasicNewsRecipe): article = article + str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/') article = article + '' for s in p.findAll('span'): - article = article + self.tag_to_string(s) + article = article + self.tag_to_string(s) article = article + '

' else: article = article + str(p).replace('src="/files/','src="http://www.gosc.pl/files/') first = False - + html = unicode(title) + unicode(authors) + unicode(article) - - self.temp_files.append(PersistentTemporaryFile('_temparse.html')) - self.temp_files[-1].write(html) - self.temp_files[-1].close() + + self.temp_files.append(PersistentTemporaryFile('_temparse.html')) + self.temp_files[-1].write(html) + self.temp_files[-1].close() return self.temp_files[-1].name def find_last_issue(self): @@ -69,7 +69,7 @@ class GN(BasicNewsRecipe): if not first: break first = False - + def parse_index(self): self.find_last_issue() soup = self.index_to_soup('http://www.gosc.pl' + self.EDITION) From af087b2554c8edc75307d9a55363bd0005585242 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 09:15:20 +0530 Subject: [PATCH 6/9] Fix #872961 (calibredb add_format does not refresh running calibre instance) --- src/calibre/library/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index 65752eb183..b79813aee8 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -368,6 +368,7 @@ def command_remove(args, dbpath): def do_add_format(db, id, fmt, path): db.add_format_with_hooks(id, fmt.upper(), path, index_is_id=True) + send_message() def add_format_option_parser(): return get_parser(_( From 12c8b70336d145e70d2ee8415bfa236e5bf29a0f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 09:37:45 +0530 Subject: [PATCH 7/9] Fix #872741 (Onyx BOOX A61S/X61S not detected) --- resources/images/devices/boox.jpg | Bin 0 -> 3115 bytes src/calibre/devices/hanlin/driver.py | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 resources/images/devices/boox.jpg diff --git a/resources/images/devices/boox.jpg b/resources/images/devices/boox.jpg new file mode 100644 index 0000000000000000000000000000000000000000..93e5c70fa15a481e2c5f9b31417948380c481059 GIT binary patch literal 3115 zcmbW2c{r5)8pnS#gRu*vs9|iqB#N zRI-$;+1HrYHe?y|obmRabFS%M;X^Zf4TzOK*rd4Bf|^+BUx&v9cjV*rD} zfFtt)&=`1b6y)v-fSH*bUtH{B7owlIp*z9d-^o+ljOavgzd`_5MI|LIB}FYIC2_2hmNHfg zs{#-pF$oS>m~X0KRRKKbS2c6yJ>u^;XtylWph18G>}+gEHdb~d63M~A&dH79;pXDv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ycBSsITB1( zRZHmef{mXjqf~{|>kiV6Q7zWzZCTdovtZFK?9&R)@0rJ&D^)Cm=VlTku1XE{I@COz zA?N%3RJ*tN)5hv$yd4HB!l(DWF^5mPq+3vd)fMp&kRJbncZ2qZ;=qHq-bg#-hC}0xaj5i?|uF0f8uv+s4Qwr z1V34s`D=stN2?4q6GNa4zfdSl=JbnSzRvimcuj&yafb(M% zGGgi-mdkaS15$T>SAw;VFhS>0$H~miz~(Px`fnlRb_ggi8$ECASVQygVSL87jlV^0 zde3}#WbDoHnY|e25I-#7344m(Zg$I!K!rLlJtpSTXNHw;#mtQVj3VPuz4;NEm>O-2 zhincfVVraWy{EeULqa-;zs7rLorJ0tyx1YF{=zkRv0XAPU|pvBmMna1h~>W_?9EZn*@P(B6v=tjf4PxRMAf&Q?`04l}o`tjoBYp?u$qf;xqS G`u_nFxtP-c literal 0 HcmV?d00001 diff --git a/src/calibre/devices/hanlin/driver.py b/src/calibre/devices/hanlin/driver.py index 2234e2112c..b4c4f2872b 100644 --- a/src/calibre/devices/hanlin/driver.py +++ b/src/calibre/devices/hanlin/driver.py @@ -116,6 +116,7 @@ class BOOX(HANLINV3): supported_platforms = ['windows', 'osx', 'linux'] METADATA_CACHE = '.metadata.calibre' DRIVEINFO = '.driveinfo.calibre' + icon = I('devices/boox.jpg') # Ordered list of supported formats FORMATS = ['epub', 'fb2', 'djvu', 'pdf', 'html', 'txt', 'rtf', 'mobi', @@ -123,7 +124,7 @@ class BOOX(HANLINV3): VENDOR_ID = [0x0525] PRODUCT_ID = [0xa4a5] - BCD = [0x322] + BCD = [0x322, 0x323] MAIN_MEMORY_VOLUME_LABEL = 'BOOX Internal Memory' STORAGE_CARD_VOLUME_LABEL = 'BOOX Storage Card' From 68aa6195e03a84ee63b427cbbc0f09c080e1ee01 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 10:05:17 +0530 Subject: [PATCH 8/9] MOBI Input: Remove invalid tags of the form Fixes #872883 (fatal error in converting mobi to rtf) --- src/calibre/ebooks/mobi/reader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index 04637ffa89..e4b40616ba 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -325,6 +325,10 @@ class MobiReader(object): self.processed_html = self.processed_html.replace('<', self.processed_html) + # Remove tags of the form as they can cause issues further + # along the pipeline + self.processed_html = re.sub(r']*>', '', + self.processed_html) for pat in ENCODING_PATS: self.processed_html = pat.sub('', self.processed_html) From bb84fcfa84aac40d9362c538d8bc164def10ac13 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Oct 2011 10:09:18 +0530 Subject: [PATCH 9/9] Fix #829821 (Add HTC Flyer to Android driver) --- src/calibre/devices/android/driver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/android/driver.py b/src/calibre/devices/android/driver.py index eb867b80d3..f6b70794d4 100644 --- a/src/calibre/devices/android/driver.py +++ b/src/calibre/devices/android/driver.py @@ -62,7 +62,8 @@ class ANDROID(USBMS): 0x4e11 : [0x0100, 0x226, 0x227], 0x4e12 : [0x0100, 0x226, 0x227], 0x4e21 : [0x0100, 0x226, 0x227], - 0xb058 : [0x0222, 0x226, 0x227] + 0xb058 : [0x0222, 0x226, 0x227], + 0x0ff9 : [0x0226], }, # Samsung