Possible fix for use_author_sort being ignored sometimes

This commit is contained in:
Charles Haley 2010-08-20 17:31:16 +01:00
parent e947f60154
commit 552f7e9421

View File

@ -15,7 +15,8 @@ from calibre.devices.errors import DeviceError
from calibre.devices.usbms.driver import debug_print from calibre.devices.usbms.driver import debug_print
from calibre.constants import DEBUG, preferred_encoding from calibre.constants import DEBUG, preferred_encoding
from calibre.ebooks.chardet import xml_to_unicode from calibre.ebooks.chardet import xml_to_unicode
from calibre.ebooks.metadata import authors_to_string, title_sort from calibre.ebooks.metadata import authors_to_string, title_sort, \
authors_to_sort_string
# Utility functions {{{ # Utility functions {{{
EMPTY_CARD_CACHE = '''\ EMPTY_CARD_CACHE = '''\
@ -509,8 +510,13 @@ class XMLCache(object):
if not ts: if not ts:
ts = title_sort(title) ts = title_sort(title)
record.set('titleSorter', clean(ts)) record.set('titleSorter', clean(ts))
if self.use_author_sort and book.author_sort is not None: if self.use_author_sort:
record.set('author', clean(book.author_sort)) if book.author_sort:
aus = book.author_sort
else:
debug_print('Author_sort is None for book', book.lpath)
aus = authors_to_sort_string(book.authors)
record.set('author', clean(aus))
else: else:
record.set('author', clean(authors_to_string(book.authors))) record.set('author', clean(authors_to_string(book.authors)))
ext = os.path.splitext(path)[1] ext = os.path.splitext(path)[1]