From f81d89a76b091d6914e17575ab20d0d35db2a4b4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 8 Jul 2011 21:21:21 -0600 Subject: [PATCH 1/2] ... --- src/calibre/devices/kobo/driver.py | 4 +++- src/calibre/ebooks/htmlz/input.py | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index fd71eb57cc..682eac99ce 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -227,7 +227,9 @@ class KOBO(USBMS): try: cursor.execute (query) except Exception as e: - if '___ExpirationStatus' not in str(e): + err = str(e) + if not ('___ExpirationStatus' in err or 'FavouritesIndex' in err or + 'Accessibility' in err): raise query= ('select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ' 'ImageID, ReadStatus, "-1" as ___ExpirationStatus, "-1" as ' diff --git a/src/calibre/ebooks/htmlz/input.py b/src/calibre/ebooks/htmlz/input.py index 743d8e53eb..3cf95b8a48 100644 --- a/src/calibre/ebooks/htmlz/input.py +++ b/src/calibre/ebooks/htmlz/input.py @@ -20,7 +20,7 @@ class HTMLZInput(InputFormatPlugin): author = 'John Schember' description = 'Convert HTML files to HTML' file_types = set(['htmlz']) - + def convert(self, stream, options, file_ext, log, accelerators): self.log = log @@ -35,14 +35,14 @@ class HTMLZInput(InputFormatPlugin): with open(x, 'rb') as tf: html = tf.read() break - + # Encoding if options.input_encoding: ienc = options.input_encoding else: ienc = xml_to_unicode(html[:4096])[-1] html = html.decode(ienc, 'replace') - + # Run the HTML through the html processing plugin. from calibre.customize.ui import plugin_for_input_format html_input = plugin_for_input_format('html') @@ -71,7 +71,7 @@ class HTMLZInput(InputFormatPlugin): from calibre.ebooks.oeb.transforms.metadata import meta_info_to_oeb_metadata mi = get_file_type_metadata(stream, file_ext) meta_info_to_oeb_metadata(mi, oeb.metadata, log) - + # Get the cover path from the OPF. cover_path = None opf = None From e6da43ef74115c6c2e4e202801887c5ada602622 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 8 Jul 2011 22:26:03 -0600 Subject: [PATCH 2/2] IDG Now by Diniz Bortolotto --- recipes/idg_now.recipe | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 recipes/idg_now.recipe diff --git a/recipes/idg_now.recipe b/recipes/idg_now.recipe new file mode 100644 index 0000000000..232de99bce --- /dev/null +++ b/recipes/idg_now.recipe @@ -0,0 +1,43 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class IDGNow(BasicNewsRecipe): + title = 'IDG Now!' + __author__ = 'Diniz Bortolotto' + description = 'Posts do IDG Now!' + oldest_article = 7 + max_articles_per_feed = 20 + encoding = 'utf8' + publisher = 'Now!Digital Business Ltda.' + category = 'technology, telecom, IT, Brazil' + language = 'pt_BR' + publication_type = 'technology portal' + use_embedded_content = False + extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }' + + def get_article_url(self, article): + link = article.get('link', None) + if link is None: + return article + if link.split('/')[-1]=="story01.htm": + link=link.split('/')[-2] + a=['0B','0C','0D','0E','0F','0G','0I','0N' ,'0L0S','0A','0J3A'] + b=['.' ,'/' ,'?' ,'-' ,'=' ,'&' ,'_','.com','www.','0',':'] + for i in range(0,len(a)): + link=link.replace(a[i],b[i]) + link=link.split('&')[-3] + link=link.split('=')[1] + link=link + "/IDGNoticiaPrint_view" + return link + + feeds = [ + (u'Ultimas noticias', u'http://rss.idgnow.com.br/c/32184/f/499640/index.rss'), + (u'Computa\xe7\xe3o Corporativa', u'http://rss.idgnow.com.br/c/32184/f/499643/index.rss'), + (u'Carreira', u'http://rss.idgnow.com.br/c/32184/f/499644/index.rss'), + (u'Computa\xe7\xe3o Pessoal', u'http://rss.idgnow.com.br/c/32184/f/499645/index.rss'), + (u'Internet', u'http://rss.idgnow.com.br/c/32184/f/499646/index.rss'), + (u'Mercado', u'http://rss.idgnow.com.br/c/32184/f/419982/index.rss'), + (u'Seguran\xe7a', u'http://rss.idgnow.com.br/c/32184/f/499647/index.rss'), + (u'Telecom e Redes', u'http://rss.idgnow.com.br/c/32184/f/499648/index.rss') + ] + + reverse_article_order = True