From d668f536d67297e5e69200629d3c51334f995fec Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Aug 2009 08:53:54 -0600 Subject: [PATCH] Fix #3117 (Calibre inverts author names even when it doesn't need to) --- src/calibre/ebooks/mobi/reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index d8947568ca..064751a878 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -78,7 +78,10 @@ class EXTHHeader(object): if id == 100: if self.mi.authors == [_('Unknown')]: self.mi.authors = [] - self.mi.authors.append(content.decode(codec, 'ignore').strip()) + au = content.decode(codec, 'ignore').strip() + self.mi.authors.append(au) + if re.match(r'\S+?\s*,\s+\S+', au.strip()): + self.mi.author_sort = au.strip() elif id == 101: self.mi.publisher = content.decode(codec, 'ignore').strip() elif id == 103: