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
27f43a7506
@ -1208,8 +1208,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
{'canStream':True,
|
{'canStream':True,
|
||||||
'canScan':True,
|
'canScan':True,
|
||||||
'willUseCachedMetadata': self.client_can_use_metadata_cache,
|
'willUseCachedMetadata': self.client_can_use_metadata_cache,
|
||||||
'supportsSync': (self.is_read_sync_col or
|
'supportsSync': (bool(self.is_read_sync_col) or
|
||||||
self.is_read_date_sync_col)})
|
bool(self.is_read_date_sync_col))})
|
||||||
bl = CollectionsBookList(None, self.PREFIX, self.settings)
|
bl = CollectionsBookList(None, self.PREFIX, self.settings)
|
||||||
if opcode == 'OK':
|
if opcode == 'OK':
|
||||||
count = result['count']
|
count = result['count']
|
||||||
@ -1309,8 +1309,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
self._call_client('SEND_BOOKLISTS', {'count': count,
|
self._call_client('SEND_BOOKLISTS', {'count': count,
|
||||||
'collections': coldict,
|
'collections': coldict,
|
||||||
'willStreamMetadata': True,
|
'willStreamMetadata': True,
|
||||||
'supportsSync': (self.is_read_sync_col or
|
'supportsSync': (bool(self.is_read_sync_col) or
|
||||||
self.is_read_date_sync_col)},
|
bool(self.is_read_date_sync_col))},
|
||||||
wait_for_response=False)
|
wait_for_response=False)
|
||||||
|
|
||||||
if count:
|
if count:
|
||||||
@ -1320,8 +1320,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
opcode, result = self._call_client(
|
opcode, result = self._call_client(
|
||||||
'SEND_BOOK_METADATA',
|
'SEND_BOOK_METADATA',
|
||||||
{'index': i, 'count': count, 'data': book,
|
{'index': i, 'count': count, 'data': book,
|
||||||
'supportsSync': (self.is_read_sync_col or
|
'supportsSync': (bool(self.is_read_sync_col) or
|
||||||
self.is_read_date_sync_col)},
|
bool(self.is_read_date_sync_col))},
|
||||||
print_debug_info=False,
|
print_debug_info=False,
|
||||||
wait_for_response=False)
|
wait_for_response=False)
|
||||||
|
|
||||||
@ -1469,7 +1469,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
|
|
||||||
@synchronous('sync_lock')
|
@synchronous('sync_lock')
|
||||||
def synchronize_with_db(self, db, id_, book):
|
def synchronize_with_db(self, db, id_, book):
|
||||||
from calibre.utils.date import parse_date, UNDEFINED_DATE
|
from calibre.utils.date import parse_date, is_date_undefined
|
||||||
def show_message(message):
|
def show_message(message):
|
||||||
self._call_client("DISPLAY_MESSAGE",
|
self._call_client("DISPLAY_MESSAGE",
|
||||||
{'messageKind': self.MESSAGE_SHOW_TOAST,
|
{'messageKind': self.MESSAGE_SHOW_TOAST,
|
||||||
@ -1514,8 +1514,12 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
|
|
||||||
is_changed = book.get('_is_read_changed_', None);
|
is_changed = book.get('_is_read_changed_', None);
|
||||||
is_read = book.get('_is_read_', None)
|
is_read = book.get('_is_read_', None)
|
||||||
|
|
||||||
# This returns UNDEFINED_DATE if the value is None
|
# This returns UNDEFINED_DATE if the value is None
|
||||||
is_read_date = parse_date(book.get('_last_read_date_', None));
|
is_read_date = parse_date(book.get('_last_read_date_', None));
|
||||||
|
if is_date_undefined(is_read_date):
|
||||||
|
is_read_date = None
|
||||||
|
|
||||||
value_to_return = None
|
value_to_return = None
|
||||||
|
|
||||||
if is_changed == 2:
|
if is_changed == 2:
|
||||||
@ -1524,8 +1528,9 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
# through to the normal sync situation below, otherwise the calibre
|
# through to the normal sync situation below, otherwise the calibre
|
||||||
# value wins. The orig_* values are set to None to force the normal
|
# value wins. The orig_* values are set to None to force the normal
|
||||||
# sync code to actually sync because the values are different
|
# sync code to actually sync because the values are different
|
||||||
orig_is_read_date = UNDEFINED_DATE
|
orig_is_read_date = None
|
||||||
orig_is_read = None
|
orig_is_read = None
|
||||||
|
|
||||||
if is_read is None:
|
if is_read is None:
|
||||||
calibre_val = db.new_api.field_for(self.is_read_sync_col,
|
calibre_val = db.new_api.field_for(self.is_read_sync_col,
|
||||||
id_, default_value=None)
|
id_, default_value=None)
|
||||||
@ -1537,10 +1542,10 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
'to', calibre_val)
|
'to', calibre_val)
|
||||||
value_to_return = set()
|
value_to_return = set()
|
||||||
|
|
||||||
if is_read_date == UNDEFINED_DATE:
|
if is_read_date is None:
|
||||||
calibre_val = db.new_api.field_for(self.is_read_date_sync_col,
|
calibre_val = db.new_api.field_for(self.is_read_date_sync_col,
|
||||||
id_, default_value=None)
|
id_, default_value=None)
|
||||||
if calibre_val != UNDEFINED_DATE:
|
if not is_date_undefined(calibre_val):
|
||||||
book.set('_force_send_metadata_', True)
|
book.set('_force_send_metadata_', True)
|
||||||
self._debug('special update is_read_date', book.get('title', 'huh?'),
|
self._debug('special update is_read_date', book.get('title', 'huh?'),
|
||||||
'to', calibre_val)
|
'to', calibre_val)
|
||||||
@ -1575,7 +1580,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
try:
|
try:
|
||||||
if is_read_date != orig_is_read_date:
|
if is_read_date != orig_is_read_date:
|
||||||
self._debug('standard update book is_read_date', book.get('title', 'huh?'),
|
self._debug('standard update book is_read_date', book.get('title', 'huh?'),
|
||||||
'to', is_read_date)
|
'to', is_read_date, 'was', orig_is_read_date)
|
||||||
if self.is_read_date_sync_col:
|
if self.is_read_date_sync_col:
|
||||||
changed_books |= db.new_api.set_field(self.is_read_date_sync_col,
|
changed_books |= db.new_api.set_field(self.is_read_date_sync_col,
|
||||||
{id_: is_read_date})
|
{id_: is_read_date})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user