diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index a3e3e8d0a0..eb64a3c15a 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -11,7 +11,7 @@ __docformat__ = 'restructuredtext en' Device driver for the SONY T1 devices ''' -import os, time, calendar, re +import os, time, re import sqlite3 as sqlite from contextlib import closing @@ -19,6 +19,7 @@ from calibre.devices.usbms.driver import USBMS, debug_print from calibre.devices.usbms.device import USBDevice from calibre.devices.usbms.books import CollectionsBookList from calibre.devices.usbms.books import BookList +from calibre.ebooks.metadata import authors_to_sort_string from calibre.constants import islinux DBPATH = 'Sony_Reader/database/books.db' @@ -261,7 +262,7 @@ class PRST1(USBMS): lpath = book.lpath try: if opts.use_author_sort: - if newmi.author_sort : + if newmi.author_sort: author = newmi.author_sort else: author = authors_to_sort_string(newmi.authors) @@ -449,7 +450,7 @@ class PRST1(USBMS): cursor.close() - if metadata.bookId is not None: + if getattr(metadata, 'bookId', None) is not None: debug_print('PRS-T1: refreshing cover for book being sent') self.upload_book_cover(connection, metadata, source_id)