From fa341347de3885c6769d06621afabf314f9e4c9d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Apr 2009 18:43:11 -0700 Subject: [PATCH] Fix #1994 (Save to disk or send to device changes author sort order) --- src/calibre/ebooks/metadata/mobi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index b6ec1fb721..3b65abce5f 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -31,7 +31,7 @@ class StreamSlicer(object): def __len__(self): return self._len - + def __getitem__(self, key): stream = self._stream base = self.start @@ -73,7 +73,7 @@ class StreamSlicer(object): return stream.write(value) raise TypeError("stream indices must be integers") - + class MetadataUpdater(object): def __init__(self, stream): self.stream = stream @@ -117,7 +117,11 @@ class MetadataUpdater(object): def update(self, mi): 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) recs.append((100, authors.encode(self.codec, 'replace'))) if mi.publisher: