Sony T1: Tweaks/Bugfixes based on feedback/discovery

This commit is contained in:
Kolenka 2011-10-10 09:18:43 -07:00
parent 523a11c0c2
commit 236778f22f

View file

@ -265,7 +265,7 @@ def update_device_books(self, connection, booklist, source_id, plugboard):
values (?,?,?,?,?,?,?,?,?,0,0)
'''
t = (title, author, source_id, int(time.time() * 1000),
calendar.timegm(book.datetime), lpath,
int(calendar.timegm(book.datetime) * 1000), lpath,
os.path.basename(book.lpath), book.size, book.mime)
cursor.execute(query, t)
book.bookId = cursor.lastrowid
@ -278,7 +278,7 @@ def update_device_books(self, connection, booklist, source_id, plugboard):
SET title = ?, author = ?, modified_date = ?, file_size = ?
WHERE file_path = ?
'''
t = (title, author, calendar.timegm(book.datetime), book.size,
t = (title, author, int(calendar.timegm(book.datetime) * 1000), book.size,
lpath)
cursor.execute(query, t)
book.bookId = db_books[lpath]
@ -337,9 +337,9 @@ def update_device_collections(self, connection, booklist, collections,
db_books[row[0]] = row[1]
for idx, book in enumerate(books):
if collection not in book.device_collections:
book.device_collections.append(collection)
if db_books.get(book.lpath, None) is None:
if collection not in book.device_collections:
book.device_collections.append(collection)
query = '''
INSERT INTO collections (collection_id, content_id,
added_order) values (?,?,?)
@ -424,4 +424,5 @@ def upload_book_cover(self, connection, book, source_id):
t = (thumbnail_path, book.bookId,)
cursor.execute(query, t)
connection.commit()
cursor.close()