mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
bc959778e4
commit
786729fa6f
@ -12,6 +12,7 @@ import os
|
||||
from calibre.devices.interface import BookList as BL
|
||||
from calibre.ebooks.metadata.book.base import Metadata
|
||||
from calibre.ebooks.metadata.book.json_codec import JsonCodec
|
||||
from calibre.utils.date import utcnow
|
||||
|
||||
class BookList(BL):
|
||||
|
||||
@ -26,8 +27,9 @@ class Book(Metadata):
|
||||
def __init__(self, storage_id, lpath, other=None):
|
||||
Metadata.__init__(self, _('Unknown'), other=other)
|
||||
self.storage_id, self.lpath = storage_id, lpath
|
||||
self.lpath = self.lpath.replace(os.sep, '/')
|
||||
self.lpath = self.path = self.lpath.replace(os.sep, '/')
|
||||
self.mtp_relpath = tuple([icu_lower(x) for x in self.lpath.split('/')])
|
||||
self.datetime = utcnow().timetuple()
|
||||
|
||||
def matches_file(self, mtp_file):
|
||||
return (self.storage_id == mtp_file.storage_id and
|
||||
|
@ -183,6 +183,16 @@ class MTP_DEVICE(BASE):
|
||||
size = stream.tell()
|
||||
stream.seek(0)
|
||||
self.put_file(storage, self.METADATA_CACHE, stream, size)
|
||||
|
||||
def sync_booklists(self, booklists, end_session=True):
|
||||
for bl in booklists:
|
||||
if getattr(bl, 'storage_id', None) is None:
|
||||
continue
|
||||
storage = self.filesystem_cache.storage(bl.storage_id)
|
||||
if storage is None:
|
||||
continue
|
||||
self.write_metadata_cache(storage, bl)
|
||||
|
||||
# }}}
|
||||
|
||||
def create_upload_path(self, path, mdata, fname):
|
||||
|
Loading…
x
Reference in New Issue
Block a user