From 19d0de005938f6747f6e96993acb0f797f901ddf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Jun 2014 13:01:28 +0530 Subject: [PATCH] Sony driver: Fix SONY annotation app not working with files sent to the device by calibre --- src/calibre/devices/prst1/driver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index e160da9ab0..2d7b4c852d 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -16,6 +16,7 @@ from contextlib import closing from datetime import date from calibre import fsync +from calibre.devices.mime import mime_type_ext from calibre.devices.errors import DeviceError from calibre.devices.usbms.driver import USBMS, debug_print from calibre.devices.usbms.device import USBDevice @@ -435,6 +436,7 @@ class PRST1(USBMS): def update_device_books(self, connection, booklist, source_id, plugboard, dbpath): + from calibre.ebooks.metadata.meta import path_to_ext opts = self.settings() upload_covers = opts.extra_customization[self.OPT_UPLOAD_COVERS] refresh_covers = opts.extra_customization[self.OPT_REFRESH_COVERS] @@ -484,7 +486,7 @@ class PRST1(USBMS): ''' t = (title, author, source_id, int(time.time() * 1000), modified_date, lpath, - os.path.basename(lpath), book.size, book.mime) + os.path.basename(lpath), book.size, book.mime or mime_type_ext(path_to_ext(lpath))) cursor.execute(query, t) book.bookId = self.get_lastrowid(cursor) if upload_covers: