From 7c9c84256c0f00034c270b54c292f0fe2b76eaae Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 11 Dec 2013 12:14:55 -0600 Subject: [PATCH] Graceful fail for 'k'HTML when no 'k'Url, bump min calibre version. --- calibre-plugin/__init__.py | 4 ++-- fanficdownloader/story.py | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index 07409e7d..cde4977b 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -42,8 +42,8 @@ class FanFictionDownLoaderBase(InterfaceActionBase): description = _('UI plugin to download FanFiction stories from various sites.') supported_platforms = ['windows', 'osx', 'linux'] author = 'Jim Miller' - version = (1, 8, 02) - minimum_calibre_version = (0, 8, 57) + version = (1, 8, 03) + minimum_calibre_version = (1, 13, 0) #: This field defines the GUI plugin class that contains all the code #: that actually does something. Its format is module_path:class_name diff --git a/fanficdownloader/story.py b/fanficdownloader/story.py index dfc0dc95..029502c6 100644 --- a/fanficdownloader/story.py +++ b/fanficdownloader/story.py @@ -389,9 +389,14 @@ class Story(Configurable): elif self.getMetadataRaw('series') != None: self.setMetadata('seriesHTML',self.getMetadataRaw('series')) + # logger.debug("make_linkhtml_entries:%s"%self.getConfig('make_linkhtml_entries')) for k in self.getConfigList('make_linkhtml_entries'): # Assuming list, because it has to be site specific and - # they are all lists. + # they are all lists. Bail if kUrl list not the same + # length. + # logger.debug("\nk:%s\nlist:%s\nlistURL:%s"%(k,self.getList(k),self.getList(k+'Url'))) + if len(self.getList(k+'Url')) != len(self.getList(k)): + continue htmllist=[] for i, v in enumerate(self.getList(k)): url = self.getList(k+'Url')[i] @@ -403,7 +408,7 @@ class Story(Configurable): url=removeAllEntities(url) v=removeAllEntities(v) - htmllist.append(linkhtml%('author',url,v)) + htmllist.append(linkhtml%(k,url,v)) join_string = self.getConfig("join_string_"+k+"HTML",u", ").replace('\s',' ') self.setMetadata(k+'HTML',join_string.join(htmllist))