mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove changing author in sony_cache.py
Add more metadata in device view
This commit is contained in:
parent
644e440df9
commit
cbd83766c3
@ -288,14 +288,16 @@ class XMLCache(object):
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
prints('Renaming title', book.title, 'to', title)
|
prints('Renaming title', book.title, 'to', title)
|
||||||
book.title = title
|
book.title = title
|
||||||
authors = record.get('author', None)
|
# We shouldn't do this for Sonys, because the reader strips
|
||||||
if authors is not None:
|
# all but the first author.
|
||||||
authors = string_to_authors(authors)
|
# authors = record.get('author', None)
|
||||||
if authors != book.authors:
|
# if authors is not None:
|
||||||
if DEBUG:
|
# authors = string_to_authors(authors)
|
||||||
prints('Renaming authors', book.authors, 'to',
|
# if authors != book.authors:
|
||||||
authors)
|
# if DEBUG:
|
||||||
book.authors = authors
|
# prints('Renaming authors', book.authors, 'to',
|
||||||
|
# authors)
|
||||||
|
# book.authors = authors
|
||||||
for thumbnail in record.xpath(
|
for thumbnail in record.xpath(
|
||||||
'descendant::*[local-name()="thumbnail"]'):
|
'descendant::*[local-name()="thumbnail"]'):
|
||||||
for img in thumbnail.xpath(
|
for img in thumbnail.xpath(
|
||||||
|
@ -800,14 +800,14 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
self.sort_history = [self.sorted_on]
|
self.sort_history = [self.sorted_on]
|
||||||
self.unknown = _('Unknown')
|
self.unknown = _('Unknown')
|
||||||
self.column_map = ['inlibrary', 'title', 'authors', 'timestamp', 'size',
|
self.column_map = ['inlibrary', 'title', 'authors', 'timestamp', 'size',
|
||||||
'tags']
|
'collections']
|
||||||
self.headers = {
|
self.headers = {
|
||||||
'inlibrary' : _('In Library'),
|
'inlibrary' : _('In Library'),
|
||||||
'title' : _('Title'),
|
'title' : _('Title'),
|
||||||
'authors' : _('Author(s)'),
|
'authors' : _('Author(s)'),
|
||||||
'timestamp' : _('Date'),
|
'timestamp' : _('Date'),
|
||||||
'size' : _('Size'),
|
'size' : _('Size'),
|
||||||
'tags' : _('Collections')
|
'collections': _('Collections')
|
||||||
}
|
}
|
||||||
self.marked_for_deletion = {}
|
self.marked_for_deletion = {}
|
||||||
self.search_engine = OnDeviceSearch(self)
|
self.search_engine = OnDeviceSearch(self)
|
||||||
@ -968,6 +968,23 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
dt = dt_factory(item.datetime, assume_utc=True)
|
dt = dt_factory(item.datetime, assume_utc=True)
|
||||||
data[_('Timestamp')] = isoformat(dt, sep=' ', as_utc=False)
|
data[_('Timestamp')] = isoformat(dt, sep=' ', as_utc=False)
|
||||||
data[_('Collections')] = ', '.join(item.device_collections)
|
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)
|
self.new_bookdisplay_data.emit(data)
|
||||||
|
|
||||||
def paths(self, rows):
|
def paths(self, rows):
|
||||||
@ -1000,7 +1017,7 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
dt = self.db[self.map[row]].datetime
|
dt = self.db[self.map[row]].datetime
|
||||||
dt = dt_factory(dt, assume_utc=True, as_utc=False)
|
dt = dt_factory(dt, assume_utc=True, as_utc=False)
|
||||||
return QVariant(strftime(TIME_FMT, dt.timetuple()))
|
return QVariant(strftime(TIME_FMT, dt.timetuple()))
|
||||||
elif cname == 'tags':
|
elif cname == 'collections':
|
||||||
tags = self.db[self.map[row]].device_collections
|
tags = self.db[self.map[row]].device_collections
|
||||||
if tags:
|
if tags:
|
||||||
return QVariant(', '.join(tags))
|
return QVariant(', '.join(tags))
|
||||||
@ -1045,7 +1062,7 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
self.db[idx].title_sorter = val
|
self.db[idx].title_sorter = val
|
||||||
elif cname == 'authors':
|
elif cname == 'authors':
|
||||||
self.db[idx].authors = string_to_authors(val)
|
self.db[idx].authors = string_to_authors(val)
|
||||||
elif cname == 'tags':
|
elif cname == 'collections':
|
||||||
tags = [i.strip() for i in val.split(',')]
|
tags = [i.strip() for i in val.split(',')]
|
||||||
tags = [t for t in tags if t]
|
tags = [t for t in tags if t]
|
||||||
self.db[idx].device_collections = tags
|
self.db[idx].device_collections = tags
|
||||||
|
@ -101,9 +101,10 @@ class BookInfoDisplay(QWidget):
|
|||||||
WEIGHTS = collections.defaultdict(lambda : 100)
|
WEIGHTS = collections.defaultdict(lambda : 100)
|
||||||
WEIGHTS[_('Path')] = 0
|
WEIGHTS[_('Path')] = 0
|
||||||
WEIGHTS[_('Formats')] = 1
|
WEIGHTS[_('Formats')] = 1
|
||||||
WEIGHTS[_('Comments')] = 4
|
WEIGHTS[_('Collections')] = 2
|
||||||
WEIGHTS[_('Series')] = 2
|
WEIGHTS[_('Series')] = 3
|
||||||
WEIGHTS[_('Tags')] = 3
|
WEIGHTS[_('Tags')] = 4
|
||||||
|
WEIGHTS[_('Comments')] = 5
|
||||||
|
|
||||||
show_book_info = pyqtSignal()
|
show_book_info = pyqtSignal()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user