From 2501e40e43c1e6fd0373bd97018236cc0f3979ec Mon Sep 17 00:00:00 2001 From: GRiker Date: Mon, 6 Sep 2010 12:04:46 -0700 Subject: [PATCH 1/4] GR changes supporting ondevice --- src/calibre/gui2/actions/catalog.py | 2 +- src/calibre/gui2/tools.py | 24 +- src/calibre/library/catalog.py | 659 ++++++++++++++-------------- src/calibre/library/cli.py | 9 +- 4 files changed, 357 insertions(+), 337 deletions(-) diff --git a/src/calibre/gui2/actions/catalog.py b/src/calibre/gui2/actions/catalog.py index 6feaec978d..d965c6d814 100644 --- a/src/calibre/gui2/actions/catalog.py +++ b/src/calibre/gui2/actions/catalog.py @@ -33,7 +33,7 @@ class GenerateCatalogAction(InterfaceAction): show=True) # Calling gui2.tools:generate_catalog() - ret = generate_catalog(self.gui, dbspec, ids, self.gui.device_manager.device) + ret = generate_catalog(self.gui, dbspec, ids, self.gui.device_manager) if ret is None: return diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index caef82ab81..7a516bb4ff 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -238,7 +238,7 @@ def fetch_scheduled_recipe(arg): return 'gui_convert', args, _('Fetch news from ')+arg['title'], fmt.upper(), [pt] -def generate_catalog(parent, dbspec, ids, device): +def generate_catalog(parent, dbspec, ids, device_manager): from calibre.gui2.dialogs.catalog import Catalog # Build the Catalog dialog in gui2.dialogs.catalog @@ -252,9 +252,18 @@ def generate_catalog(parent, dbspec, ids, device): # Profile the connected device # Parallel initialization in calibre.library.cli:command_catalog() - connected_device = { 'storage':None,'serial':None,'save_template':None,'name':None} + connected_device = { + 'is_device_connected': device_manager.is_device_connected, + 'kind': device_manager.connected_device_kind, + 'name': None, + 'save_template': None, + 'serial': None, + 'storage': None + } - if device: + if device_manager.is_device_connected: + device = device_manager.device + connected_device['name'] = device.gui_name try: storage = [] if device._main_prefix: @@ -263,11 +272,10 @@ def generate_catalog(parent, dbspec, ids, device): storage.append(os.path.join(device._card_a_prefix, device.EBOOK_DIR_CARD_A)) if device._card_b_prefix: storage.append(os.path.join(device._card_b_prefix, device.EBOOK_DIR_CARD_B)) - connected_device = { 'storage': storage, - 'serial': device.detected_device.serial if \ - hasattr(device.detected_device,'serial') else None, - 'save_template': device.save_template(), - 'name': device.gui_name} + connected_device['storage'] = storage + connected_device['serial'] = device.detected_device.serial if \ + hasattr(device.detected_device,'serial') else None + connected_device['save_template'] = device.save_template() except: pass diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 33279c30d8..4b5cb6bb84 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -67,6 +67,8 @@ class CSV_XML(CatalogPlugin): if opts.verbose: opts_dict = vars(opts) log("%s(): Generating %s" % (self.name,self.fmt)) + if opts.connected_device['is_device_connected']: + log(" connected_device: %s" % opts.connected_device['name']) if opts_dict['search_text']: log(" --search='%s'" % opts_dict['search_text']) @@ -81,7 +83,6 @@ class CSV_XML(CatalogPlugin): else: log(" Fields: %s" % opts_dict['fields']) - # If a list of ids are provided, don't use search_text if opts.ids: opts.search_text = None @@ -888,302 +889,302 @@ class EPUB_MOBI(CatalogPlugin): self.__totalSteps += 2 # Accessors - ''' - @dynamic_property - def xxxx(self): - def fget(self): - return self.__ - def fset(self, val): - self.__ = val - return property(fget=fget, fset=fset) - ''' + if True: + ''' + @dynamic_property + def xxxx(self): + def fget(self): + return self.__ + def fset(self, val): + self.__ = val + return property(fget=fget, fset=fset) + ''' + @dynamic_property + def authorClip(self): + def fget(self): + return self.__authorClip + def fset(self, val): + self.__authorClip = val + return property(fget=fget, fset=fset) + @dynamic_property + def authors(self): + def fget(self): + return self.__authors + def fset(self, val): + self.__authors = val + return property(fget=fget, fset=fset) + @dynamic_property + def basename(self): + def fget(self): + return self.__basename + def fset(self, val): + self.__basename = val + return property(fget=fget, fset=fset) + @dynamic_property + def bookmarked_books(self): + def fget(self): + return self.__bookmarked_books + def fset(self, val): + self.__bookmarked_books = val + return property(fget=fget, fset=fset) + @dynamic_property + def booksByAuthor(self): + def fget(self): + return self.__booksByAuthor + def fset(self, val): + self.__booksByAuthor = val + return property(fget=fget, fset=fset) + @dynamic_property + def booksByDateRead(self): + def fget(self): + return self.__booksByDateRead + def fset(self, val): + self.__booksByDateRead = val + return property(fget=fget, fset=fset) + @dynamic_property + def booksByTitle(self): + def fget(self): + return self.__booksByTitle + def fset(self, val): + self.__booksByTitle = val + return property(fget=fget, fset=fset) + @dynamic_property + def booksByTitle_noSeriesPrefix(self): + def fget(self): + return self.__booksByTitle_noSeriesPrefix + def fset(self, val): + self.__booksByTitle_noSeriesPrefix = val + return property(fget=fget, fset=fset) + @dynamic_property + def catalogPath(self): + def fget(self): + return self.__catalogPath + def fset(self, val): + self.__catalogPath = val + return property(fget=fget, fset=fset) + @dynamic_property + def contentDir(self): + def fget(self): + return self.__contentDir + def fset(self, val): + self.__contentDir = val + return property(fget=fget, fset=fset) + @dynamic_property + def currentStep(self): + def fget(self): + return self.__currentStep + def fset(self, val): + self.__currentStep = val + return property(fget=fget, fset=fset) + @dynamic_property + def creator(self): + def fget(self): + return self.__creator + def fset(self, val): + self.__creator = val + return property(fget=fget, fset=fset) + @dynamic_property + def db(self): + def fget(self): + return self.__db + return property(fget=fget) + @dynamic_property + def descriptionClip(self): + def fget(self): + return self.__descriptionClip + def fset(self, val): + self.__descriptionClip = val + return property(fget=fget, fset=fset) + @dynamic_property + def error(self): + def fget(self): + return self.__error + return property(fget=fget) + @dynamic_property + def generateForKindle(self): + def fget(self): + return self.__generateForKindle + def fset(self, val): + self.__generateForKindle = val + return property(fget=fget, fset=fset) + @dynamic_property + def generateRecentlyRead(self): + def fget(self): + return self.__generateRecentlyRead + def fset(self, val): + self.__generateRecentlyRead = val + return property(fget=fget, fset=fset) + @dynamic_property + def genres(self): + def fget(self): + return self.__genres + def fset(self, val): + self.__genres = val + return property(fget=fget, fset=fset) + @dynamic_property + def genre_tags_dict(self): + def fget(self): + return self.__genre_tags_dict + def fset(self, val): + self.__genre_tags_dict = val + return property(fget=fget, fset=fset) + @dynamic_property + def htmlFileList(self): + def fget(self): + return self.__htmlFileList + def fset(self, val): + self.__htmlFileList = val + return property(fget=fget, fset=fset) + @dynamic_property + def libraryPath(self): + def fget(self): + return self.__libraryPath + def fset(self, val): + self.__libraryPath = val + return property(fget=fget, fset=fset) + @dynamic_property + def markerTags(self): + def fget(self): + return self.__markerTags + def fset(self, val): + self.__markerTags = val + return property(fget=fget, fset=fset) + @dynamic_property + def ncxSoup(self): + def fget(self): + return self.__ncxSoup + def fset(self, val): + self.__ncxSoup = val + return property(fget=fget, fset=fset) + @dynamic_property + def opts(self): + def fget(self): + return self.__opts + return property(fget=fget) + @dynamic_property + def playOrder(self): + def fget(self): + return self.__playOrder + def fset(self,val): + self.__playOrder = val + return property(fget=fget, fset=fset) + @dynamic_property + def plugin(self): + def fget(self): + return self.__plugin + return property(fget=fget) + @dynamic_property + def progressInt(self): + def fget(self): + return self.__progressInt + def fset(self, val): + self.__progressInt = val + return property(fget=fget, fset=fset) + @dynamic_property + def progressString(self): + def fget(self): + return self.__progressString + def fset(self, val): + self.__progressString = val + return property(fget=fget, fset=fset) + @dynamic_property + def reporter(self): + def fget(self): + return self.__reporter + def fset(self, val): + self.__reporter = val + return property(fget=fget, fset=fset) + @dynamic_property + def stylesheet(self): + def fget(self): + return self.__stylesheet + def fset(self, val): + self.__stylesheet = val + return property(fget=fget, fset=fset) + @dynamic_property + def thumbs(self): + def fget(self): + return self.__thumbs + def fset(self, val): + self.__thumbs = val + return property(fget=fget, fset=fset) + def thumbWidth(self): + def fget(self): + return self.__thumbWidth + def fset(self, val): + self.__thumbWidth = val + return property(fget=fget, fset=fset) + def thumbHeight(self): + def fget(self): + return self.__thumbHeight + def fset(self, val): + self.__thumbHeight = val + return property(fget=fget, fset=fset) + @dynamic_property + def title(self): + def fget(self): + return self.__title + def fset(self, val): + self.__title = val + return property(fget=fget, fset=fset) + @dynamic_property + def totalSteps(self): + def fget(self): + return self.__totalSteps + return property(fget=fget) + @dynamic_property + def useSeriesPrefixInTitlesSection(self): + def fget(self): + return self.__useSeriesPrefixInTitlesSection + def fset(self, val): + self.__useSeriesPrefixInTitlesSection = val + return property(fget=fget, fset=fset) + @dynamic_property + def verbose(self): + def fget(self): + return self.__verbose + def fset(self, val): + self.__verbose = val + return property(fget=fget, fset=fset) - @dynamic_property - def authorClip(self): - def fget(self): - return self.__authorClip - def fset(self, val): - self.__authorClip = val - return property(fget=fget, fset=fset) - @dynamic_property - def authors(self): - def fget(self): - return self.__authors - def fset(self, val): - self.__authors = val - return property(fget=fget, fset=fset) - @dynamic_property - def basename(self): - def fget(self): - return self.__basename - def fset(self, val): - self.__basename = val - return property(fget=fget, fset=fset) - @dynamic_property - def bookmarked_books(self): - def fget(self): - return self.__bookmarked_books - def fset(self, val): - self.__bookmarked_books = val - return property(fget=fget, fset=fset) - @dynamic_property - def booksByAuthor(self): - def fget(self): - return self.__booksByAuthor - def fset(self, val): - self.__booksByAuthor = val - return property(fget=fget, fset=fset) - @dynamic_property - def booksByDateRead(self): - def fget(self): - return self.__booksByDateRead - def fset(self, val): - self.__booksByDateRead = val - return property(fget=fget, fset=fset) - @dynamic_property - def booksByTitle(self): - def fget(self): - return self.__booksByTitle - def fset(self, val): - self.__booksByTitle = val - return property(fget=fget, fset=fset) - @dynamic_property - def booksByTitle_noSeriesPrefix(self): - def fget(self): - return self.__booksByTitle_noSeriesPrefix - def fset(self, val): - self.__booksByTitle_noSeriesPrefix = val - return property(fget=fget, fset=fset) - @dynamic_property - def catalogPath(self): - def fget(self): - return self.__catalogPath - def fset(self, val): - self.__catalogPath = val - return property(fget=fget, fset=fset) - @dynamic_property - def contentDir(self): - def fget(self): - return self.__contentDir - def fset(self, val): - self.__contentDir = val - return property(fget=fget, fset=fset) - @dynamic_property - def currentStep(self): - def fget(self): - return self.__currentStep - def fset(self, val): - self.__currentStep = val - return property(fget=fget, fset=fset) - @dynamic_property - def creator(self): - def fget(self): - return self.__creator - def fset(self, val): - self.__creator = val - return property(fget=fget, fset=fset) - @dynamic_property - def db(self): - def fget(self): - return self.__db - return property(fget=fget) - @dynamic_property - def descriptionClip(self): - def fget(self): - return self.__descriptionClip - def fset(self, val): - self.__descriptionClip = val - return property(fget=fget, fset=fset) - @dynamic_property - def error(self): - def fget(self): - return self.__error - return property(fget=fget) - @dynamic_property - def generateForKindle(self): - def fget(self): - return self.__generateForKindle - def fset(self, val): - self.__generateForKindle = val - return property(fget=fget, fset=fset) - @dynamic_property - def generateRecentlyRead(self): - def fget(self): - return self.__generateRecentlyRead - def fset(self, val): - self.__generateRecentlyRead = val - return property(fget=fget, fset=fset) - @dynamic_property - def genres(self): - def fget(self): - return self.__genres - def fset(self, val): - self.__genres = val - return property(fget=fget, fset=fset) - @dynamic_property - def genre_tags_dict(self): - def fget(self): - return self.__genre_tags_dict - def fset(self, val): - self.__genre_tags_dict = val - return property(fget=fget, fset=fset) - @dynamic_property - def htmlFileList(self): - def fget(self): - return self.__htmlFileList - def fset(self, val): - self.__htmlFileList = val - return property(fget=fget, fset=fset) - @dynamic_property - def libraryPath(self): - def fget(self): - return self.__libraryPath - def fset(self, val): - self.__libraryPath = val - return property(fget=fget, fset=fset) - @dynamic_property - def markerTags(self): - def fget(self): - return self.__markerTags - def fset(self, val): - self.__markerTags = val - return property(fget=fget, fset=fset) - @dynamic_property - def ncxSoup(self): - def fget(self): - return self.__ncxSoup - def fset(self, val): - self.__ncxSoup = val - return property(fget=fget, fset=fset) - @dynamic_property - def opts(self): - def fget(self): - return self.__opts - return property(fget=fget) - @dynamic_property - def playOrder(self): - def fget(self): - return self.__playOrder - def fset(self,val): - self.__playOrder = val - return property(fget=fget, fset=fset) - @dynamic_property - def plugin(self): - def fget(self): - return self.__plugin - return property(fget=fget) - @dynamic_property - def progressInt(self): - def fget(self): - return self.__progressInt - def fset(self, val): - self.__progressInt = val - return property(fget=fget, fset=fset) - @dynamic_property - def progressString(self): - def fget(self): - return self.__progressString - def fset(self, val): - self.__progressString = val - return property(fget=fget, fset=fset) - @dynamic_property - def reporter(self): - def fget(self): - return self.__reporter - def fset(self, val): - self.__reporter = val - return property(fget=fget, fset=fset) - @dynamic_property - def stylesheet(self): - def fget(self): - return self.__stylesheet - def fset(self, val): - self.__stylesheet = val - return property(fget=fget, fset=fset) - @dynamic_property - def thumbs(self): - def fget(self): - return self.__thumbs - def fset(self, val): - self.__thumbs = val - return property(fget=fget, fset=fset) - def thumbWidth(self): - def fget(self): - return self.__thumbWidth - def fset(self, val): - self.__thumbWidth = val - return property(fget=fget, fset=fset) - def thumbHeight(self): - def fget(self): - return self.__thumbHeight - def fset(self, val): - self.__thumbHeight = val - return property(fget=fget, fset=fset) - @dynamic_property - def title(self): - def fget(self): - return self.__title - def fset(self, val): - self.__title = val - return property(fget=fget, fset=fset) - @dynamic_property - def totalSteps(self): - def fget(self): - return self.__totalSteps - return property(fget=fget) - @dynamic_property - def useSeriesPrefixInTitlesSection(self): - def fget(self): - return self.__useSeriesPrefixInTitlesSection - def fset(self, val): - self.__useSeriesPrefixInTitlesSection = val - return property(fget=fget, fset=fset) - @dynamic_property - def verbose(self): - def fget(self): - return self.__verbose - def fset(self, val): - self.__verbose = val - return property(fget=fget, fset=fset) - - @dynamic_property - def NOT_READ_SYMBOL(self): - def fget(self): - return '' if self.generateForKindle else \ - '%s' % self.opts.read_tag - return property(fget=fget) - @dynamic_property - def READING_SYMBOL(self): - def fget(self): - return '' if self.generateForKindle else \ - '%s' % self.opts.read_tag - return property(fget=fget) - @dynamic_property - def READ_SYMBOL(self): - def fget(self): - return '' if self.generateForKindle else \ - '%s' % self.opts.read_tag - return property(fget=fget) - @dynamic_property - def FULL_RATING_SYMBOL(self): - def fget(self): - return "★" if self.generateForKindle else "*" - return property(fget=fget) - @dynamic_property - def EMPTY_RATING_SYMBOL(self): - def fget(self): - return "☆" if self.generateForKindle else ' ' - return property(fget=fget) - @dynamic_property - def READ_PROGRESS_SYMBOL(self): - def fget(self): - return "▪" if self.generateForKindle else '+' - return property(fget=fget) - @dynamic_property - def UNREAD_PROGRESS_SYMBOL(self): - def fget(self): - return "▫" if self.generateForKindle else '-' - return property(fget=fget) + @dynamic_property + def NOT_READ_SYMBOL(self): + def fget(self): + return '' if self.generateForKindle else \ + '%s' % self.opts.read_tag + return property(fget=fget) + @dynamic_property + def READING_SYMBOL(self): + def fget(self): + return '' if self.generateForKindle else \ + '%s' % self.opts.read_tag + return property(fget=fget) + @dynamic_property + def READ_SYMBOL(self): + def fget(self): + return '' if self.generateForKindle else \ + '%s' % self.opts.read_tag + return property(fget=fget) + @dynamic_property + def FULL_RATING_SYMBOL(self): + def fget(self): + return "★" if self.generateForKindle else "*" + return property(fget=fget) + @dynamic_property + def EMPTY_RATING_SYMBOL(self): + def fget(self): + return "☆" if self.generateForKindle else ' ' + return property(fget=fget) + @dynamic_property + def READ_PROGRESS_SYMBOL(self): + def fget(self): + return "▪" if self.generateForKindle else '+' + return property(fget=fget) + @dynamic_property + def UNREAD_PROGRESS_SYMBOL(self): + def fget(self): + return "▫" if self.generateForKindle else '-' + return property(fget=fget) # Methods def buildSources(self): @@ -1206,7 +1207,6 @@ class EPUB_MOBI(CatalogPlugin): self.generateOPF() self.generateNCXHeader() - self.generateNCXDescriptions("Descriptions") self.generateNCXByAuthor("Authors") if self.opts.generate_titles: self.generateNCXByTitle("Titles") @@ -1215,6 +1215,7 @@ class EPUB_MOBI(CatalogPlugin): if self.generateRecentlyRead: self.generateNCXByDateRead("Recently Read") self.generateNCXByGenre("Genres") + self.generateNCXDescriptions("Descriptions") self.writeNCX() return True @@ -1570,8 +1571,8 @@ class EPUB_MOBI(CatalogPlugin): if title['series']: # title
series series_index brTag = Tag(soup,'br') - title_tokens = title['title'].split(': ') - emTag.insert(0, escape(NavigableString(title_tokens[1]))) + title_tokens = list(title['title'].partition(':')) + emTag.insert(0, escape(NavigableString(title_tokens[2].strip()))) emTag.insert(1, brTag) smallTag = Tag(soup,'small') smallTag.insert(0, escape(NavigableString(title_tokens[0]))) @@ -1747,8 +1748,8 @@ class EPUB_MOBI(CatalogPlugin): nspt = deepcopy(self.booksByTitle) for book in nspt: if book['series']: - tokens = book['title'].split(': ') - book['title'] = '%s (%s)' % (tokens[1], tokens[0]) + tokens = book['title'].partition(':') + book['title'] = '%s (%s)' % (tokens[2].strip(), tokens[0]) book['title_sort'] = self.generateSortTitle(book['title']) nspt = sorted(nspt, key=lambda x:(x['title_sort'].upper(), x['title_sort'].upper())) @@ -1929,7 +1930,7 @@ class EPUB_MOBI(CatalogPlugin): current_series = book['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + book['series'])) + pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s Series' % book['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 if current_series and not book['series']: @@ -2046,7 +2047,7 @@ class EPUB_MOBI(CatalogPlugin): current_series = new_entry['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + new_entry['series'])) + pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s Series' % new_entry['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 if current_series and not new_entry['series']: @@ -2186,8 +2187,8 @@ class EPUB_MOBI(CatalogPlugin): nspt = deepcopy(self.booksByTitle) for book in nspt: if book['series']: - tokens = book['title'].split(': ') - book['title'] = '%s (%s)' % (tokens[1], tokens[0]) + tokens = book['title'].partition(':') + book['title'] = '%s (%s)' % (tokens[2].strip(), tokens[0]) book['title_sort'] = self.generateSortTitle(book['title']) self.booksByDateRange = sorted(nspt, key=lambda x:(x['timestamp'], x['timestamp']),reverse=True) @@ -2683,22 +2684,7 @@ class EPUB_MOBI(CatalogPlugin): # HTML files - add books to manifest and spine sort_descriptions_by = self.booksByAuthor if self.opts.sort_descriptions_by_author \ else self.booksByTitle - for book in sort_descriptions_by: - # manifest - itemTag = Tag(soup, "item") - itemTag['href'] = "content/book_%d.html" % int(book['id']) - itemTag['id'] = "book%d" % int(book['id']) - itemTag['media-type'] = "application/xhtml+xml" - manifest.insert(mtc, itemTag) - mtc += 1 - - # spine - itemrefTag = Tag(soup, "itemref") - itemrefTag['idref'] = "book%d" % int(book['id']) - spine.insert(stc, itemrefTag) - stc += 1 - - # Add other html_files to manifest and spine + # Add html_files to manifest and spine for file in self.htmlFileList: itemTag = Tag(soup, "item") @@ -2734,6 +2720,21 @@ class EPUB_MOBI(CatalogPlugin): spine.insert(stc, itemrefTag) stc += 1 + for book in sort_descriptions_by: + # manifest + itemTag = Tag(soup, "item") + itemTag['href'] = "content/book_%d.html" % int(book['id']) + itemTag['id'] = "book%d" % int(book['id']) + itemTag['media-type'] = "application/xhtml+xml" + manifest.insert(mtc, itemTag) + mtc += 1 + + # spine + itemrefTag = Tag(soup, "itemref") + itemrefTag['idref'] = "book%d" % int(book['id']) + spine.insert(stc, itemrefTag) + stc += 1 + # Guide referenceTag = Tag(soup, "reference") referenceTag['type'] = 'masthead' @@ -2821,15 +2822,15 @@ class EPUB_MOBI(CatalogPlugin): navLabelTag = Tag(ncx_soup, "navLabel") textTag = Tag(ncx_soup, "text") if book['series']: - tokens = book['title'].split(': ') + tokens = list(book['title'].partition(':')) if self.generateForKindle: # Don't include Author for Kindle textTag.insert(0, NavigableString(self.formatNCXText('%s (%s)' % \ - (tokens[1], tokens[0]), dest='title'))) + (tokens[2].strip(), tokens[0]), dest='title'))) else: # Include Author for non-Kindle textTag.insert(0, NavigableString(self.formatNCXText('%s · %s (%s)' % \ - (tokens[1], book['author'], tokens[0]), dest='title'))) + (tokens[2].strip(), book['author'], tokens[0]), dest='title'))) else: if self.generateForKindle: # Don't include Author for Kindle @@ -3752,7 +3753,7 @@ class EPUB_MOBI(CatalogPlugin): current_series = book['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + book['series'])) + pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s Series' % book['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 @@ -3897,7 +3898,7 @@ class EPUB_MOBI(CatalogPlugin):

-

+
@@ -4231,6 +4232,7 @@ class EPUB_MOBI(CatalogPlugin): op = opts.output_profile if op is None: op = 'default' + if opts.connected_device['name'] and 'kindle' in opts.connected_device['name'].lower(): opts.connected_kindle = True if opts.connected_device['serial'] and opts.connected_device['serial'][:4] in ['B004','B005']: @@ -4256,7 +4258,8 @@ class EPUB_MOBI(CatalogPlugin): opts.exclude_genre = '\[^.\]' build_log.append(" converting empty exclude_genre to '\[^.\]'") - if opts.connected_device['name']: + if opts.connected_device['is_device_connected'] and \ + opts.connected_device['kind'] == 'device': if opts.connected_device['serial']: build_log.append(u" connected_device: '%s' #%s%s " % \ (opts.connected_device['name'], @@ -4270,6 +4273,8 @@ class EPUB_MOBI(CatalogPlugin): for storage in opts.connected_device['storage']: if storage: build_log.append(u" mount point: %s" % storage) + else: + build_log.append(u" connected_device: '%s'" % opts.connected_device['name']) opts_dict = vars(opts) if opts_dict['ids']: diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index ea42fe5998..3c2e7c09cd 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -672,7 +672,14 @@ def command_catalog(args, dbpath): # No support for connected device in CLI environment # Parallel initialization in calibre.gui2.tools:generate_catalog() - opts.connected_device = { 'storage':None,'serial':None,'save_template':None,'name':None} + opts.connected_device = { + 'is_device_connected': False, + 'kind': device_manager.connected_device_kind, + 'name': None, + 'save_template': None, + 'serial': None, + 'storage': None, + } with plugin: plugin.run(args[1], opts, get_db(dbpath, opts)) From 3404b367b966330937cd0ef08d690c60e216ad29 Mon Sep 17 00:00:00 2001 From: GRiker Date: Tue, 7 Sep 2010 04:23:10 -0700 Subject: [PATCH 2/4] GwR changes via CHaley --- src/calibre/gui2/actions/catalog.py | 9 +++++++-- src/calibre/library/catalog.py | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/actions/catalog.py b/src/calibre/gui2/actions/catalog.py index d965c6d814..74d3874c1e 100644 --- a/src/calibre/gui2/actions/catalog.py +++ b/src/calibre/gui2/actions/catalog.py @@ -26,14 +26,19 @@ class GenerateCatalogAction(InterfaceAction): rows = xrange(self.gui.library_view.model().rowCount(QModelIndex())) ids = map(self.gui.library_view.model().id, rows) - dbspec = None if not ids: return error_dialog(self.gui, _('No books selected'), _('No books selected to generate catalog for'), show=True) + db = self.gui.library_view.model().db + dbspec = {} + for id in ids: + dbspec[id] = {'ondevice':db.ondevice(id, index_is_id=True)} + db.catalog_plugin_on_device_temp_mapping = dbspec + # Calling gui2.tools:generate_catalog() - ret = generate_catalog(self.gui, dbspec, ids, self.gui.device_manager) + ret = generate_catalog(self.gui, db, ids, self.gui.device_manager) if ret is None: return diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 75e51ff3ca..a23b86bdef 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -104,8 +104,7 @@ class CSV_XML(CatalogPlugin): # Output the entry fields for entry in data: - print "%s [%s]" % (entry['title'],entry['id']) - print "ondevice: %s" % db.ondevice(entry['id'], index_is_id=True) + print "%s [%s] ondevice: %s" % (entry['title'],entry['id'], repr(db.catalog_plugin_on_device_temp_mapping[entry['id']])) outstr = [] for field in fields: item = entry[field] From c79032285c48943e01de23104fca3e74123e837c Mon Sep 17 00:00:00 2001 From: GRiker Date: Tue, 7 Sep 2010 14:11:07 -0700 Subject: [PATCH 3/4] GwR revisions supporting Series Section --- resources/catalog/stylesheet.css | 24 +++++++----- src/calibre/library/catalog.py | 66 ++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/resources/catalog/stylesheet.css b/resources/catalog/stylesheet.css index 4f9ca9ac41..ff338fb130 100644 --- a/resources/catalog/stylesheet.css +++ b/resources/catalog/stylesheet.css @@ -6,7 +6,7 @@ p.title { text-align:center; font-style:italic; font-size:xx-large; - border-bottom: solid black 4px; + border-bottom: solid black 2px; } p.author { @@ -17,6 +17,15 @@ p.author { font-size:large; } +p.author_index { + font-size:large; + font-weight:bold; + text-align:left; + margin-top:0px; + margin-bottom:0px; + text-indent: 0em; + } + p.tags { margin-top:0em; margin-bottom:0em; @@ -47,19 +56,12 @@ p.letter_index { margin-bottom:0px; } -p.author_index { - font-size:large; - text-align:left; - margin-top:0px; - margin-bottom:0px; - text-indent: 0em; - } - p.series { - text-align: left; + font-style:italic; margin-top:0px; margin-bottom:0px; margin-left:2em; + text-align: left; text-indent:-2em; } @@ -88,6 +90,8 @@ p.date_read { } hr.series_divider { + border-style:solid; + border-width:thin; width:50%; margin-left:1em; margin-top:0em; diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 05e596d3fb..fb6dd08705 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -1760,12 +1760,13 @@ class EPUB_MOBI(CatalogPlugin): if not self.__generateForKindle: # We don't need this because the Kindle shows section titles #

By Title

- h2Tag = Tag(soup, "h2") + pTag = Tag(soup, "p") + pTag['class'] = 'title' aTag = Tag(soup, "a") aTag['name'] = "bytitle" - h2Tag.insert(0,aTag) - h2Tag.insert(1,NavigableString('By Title (%d)' % len(self.booksByTitle))) - body.insert(btc,h2Tag) + pTag.insert(0,aTag) + pTag.insert(1,NavigableString('By Title')) + body.insert(btc,pTag) btc += 1 #

@@ -1938,12 +1939,10 @@ class EPUB_MOBI(CatalogPlugin): current_series = None pAuthorTag = Tag(soup, "p") pAuthorTag['class'] = "author_index" - emTag = Tag(soup, "em") aTag = Tag(soup, "a") aTag['name'] = "%s" % self.generateAuthorAnchor(current_author) aTag.insert(0,NavigableString(current_author)) - emTag.insert(0,aTag) - pAuthorTag.insert(0,emTag) + pAuthorTag.insert(0,aTag) divTag.insert(dtc,pAuthorTag) dtc += 1 @@ -1961,7 +1960,17 @@ class EPUB_MOBI(CatalogPlugin): current_series = book['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % book['series'])) + + if self.opts.generate_series: + aTag = Tag(soup,'a') + aTag['href'] = "%s.html#%s_series" % ('BySeries', + re.sub('\W','',book['series']).lower()) + aTag.insert(0, book['series']) + pSeriesTag.insert(0, NavigableString(self.NOT_READ_SYMBOL)) + pSeriesTag.insert(1, aTag) + else: + pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % book['series'])) + divTag.insert(dtc,pSeriesTag) dtc += 1 if current_series and not book['series']: @@ -2004,13 +2013,15 @@ class EPUB_MOBI(CatalogPlugin): if not self.__generateForKindle: # Insert the

tag with book_count at the head #

By Author

- h2Tag = Tag(soup, "h2") + pTag = Tag(soup, "p") + pTag['class'] = 'title' aTag = Tag(soup, "a") anchor_name = friendly_name.lower() aTag['name'] = anchor_name.replace(" ","") - h2Tag.insert(0,aTag) - h2Tag.insert(1,NavigableString('%s (%d)' % (friendly_name, book_count))) - body.insert(btc,h2Tag) + pTag.insert(0,aTag) + #h2Tag.insert(1,NavigableString('%s (%d)' % (friendly_name, book_count))) + pTag.insert(1,NavigableString('%s' % (friendly_name))) + body.insert(btc,pTag) btc += 1 # Add the divTag to the body @@ -2590,7 +2601,22 @@ class EPUB_MOBI(CatalogPlugin): aTag = Tag(soup, "a") aTag['href'] = "book_%d.html" % (int(float(book['id']))) # Use series, series index if avail else just title - aTag.insert(0,'%d. %s · %s' % (book['series_index'],escape(book['title']), ' & '.join(book['authors']))) + #aTag.insert(0,'%d. %s · %s' % (book['series_index'],escape(book['title']), ' & '.join(book['authors']))) + + # Link to book + aTag.insert(0,'%d. %s' % (book['series_index'],escape(book['title']))) + pBookTag.insert(ptc, aTag) + ptc += 1 + + # · + pBookTag.insert(ptc, NavigableString(' · ')) + ptc += 1 + + # Link to author + aTag = Tag(soup, "a") + aTag['href'] = "%s.html#%s" % ("ByAlphaAuthor", + self.generateAuthorAnchor(' & '.join(book['authors']))) + aTag.insert(0, NavigableString(' & '.join(book['authors']))) pBookTag.insert(ptc, aTag) ptc += 1 @@ -2600,13 +2626,15 @@ class EPUB_MOBI(CatalogPlugin): if not self.__generateForKindle: # Insert the

tag with book_count at the head #

By Series

- h2Tag = Tag(soup, "h2") + pTag = Tag(soup, "p") + pTag['class'] = 'title' aTag = Tag(soup, "a") anchor_name = friendly_name.lower() aTag['name'] = anchor_name.replace(" ","") - h2Tag.insert(0,aTag) - h2Tag.insert(1,NavigableString('%s (%d)' % (friendly_name, series_count))) - body.insert(btc,h2Tag) + pTag.insert(0,aTag) + #h2Tag.insert(1,NavigableString('%s (%d)' % (friendly_name, series_count))) + pTag.insert(1,NavigableString('%s' % friendly_name)) + body.insert(btc,pTag) btc += 1 # Add the divTag to the body @@ -4003,12 +4031,10 @@ class EPUB_MOBI(CatalogPlugin): current_series = None pAuthorTag = Tag(soup, "p") pAuthorTag['class'] = "author_index" - emTag = Tag(soup, "em") aTag = Tag(soup, "a") aTag['href'] = "%s.html#%s" % ("ByAlphaAuthor", self.generateAuthorAnchor(book['author'])) aTag.insert(0, book['author']) - emTag.insert(0,aTag) - pAuthorTag.insert(0,emTag) + pAuthorTag.insert(0,aTag) divTag.insert(dtc,pAuthorTag) dtc += 1 From 4bdeb656966ce95eee1025a0fc34287c4fdb91a4 Mon Sep 17 00:00:00 2001 From: GRiker Date: Wed, 8 Sep 2010 06:49:35 -0700 Subject: [PATCH 4/4] GwR revisions --- resources/catalog/stylesheet.css | 20 +++--- src/calibre/devices/apple/driver.py | 14 ++--- src/calibre/library/catalog.py | 96 +++++++++++++++++++---------- 3 files changed, 80 insertions(+), 50 deletions(-) diff --git a/resources/catalog/stylesheet.css b/resources/catalog/stylesheet.css index ff338fb130..4c5045d378 100644 --- a/resources/catalog/stylesheet.css +++ b/resources/catalog/stylesheet.css @@ -22,7 +22,7 @@ p.author_index { font-weight:bold; text-align:left; margin-top:0px; - margin-bottom:0px; + margin-bottom:-2px; text-indent: 0em; } @@ -58,10 +58,10 @@ p.letter_index { p.series { font-style:italic; - margin-top:0px; + margin-top:2px; margin-bottom:0px; margin-left:2em; - text-align: left; + text-align:left; text-indent:-2em; } @@ -89,13 +89,13 @@ p.date_read { text-indent:-6em; } -hr.series_divider { - border-style:solid; - border-width:thin; - width:50%; - margin-left:1em; - margin-top:0em; - margin-bottom:0em; +hr.description_divider { + width:90%; + margin-left:5%; + border-top: solid white 0px; + border-right: solid white 0px; + border-bottom: solid black 1px; + border-left: solid white 0px; } hr.annotations_divider { diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index 916c88f203..afd7958265 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -2303,9 +2303,9 @@ class ITUNES(DriverBase): # Delete existing from Device|Books, add to self.update_list # for deletion from booklist[0] during add_books_to_metadata for book in self.cached_books: - if self.cached_books[book]['uuid'] == metadata.uuid and \ - self.cached_books[book]['title'] == metadata.title and \ - self.cached_books[book]['author'] == metadata.authors[0]: + if self.cached_books[book]['uuid'] == metadata.uuid or \ + (self.cached_books[book]['title'] == metadata.title and \ + self.cached_books[book]['author'] == metadata.authors[0]): self.update_list.append(self.cached_books[book]) self._remove_from_device(self.cached_books[book]) if DEBUG: @@ -2322,9 +2322,9 @@ class ITUNES(DriverBase): # Delete existing from Library|Books, add to self.update_list # for deletion from booklist[0] during add_books_to_metadata for book in self.cached_books: - if self.cached_books[book]['uuid'] == metadata.uuid and \ - self.cached_books[book]['title'] == metadata.title and \ - self.cached_books[book]['author'] == metadata.authors[0]: + if self.cached_books[book]['uuid'] == metadata.uuid or \ + (self.cached_books[book]['title'] == metadata.title and \ + self.cached_books[book]['author'] == metadata.authors[0]): self.update_list.append(self.cached_books[book]) self._remove_from_iTunes(self.cached_books[book]) if DEBUG: @@ -2488,7 +2488,7 @@ class ITUNES(DriverBase): zf_opf.close() # If 'News' in tags, tweak the title/author for friendlier display in iBooks - if _('News') in metadata.tags: + if _('News') or _('Catalog') in metadata.tags: if metadata.title.find('[') > 0: metadata.title = metadata.title[:metadata.title.find('[')-1] date_as_author = '%s, %s %s, %s' % (strftime('%A'), strftime('%B'), strftime('%d').lstrip('0'), strftime('%Y')) diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index fb6dd08705..a02766c9b4 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -1765,7 +1765,7 @@ class EPUB_MOBI(CatalogPlugin): aTag = Tag(soup, "a") aTag['name'] = "bytitle" pTag.insert(0,aTag) - pTag.insert(1,NavigableString('By Title')) + pTag.insert(1,NavigableString('Titles')) body.insert(btc,pTag) btc += 1 @@ -1775,7 +1775,7 @@ class EPUB_MOBI(CatalogPlugin): dtc = 0 current_letter = "" - # 2/14/10 7:11 AM Experimental: re-sort title list without leading series/series_index + # Re-sort title list without leading series/series_index if not self.useSeriesPrefixInTitlesSection: nspt = deepcopy(self.booksByTitle) for book in nspt: @@ -1868,7 +1868,7 @@ class EPUB_MOBI(CatalogPlugin): # Write books by author A-Z self.updateProgressFullStep("'Authors'") - friendly_name = "By Author" + friendly_name = "Authors" soup = self.generateHTMLEmptyHeader(friendly_name) body = soup.find('body') @@ -1946,6 +1946,7 @@ class EPUB_MOBI(CatalogPlugin): divTag.insert(dtc,pAuthorTag) dtc += 1 + ''' # Insert an
between non-series and series if not current_series and non_series_books and book['series']: # Insert an
@@ -1953,6 +1954,7 @@ class EPUB_MOBI(CatalogPlugin): hrTag['class'] = "series_divider" divTag.insert(dtc,hrTag) dtc += 1 + ''' # Check for series if book['series'] and book['series'] != current_series: @@ -1966,10 +1968,11 @@ class EPUB_MOBI(CatalogPlugin): aTag['href'] = "%s.html#%s_series" % ('BySeries', re.sub('\W','',book['series']).lower()) aTag.insert(0, book['series']) - pSeriesTag.insert(0, NavigableString(self.NOT_READ_SYMBOL)) - pSeriesTag.insert(1, aTag) + #pSeriesTag.insert(0, NavigableString(self.NOT_READ_SYMBOL)) + pSeriesTag.insert(0, aTag) else: - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % book['series'])) + #pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % book['series'])) + pSeriesTag.insert(0,NavigableString('%s' % book['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 @@ -1998,15 +2001,18 @@ class EPUB_MOBI(CatalogPlugin): aTag = Tag(soup, "a") aTag['href'] = "book_%d.html" % (int(float(book['id']))) - # Use series, series index if avail else just title + # Use series, series index if avail else just title, + year of publication if current_series: - aTag.insert(0,escape(book['title'][len(book['series'])+1:])) + aTag.insert(0,'%s (%s)' % (escape(book['title'][len(book['series'])+1:]), + book['date'].split()[1])) else: - aTag.insert(0,escape(book['title'])) + aTag.insert(0,'%s (%s)' % (escape(book['title']), + book['date'].split()[1])) non_series_books += 1 pBookTag.insert(ptc, aTag) ptc += 1 + divTag.insert(dtc, pBookTag) dtc += 1 @@ -2065,15 +2071,14 @@ class EPUB_MOBI(CatalogPlugin): current_series = None pAuthorTag = Tag(soup, "p") pAuthorTag['class'] = "author_index" - emTag = Tag(soup, "em") aTag = Tag(soup, "a") aTag['name'] = "%s" % self.generateAuthorAnchor(current_author) aTag.insert(0,NavigableString(current_author)) - emTag.insert(0,aTag) - pAuthorTag.insert(0,emTag) + pAuthorTag.insert(0,aTag) divTag.insert(dtc,pAuthorTag) dtc += 1 + ''' # Insert an
between non-series and series if not current_series and non_series_books and new_entry['series']: # Insert an
@@ -2081,6 +2086,7 @@ class EPUB_MOBI(CatalogPlugin): hrTag['class'] = "series_divider" divTag.insert(dtc,hrTag) dtc += 1 + ''' # Check for series if new_entry['series'] and new_entry['series'] != current_series: @@ -2088,7 +2094,14 @@ class EPUB_MOBI(CatalogPlugin): current_series = new_entry['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % new_entry['series'])) + if self.opts.generate_series: + aTag = Tag(soup,'a') + aTag['href'] = "%s.html#%s_series" % ('BySeries', + re.sub('\W','',new_entry['series']).lower()) + aTag.insert(0, new_entry['series']) + pSeriesTag.insert(0, aTag) + else: + pSeriesTag.insert(0,NavigableString('%s' % new_entry['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 if current_series and not new_entry['series']: @@ -2205,13 +2218,14 @@ class EPUB_MOBI(CatalogPlugin): if not self.__generateForKindle: #

By Author

- h2Tag = Tag(soup, "h2") + pTag = Tag(soup, "p") + pTag['class'] = 'title' aTag = Tag(soup, "a") anchor_name = friendly_name.lower() aTag['name'] = anchor_name.replace(" ","") - h2Tag.insert(0,aTag) - h2Tag.insert(1,NavigableString('%s' % friendly_name)) - body.insert(btc,h2Tag) + pTag.insert(0,aTag) + pTag.insert(1,NavigableString('%s' % friendly_name)) + body.insert(btc,pTag) btc += 1 #

@@ -2254,11 +2268,14 @@ class EPUB_MOBI(CatalogPlugin): dtc = add_books_to_HTML_by_date_range(date_range_list, date_range, dtc) date_range_list = [book] + ''' if books_added_in_date_range: # Add an


separating date ranges from months hrTag = Tag(soup,'hr') + hrTag['class'] = "description_divider" divTag.insert(dtc,hrTag) dtc += 1 + ''' # >>>> Books by month <<<< # Sort titles case-insensitive for by month using series prefix @@ -2509,10 +2526,7 @@ class EPUB_MOBI(CatalogPlugin): # Fetch the database as a dictionary self.booksBySeries = self.plugin.search_sort_db(self.db, self.opts) - for series_item in self.booksBySeries: - print ' %s %s %s' % (series_item['series'],series_item['series_index'],series_item['title']) - - friendly_name = "By Series" + friendly_name = "Series" soup = self.generateHTMLEmptyHeader(friendly_name) body = soup.find('body') @@ -2604,7 +2618,9 @@ class EPUB_MOBI(CatalogPlugin): #aTag.insert(0,'%d. %s · %s' % (book['series_index'],escape(book['title']), ' & '.join(book['authors']))) # Link to book - aTag.insert(0,'%d. %s' % (book['series_index'],escape(book['title']))) + aTag.insert(0,'%d. %s (%s)' % (book['series_index'], + escape(book['title']), + strftime(u'%Y', book['pubdate'].timetuple()))) pBookTag.insert(ptc, aTag) ptc += 1 @@ -2615,8 +2631,8 @@ class EPUB_MOBI(CatalogPlugin): # Link to author aTag = Tag(soup, "a") aTag['href'] = "%s.html#%s" % ("ByAlphaAuthor", - self.generateAuthorAnchor(' & '.join(book['authors']))) - aTag.insert(0, NavigableString(' & '.join(book['authors']))) + self.generateAuthorAnchor(escape(' & '.join(book['authors'])))) + aTag.insert(0, NavigableString(' & '.join(book['authors']))) pBookTag.insert(ptc, aTag) ptc += 1 @@ -2979,7 +2995,8 @@ class EPUB_MOBI(CatalogPlugin): navLabelTag.insert(0, textTag) navPointTag.insert(0, navLabelTag) contentTag = Tag(soup, 'content') - contentTag['src'] = "content/book_%d.html" % int(self.booksByTitle[0]['id']) + #contentTag['src'] = "content/book_%d.html" % int(self.booksByTitle[0]['id']) + contentTag['src'] = "content/ByAlphaAuthor.html" navPointTag.insert(1, contentTag) cmiTag = Tag(soup, '%s' % 'calibre:meta-img') cmiTag['name'] = "mastheadImage" @@ -4015,7 +4032,7 @@ class EPUB_MOBI(CatalogPlugin): btc += 1 titleTag = body.find(attrs={'class':'title'}) - titleTag.insert(0,NavigableString('%s' % escape(self.getFriendlyGenreTag(genre)))) + titleTag.insert(0,NavigableString('%s' % escape(self.getFriendlyGenreTag(genre)))) # Insert the books by author list divTag = body.find(attrs={'class':'authors'}) @@ -4038,6 +4055,7 @@ class EPUB_MOBI(CatalogPlugin): divTag.insert(dtc,pAuthorTag) dtc += 1 + ''' # Insert an
between non-series and series if not current_series and non_series_books and book['series']: # Insert an
@@ -4045,6 +4063,7 @@ class EPUB_MOBI(CatalogPlugin): hrTag['class'] = "series_divider" divTag.insert(dtc,hrTag) dtc += 1 + ''' # Check for series if book['series'] and book['series'] != current_series: @@ -4052,7 +4071,14 @@ class EPUB_MOBI(CatalogPlugin): current_series = book['series'] pSeriesTag = Tag(soup,'p') pSeriesTag['class'] = "series" - pSeriesTag.insert(0,NavigableString(self.NOT_READ_SYMBOL + '%s' % book['series'])) + if self.opts.generate_series: + aTag = Tag(soup,'a') + aTag['href'] = "%s.html#%s_series" % ('BySeries', + re.sub('\W','',book['series']).lower()) + aTag.insert(0, book['series']) + pSeriesTag.insert(0, aTag) + else: + pSeriesTag.insert(0,NavigableString('%s' % book['series'])) divTag.insert(dtc,pSeriesTag) dtc += 1 @@ -4109,7 +4135,7 @@ class EPUB_MOBI(CatalogPlugin): def generateHTMLDescriptionHeader(self, title): title_border = '' if self.opts.fmt == 'epub' else \ - '

' + '
' header = ''' @@ -4155,7 +4181,7 @@ class EPUB_MOBI(CatalogPlugin):   -

+
@@ -4524,7 +4550,8 @@ class EPUB_MOBI(CatalogPlugin): opts.fmt = self.fmt = path_to_output.rpartition('.')[2] # Add local options - opts.creator = "calibre" + opts.creator = '%s, %s %s, %s' % (strftime('%A'), strftime('%B'), strftime('%d').lstrip('0'), strftime('%Y')) + opts.creator_sort_as = '%s %s' % ('calibre', strftime('%Y-%m-%d')) opts.connected_kindle = False # Finalize output_profile @@ -4569,9 +4596,12 @@ class EPUB_MOBI(CatalogPlugin): build_log.append(u" mount point: %s" % storage) else: build_log.append(u" connected_device: '%s'" % opts.connected_device['name']) - for storage in opts.connected_device['storage']: - if storage: - build_log.append(u" mount point: %s" % storage) + try: + for storage in opts.connected_device['storage']: + if storage: + build_log.append(u" mount point: %s" % storage) + except: + build_log.append(u" (no mount points)") else: build_log.append(u" connected_device: '%s'" % opts.connected_device['name'])