mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1994 (Save to disk or send to device changes author sort order)
This commit is contained in:
parent
84d7790836
commit
fa341347de
@ -31,7 +31,7 @@ class StreamSlicer(object):
|
|||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return self._len
|
return self._len
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
stream = self._stream
|
stream = self._stream
|
||||||
base = self.start
|
base = self.start
|
||||||
@ -73,7 +73,7 @@ class StreamSlicer(object):
|
|||||||
return stream.write(value)
|
return stream.write(value)
|
||||||
raise TypeError("stream indices must be integers")
|
raise TypeError("stream indices must be integers")
|
||||||
|
|
||||||
|
|
||||||
class MetadataUpdater(object):
|
class MetadataUpdater(object):
|
||||||
def __init__(self, stream):
|
def __init__(self, stream):
|
||||||
self.stream = stream
|
self.stream = stream
|
||||||
@ -117,7 +117,11 @@ class MetadataUpdater(object):
|
|||||||
|
|
||||||
def update(self, mi):
|
def update(self, mi):
|
||||||
recs = []
|
recs = []
|
||||||
if mi.authors:
|
from calibre.ebooks.mobi.from_any import config
|
||||||
|
if mi.author_sort and config().parse().prefer_author_sort:
|
||||||
|
authors = mi.author_sort
|
||||||
|
recs.append((100, authors.encode(self.codec, 'replace')))
|
||||||
|
elif mi.authors:
|
||||||
authors = '; '.join(mi.authors)
|
authors = '; '.join(mi.authors)
|
||||||
recs.append((100, authors.encode(self.codec, 'replace')))
|
recs.append((100, authors.encode(self.codec, 'replace')))
|
||||||
if mi.publisher:
|
if mi.publisher:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user