From 3706c371fb3c0e6e0ac6ca0c56dab38c82ba01d9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2010 01:48:16 -0600 Subject: [PATCH 1/3] Allow book_on_device to be called before set_books_in_library --- src/calibre/gui2/device.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index e002fe916b..46259deb04 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -1325,6 +1325,9 @@ class DeviceMixin(object): # {{{ self.book_db_uuid_path_map = None return + if not hasattr(self, 'db_book_uuid_cache'): + return loc + string_pat = re.compile('(?u)\W|[_]') def clean_string(x): x = x.lower() if x else '' From 74a63ac46fd78882c955027a415e9c993da34189 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2010 01:57:25 -0600 Subject: [PATCH 2/3] Fix #6755 (Time Magazine does not work) --- src/calibre/ebooks/metadata/opf2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index f93b614ef2..2d9de7f780 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -1105,7 +1105,8 @@ class OPFCreator(MetaInformation): spine.set('toc', 'ncx') if self.spine is not None: for ref in self.spine: - spine.append(E.itemref(idref=ref.id)) + if ref.id is not None: + spine.append(E.itemref(idref=ref.id)) guide = E.guide() if self.guide is not None: for ref in self.guide: From e8f6b4e659af300beb8c36b75c75227f42a10fba Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2010 09:01:29 -0600 Subject: [PATCH 3/3] ... --- resources/recipes/taz.recipe | 71 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/resources/recipes/taz.recipe b/resources/recipes/taz.recipe index 530fa7d6b7..45b414f3cd 100644 --- a/resources/recipes/taz.recipe +++ b/resources/recipes/taz.recipe @@ -13,50 +13,51 @@ from calibre.web.feeds.news import BasicNewsRecipe class TazDigiabo(BasicNewsRecipe): - title = u'Taz Digiabo' - description = u'Das EPUB DigiAbo der Taz' - language = 'de' - lang = 'de-DE' + title = u'Taz Digiabo' + description = u'Das EPUB DigiAbo der Taz' + language = 'de' + lang = 'de-DE' - __author__ = 'Lars Jacob' - needs_subscription = True + __author__ = 'Lars Jacob' + needs_subscription = True - conversion_options = { - 'no_default_epub_cover' : True - } + conversion_options = { + 'no_default_epub_cover' : True + } - def build_index(self): - if self.username is not None and self.password is not None: - domain = "http://www.taz.de" + def build_index(self): + if self.username is not None and self.password is not None: + domain = "http://www.taz.de" - url = domain + "/epub/" + url = domain + "/epub/" - auth_handler = urllib2.HTTPBasicAuthHandler() - auth_handler.add_password(realm='TAZ-ABO', - uri=url, - user=self.username, - passwd=self.password) - opener = urllib2.build_opener(auth_handler) - urllib2.install_opener(opener) + auth_handler = urllib2.HTTPBasicAuthHandler() + auth_handler.add_password(realm='TAZ-ABO', + uri=url, + user=self.username, + passwd=self.password) + opener = urllib2.build_opener(auth_handler) + urllib2.install_opener(opener) - try: - f = urllib2.urlopen(url) - except urllib2.HTTPError: - self.report_progress(0,_('Can\'t login to download issue')) - return + try: + f = urllib2.urlopen(url) + except urllib2.HTTPError: + self.report_progress(0,_('Can\'t login to download issue')) + raise ValueError('Failed to login, check your username and' + ' password') - tmp = tempfile.TemporaryFile() - self.report_progress(0,_('downloading epub')) - tmp.write(f.read()) + tmp = tempfile.TemporaryFile() + self.report_progress(0,_('downloading epub')) + tmp.write(f.read()) - zfile = zipfile.ZipFile(tmp, 'r') - self.report_progress(0,_('extracting epub')) + zfile = zipfile.ZipFile(tmp, 'r') + self.report_progress(0,_('extracting epub')) - zfile.extractall(self.output_dir) + zfile.extractall(self.output_dir) - tmp.close() - index = os.path.join(self.output_dir, 'content.opf') + tmp.close() + index = os.path.join(self.output_dir, 'content.opf') - self.report_progress(1,_('epub downloaded and extracted')) + self.report_progress(1,_('epub downloaded and extracted')) - return index + return index