mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Wireless driver: Speed up deleting of multiple books
This commit is contained in:
commit
d5c26cfa46
@ -827,6 +827,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
self._debug('Device can stream metadata', self.client_can_stream_metadata)
|
||||
self.client_can_receive_book_binary = result.get('canReceiveBookBinary', False)
|
||||
self._debug('Device can receive book binary', self.client_can_stream_metadata)
|
||||
self.client_can_delete_multiple = result.get('canDeleteMultipleBooks', False)
|
||||
self._debug('Device can delete multiple books', self.client_can_delete_multiple)
|
||||
|
||||
self.client_device_kind = result.get('deviceKind', '')
|
||||
self._debug('Client device kind', self.client_device_kind)
|
||||
@ -1124,6 +1126,16 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
else:
|
||||
self._debug()
|
||||
|
||||
if self.client_can_delete_multiple:
|
||||
new_paths = []
|
||||
for path in paths:
|
||||
new_paths.append(self._strip_prefix(path))
|
||||
opcode, result = self._call_client('DELETE_BOOK', {'lpaths': new_paths})
|
||||
for i in range(0, len(new_paths)):
|
||||
opcode, result = self._receive_from_client(False)
|
||||
self._debug('removed book with UUID', result['uuid'])
|
||||
self._debug('removed', len(new_paths), 'books')
|
||||
else:
|
||||
for path in paths:
|
||||
# the path has the prefix on it (I think)
|
||||
path = self._strip_prefix(path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user