mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
359813d7eb
commit
f59ac23c9c
@ -30,6 +30,11 @@ class MTP_DEVICE(BASE):
|
|||||||
DRIVEINFO = 'driveinfo.calibre'
|
DRIVEINFO = 'driveinfo.calibre'
|
||||||
CAN_SET_METADATA = []
|
CAN_SET_METADATA = []
|
||||||
|
|
||||||
|
def open(self, devices, library_uuid):
|
||||||
|
self.current_library_uuid = library_uuid
|
||||||
|
BASE.open(self, devices, library_uuid)
|
||||||
|
|
||||||
|
# Device information {{{
|
||||||
def _update_drive_info(self, storage, location_code, name=None):
|
def _update_drive_info(self, storage, location_code, name=None):
|
||||||
import uuid
|
import uuid
|
||||||
f = storage.find_path((self.DRIVEINFO,))
|
f = storage.find_path((self.DRIVEINFO,))
|
||||||
@ -55,10 +60,6 @@ class MTP_DEVICE(BASE):
|
|||||||
self.put_file(storage, self.DRIVEINFO, BytesIO(raw), len(raw))
|
self.put_file(storage, self.DRIVEINFO, BytesIO(raw), len(raw))
|
||||||
self.driveinfo = dinfo
|
self.driveinfo = dinfo
|
||||||
|
|
||||||
def open(self, devices, library_uuid):
|
|
||||||
self.current_library_uuid = library_uuid
|
|
||||||
BASE.open(self, devices, library_uuid)
|
|
||||||
|
|
||||||
def get_device_information(self, end_session=True):
|
def get_device_information(self, end_session=True):
|
||||||
self.report_progress(1.0, _('Get device information...'))
|
self.report_progress(1.0, _('Get device information...'))
|
||||||
self.driveinfo = {}
|
self.driveinfo = {}
|
||||||
@ -84,7 +85,9 @@ class MTP_DEVICE(BASE):
|
|||||||
return
|
return
|
||||||
self._update_drive_info(self.filesystem_cache.storage(sid),
|
self._update_drive_info(self.filesystem_cache.storage(sid),
|
||||||
location_code, name=name)
|
location_code, name=name)
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# Get list of books from device, with metadata {{{
|
||||||
def books(self, oncard=None, end_session=True):
|
def books(self, oncard=None, end_session=True):
|
||||||
from calibre.devices.mtp.books import JSONCodec
|
from calibre.devices.mtp.books import JSONCodec
|
||||||
from calibre.devices.mtp.books import BookList, Book
|
from calibre.devices.mtp.books import BookList, Book
|
||||||
@ -176,6 +179,7 @@ class MTP_DEVICE(BASE):
|
|||||||
size = stream.tell()
|
size = stream.tell()
|
||||||
stream.seek(0)
|
stream.seek(0)
|
||||||
self.put_file(storage, self.METADATA_CACHE, stream, size)
|
self.put_file(storage, self.METADATA_CACHE, stream, size)
|
||||||
|
# }}}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
dev = MTP_DEVICE(None)
|
dev = MTP_DEVICE(None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user