Remove changing author in sony_cache.py

Add more metadata in device view
This commit is contained in:
Charles Haley 2010-05-20 18:04:24 +01:00
parent 644e440df9
commit cbd83766c3
3 changed files with 35 additions and 15 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

@ -800,14 +800,14 @@ class DeviceBooksModel(BooksModel): # {{{
self.sort_history = [self.sorted_on]
self.unknown = _('Unknown')
self.column_map = ['inlibrary', 'title', 'authors', 'timestamp', 'size',
'tags']
'collections']
self.headers = {
'inlibrary' : _('In Library'),
'title' : _('Title'),
'authors' : _('Author(s)'),
'timestamp' : _('Date'),
'size' : _('Size'),
'tags' : _('Collections')
'collections': _('Collections')
}
self.marked_for_deletion = {}
self.search_engine = OnDeviceSearch(self)
@ -968,6 +968,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 = ', '.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):
@ -1000,7 +1017,7 @@ class DeviceBooksModel(BooksModel): # {{{
dt = self.db[self.map[row]].datetime
dt = dt_factory(dt, assume_utc=True, as_utc=False)
return QVariant(strftime(TIME_FMT, dt.timetuple()))
elif cname == 'tags':
elif cname == 'collections':
tags = self.db[self.map[row]].device_collections
if tags:
return QVariant(', '.join(tags))
@ -1045,7 +1062,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()