mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a compile-time option to a device driver to scan for books from the root instead of the book_dir, while still respecting the book dir for sending books. Fixes problems on Sonys where ADE etc put books in the 'wrong' spot.
This commit is contained in:
parent
38d2bc0b00
commit
ef4278850e
@ -57,6 +57,7 @@ class PRS505(USBMS):
|
|||||||
MUST_READ_METADATA = True
|
MUST_READ_METADATA = True
|
||||||
SUPPORTS_USE_AUTHOR_SORT = True
|
SUPPORTS_USE_AUTHOR_SORT = True
|
||||||
EBOOK_DIR_MAIN = 'database/media/books'
|
EBOOK_DIR_MAIN = 'database/media/books'
|
||||||
|
SCAN_FROM_ROOT = True
|
||||||
|
|
||||||
ALL_BY_TITLE = _('All by title')
|
ALL_BY_TITLE = _('All by title')
|
||||||
ALL_BY_AUTHOR = _('All by author')
|
ALL_BY_AUTHOR = _('All by author')
|
||||||
|
@ -55,6 +55,8 @@ class USBMS(CLI, Device):
|
|||||||
METADATA_CACHE = 'metadata.calibre'
|
METADATA_CACHE = 'metadata.calibre'
|
||||||
DRIVEINFO = 'driveinfo.calibre'
|
DRIVEINFO = 'driveinfo.calibre'
|
||||||
|
|
||||||
|
SCAN_FROM_ROOT = False
|
||||||
|
|
||||||
def _update_driveinfo_record(self, dinfo, prefix, location_code, name=None):
|
def _update_driveinfo_record(self, dinfo, prefix, location_code, name=None):
|
||||||
if not isinstance(dinfo, dict):
|
if not isinstance(dinfo, dict):
|
||||||
dinfo = {}
|
dinfo = {}
|
||||||
@ -173,7 +175,10 @@ class USBMS(CLI, Device):
|
|||||||
ebook_dirs = [ebook_dirs]
|
ebook_dirs = [ebook_dirs]
|
||||||
for ebook_dir in ebook_dirs:
|
for ebook_dir in ebook_dirs:
|
||||||
ebook_dir = self.path_to_unicode(ebook_dir)
|
ebook_dir = self.path_to_unicode(ebook_dir)
|
||||||
ebook_dir = self.normalize_path( \
|
if self.SCAN_FROM_ROOT:
|
||||||
|
ebook_dir = self.normalize_path(prefix)
|
||||||
|
else:
|
||||||
|
ebook_dir = self.normalize_path( \
|
||||||
os.path.join(prefix, *(ebook_dir.split('/'))) \
|
os.path.join(prefix, *(ebook_dir.split('/'))) \
|
||||||
if ebook_dir else prefix)
|
if ebook_dir else prefix)
|
||||||
if not os.path.exists(ebook_dir): continue
|
if not os.path.exists(ebook_dir): continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user