This commit is contained in:
Kovid Goyal 2010-05-20 11:21:24 -06:00
commit 769e304195
3 changed files with 32 additions and 12 deletions

View File

@ -288,14 +288,16 @@ class XMLCache(object):
if DEBUG:
prints('Renaming title', book.title, 'to', title)
book.title = title
authors = record.get('author', None)
if authors is not None:
authors = string_to_authors(authors)
if authors != book.authors:
if DEBUG:
prints('Renaming authors', book.authors, 'to',
authors)
book.authors = authors
# We shouldn't do this for Sonys, because the reader strips
# all but the first author.
# authors = record.get('author', None)
# if authors is not None:
# authors = string_to_authors(authors)
# if authors != book.authors:
# if DEBUG:
# prints('Renaming authors', book.authors, 'to',
# authors)
# book.authors = authors
for thumbnail in record.xpath(
'descendant::*[local-name()="thumbnail"]'):
for img in thumbnail.xpath(

View File

@ -983,6 +983,23 @@ class DeviceBooksModel(BooksModel): # {{{
dt = dt_factory(item.datetime, assume_utc=True)
data[_('Timestamp')] = isoformat(dt, sep=' ', as_utc=False)
data[_('Collections')] = ', '.join(item.device_collections)
tags = getattr(item, 'tags', None)
if tags:
tags = u', '.join(tags)
else:
tags = _('None')
data[_('Tags')] = tags
comments = getattr(item, 'comments', None)
if not comments:
comments = _('None')
data[_('Comments')] = comments
series = getattr(item, 'series', None)
if series:
sidx = getattr(item, 'series_index', 0)
sidx = fmt_sidx(sidx, use_roman = self.use_roman_numbers)
data[_('Series')] = _('Book <font face="serif">%s</font> of %s.')%(sidx, series)
self.new_bookdisplay_data.emit(data)
def paths(self, rows):
@ -1061,7 +1078,7 @@ class DeviceBooksModel(BooksModel): # {{{
self.db[idx].title_sorter = val
elif cname == 'authors':
self.db[idx].authors = string_to_authors(val)
elif cname == 'tags':
elif cname == 'collections':
tags = [i.strip() for i in val.split(',')]
tags = [t for t in tags if t]
self.db[idx].device_collections = tags

View File

@ -101,9 +101,10 @@ class BookInfoDisplay(QWidget):
WEIGHTS = collections.defaultdict(lambda : 100)
WEIGHTS[_('Path')] = 0
WEIGHTS[_('Formats')] = 1
WEIGHTS[_('Comments')] = 4
WEIGHTS[_('Series')] = 2
WEIGHTS[_('Tags')] = 3
WEIGHTS[_('Collections')] = 2
WEIGHTS[_('Series')] = 3
WEIGHTS[_('Tags')] = 4
WEIGHTS[_('Comments')] = 5
show_book_info = pyqtSignal()