mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
c065a4d8fa
commit
89a8ca7e8d
@ -252,7 +252,7 @@ class BookList(_BookList):
|
|||||||
return child
|
return child
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_book(self, info, name, size, ctime):
|
def add_book(self, mi, name, size, ctime):
|
||||||
""" Add a node into DOM tree representing a book """
|
""" Add a node into DOM tree representing a book """
|
||||||
book = self.book_by_path(name)
|
book = self.book_by_path(name)
|
||||||
if book is not None:
|
if book is not None:
|
||||||
@ -262,9 +262,9 @@ class BookList(_BookList):
|
|||||||
cid = self.max_id()+1
|
cid = self.max_id()+1
|
||||||
sourceid = str(self[0].sourceid) if len(self) else "1"
|
sourceid = str(self[0].sourceid) if len(self) else "1"
|
||||||
attrs = {
|
attrs = {
|
||||||
"title" : info["title"],
|
"title" : mi.title,
|
||||||
'titleSorter' : sortable_title(info['title']),
|
'titleSorter' : sortable_title(mi.title),
|
||||||
"author" : info["authors"] if info['authors'] else 'Unknown', \
|
"author" : mi.format_authors() if mi.format_authors() else _('Unknown'),
|
||||||
"page":"0", "part":"0", "scale":"0", \
|
"page":"0", "part":"0", "scale":"0", \
|
||||||
"sourceid":sourceid, "id":str(cid), "date":"", \
|
"sourceid":sourceid, "id":str(cid), "date":"", \
|
||||||
"mime":mime, "path":name, "size":str(size)
|
"mime":mime, "path":name, "size":str(size)
|
||||||
@ -273,7 +273,7 @@ class BookList(_BookList):
|
|||||||
node.setAttributeNode(self.document.createAttribute(attr))
|
node.setAttributeNode(self.document.createAttribute(attr))
|
||||||
node.setAttribute(attr, attrs[attr])
|
node.setAttribute(attr, attrs[attr])
|
||||||
try:
|
try:
|
||||||
w, h, data = info["cover"]
|
w, h, data = mi.thumbnail
|
||||||
except TypeError:
|
except TypeError:
|
||||||
w, h, data = None, None, None
|
w, h, data = None, None, None
|
||||||
|
|
||||||
@ -290,11 +290,15 @@ class BookList(_BookList):
|
|||||||
book.datetime = ctime
|
book.datetime = ctime
|
||||||
self.append(book)
|
self.append(book)
|
||||||
self.set_next_id(cid+1)
|
self.set_next_id(cid+1)
|
||||||
if self.prefix and info.has_key('tags'): # Playlists only supportted in main memory
|
tags = []
|
||||||
if info.has_key('tag order'):
|
if mi.tags:
|
||||||
self.tag_order.update(info['tag order'])
|
tags.extend(mi.tags)
|
||||||
self.set_playlists(book.id, info['tags'])
|
if mi.series:
|
||||||
|
tags.append(mi.series)
|
||||||
|
if self.prefix and tags: # Playlists only supportted in main memory
|
||||||
|
if hasattr(mi, 'tag_order'):
|
||||||
|
self.tag_order.update(mi.tag_order)
|
||||||
|
self.set_tags(book, tags)
|
||||||
|
|
||||||
def playlist_by_title(self, title):
|
def playlist_by_title(self, title):
|
||||||
for pl in self.playlists():
|
for pl in self.playlists():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user