mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sony T1: Bugfixes + Author Sort
Ensure path is correct on Windows before updating database Ensure modification time is being used on Windows Enable "Use Author Sort" for the T1
This commit is contained in:
parent
79f9adee92
commit
fd2df7f5a4
@ -55,6 +55,7 @@ class PRST1(USBMS):
|
||||
|
||||
THUMBNAIL_HEIGHT = 144
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
SUPPORTS_USE_AUTHOR_SORT = True
|
||||
MUST_READ_METADATA = True
|
||||
EBOOK_DIR_MAIN = 'Sony_Reader/media/books'
|
||||
|
||||
@ -255,12 +256,20 @@ class PRST1(USBMS):
|
||||
newmi = book
|
||||
|
||||
# Get Metadata We Want
|
||||
lpath = book.lpath
|
||||
# Make sure lpath uses Unix-style strings
|
||||
lpath = book.lpath.replace('\\', '/')
|
||||
try:
|
||||
author = newmi.authors[0]
|
||||
if opts.use_author_sort:
|
||||
if newmi.author_sort :
|
||||
author = newmi.author_sort
|
||||
else:
|
||||
author = authors_to_sort_string(newmi.authors)
|
||||
else:
|
||||
author = newmi.authors[0]
|
||||
except:
|
||||
author = _('Unknown')
|
||||
title = newmi.title or _('Unknown')
|
||||
modified_date = os.path.getmtime(book.path) * 1000
|
||||
|
||||
if lpath not in db_books:
|
||||
query = '''
|
||||
@ -271,8 +280,8 @@ class PRST1(USBMS):
|
||||
values (?,?,?,?,?,?,?,?,?,0,0)
|
||||
'''
|
||||
t = (title, author, source_id, int(time.time() * 1000),
|
||||
int(calendar.timegm(book.datetime) * 1000), lpath,
|
||||
os.path.basename(book.lpath), book.size, book.mime)
|
||||
modified_date, lpath,
|
||||
os.path.basename(lpath), book.size, book.mime)
|
||||
cursor.execute(query, t)
|
||||
book.bookId = cursor.lastrowid
|
||||
if upload_covers:
|
||||
@ -284,7 +293,7 @@ class PRST1(USBMS):
|
||||
SET title = ?, author = ?, modified_date = ?, file_size = ?
|
||||
WHERE file_path = ?
|
||||
'''
|
||||
t = (title, author, int(calendar.timegm(book.datetime) * 1000), book.size,
|
||||
t = (title, author, modified_date, book.size,
|
||||
lpath)
|
||||
cursor.execute(query, t)
|
||||
book.bookId = db_books[lpath]
|
||||
|
Loading…
x
Reference in New Issue
Block a user