mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
d9a6538dea
@ -1308,6 +1308,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
self._debug('getting book metadata. Done', i, 'of', count)
|
self._debug('getting book metadata. Done', i, 'of', count)
|
||||||
opcode, result = self._receive_from_client(print_debug_info=False)
|
opcode, result = self._receive_from_client(print_debug_info=False)
|
||||||
if opcode == 'OK':
|
if opcode == 'OK':
|
||||||
|
try:
|
||||||
if '_series_sort_' in result:
|
if '_series_sort_' in result:
|
||||||
del result['_series_sort_']
|
del result['_series_sort_']
|
||||||
book = self.json_codec.raw_to_book(result, SDBook, self.PREFIX)
|
book = self.json_codec.raw_to_book(result, SDBook, self.PREFIX)
|
||||||
@ -1320,6 +1321,9 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
book.set('_new_book_', True)
|
book.set('_new_book_', True)
|
||||||
else:
|
else:
|
||||||
self._set_known_metadata(book)
|
self._set_known_metadata(book)
|
||||||
|
except:
|
||||||
|
self._debug('exception retrieving metadata for book', result.get('title', 'Unknown'))
|
||||||
|
traceback.print_exc()
|
||||||
else:
|
else:
|
||||||
raise ControlError(desc='book metadata not returned')
|
raise ControlError(desc='book metadata not returned')
|
||||||
|
|
||||||
|
@ -17,9 +17,12 @@ from calibre import isbytestring
|
|||||||
# UTC. The returned date is also UTC
|
# UTC. The returned date is also UTC
|
||||||
def string_to_datetime(src):
|
def string_to_datetime(src):
|
||||||
from calibre.utils.date import parse_date
|
from calibre.utils.date import parse_date
|
||||||
if src == "None":
|
if src != "None":
|
||||||
return None
|
try:
|
||||||
return parse_date(src)
|
return parse_date(src)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
def datetime_to_string(dateval):
|
def datetime_to_string(dateval):
|
||||||
from calibre.utils.date import isoformat, UNDEFINED_DATE, local_tz
|
from calibre.utils.date import isoformat, UNDEFINED_DATE, local_tz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user