Add ability for device to do a version check for syncing.

This commit is contained in:
Charles Haley 2014-03-02 17:41:39 +01:00
parent 91adef995f
commit 011a71efe9

View File

@ -988,7 +988,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
'currentLibraryUUID': library_uuid, 'currentLibraryUUID': library_uuid,
'pubdateFormat': tweaks['gui_pubdate_display_format'], 'pubdateFormat': tweaks['gui_pubdate_display_format'],
'timestampFormat': tweaks['gui_timestamp_display_format'], 'timestampFormat': tweaks['gui_timestamp_display_format'],
'lastModifiedFormat': tweaks['gui_last_modified_display_format']}) 'lastModifiedFormat': tweaks['gui_last_modified_display_format'],
'calibre_version': numeric_version})
if opcode != 'OK': if opcode != 'OK':
# Something wrong with the return. Close the socket # Something wrong with the return. Close the socket
# and continue. # and continue.
@ -1087,7 +1088,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
self.is_read_sync_col = result.get('isReadSyncCol', None) self.is_read_sync_col = result.get('isReadSyncCol', None)
self._debug('Device is_read sync col', self.is_read_sync_col) self._debug('Device is_read sync col', self.is_read_sync_col)
self.is_read_date_sync_col = result.get('isReadDateSyncCol', False) self.is_read_date_sync_col = result.get('isReadDateSyncCol', None)
self._debug('Device is_read_date sync col', self.is_read_date_sync_col) self._debug('Device is_read_date sync col', self.is_read_date_sync_col)
if password: if password:
@ -1207,7 +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': True}) 'supportsSync': (self.is_read_sync_col or
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']
@ -1307,7 +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': True}, 'supportsSync': (self.is_read_sync_col or
self.is_read_date_sync_col)},
wait_for_response=False) wait_for_response=False)
if count: if count:
@ -1316,7 +1319,9 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
self._set_known_metadata(book) self._set_known_metadata(book)
opcode, result = self._call_client( opcode, result = self._call_client(
'SEND_BOOK_METADATA', 'SEND_BOOK_METADATA',
{'index': i, 'count': count, 'data': book, 'supportsSync': True}, {'index': i, 'count': count, 'data': book,
'supportsSync': (self.is_read_sync_col or
self.is_read_date_sync_col)},
print_debug_info=False, print_debug_info=False,
wait_for_response=False) wait_for_response=False)