mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
SONY driver: Search for books on the device in all directories not just database/media/books. This can be turned off by customizing the SONY plugin in Preferences->Plugins
This commit is contained in:
commit
514ecbfce1
@ -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 = False
|
||||||
|
|
||||||
ALL_BY_TITLE = _('All by title')
|
ALL_BY_TITLE = _('All by title')
|
||||||
ALL_BY_AUTHOR = _('All by author')
|
ALL_BY_AUTHOR = _('All by author')
|
||||||
@ -87,18 +88,27 @@ class PRS505(USBMS):
|
|||||||
_('Set this option if you want the cover thumbnails to have '
|
_('Set this option if you want the cover thumbnails to have '
|
||||||
'the same aspect ratio (width to height) as the cover. '
|
'the same aspect ratio (width to height) as the cover. '
|
||||||
'Unset it if you want the thumbnail to be the maximum size, '
|
'Unset it if you want the thumbnail to be the maximum size, '
|
||||||
'ignoring aspect ratio.')
|
'ignoring aspect ratio.'),
|
||||||
|
_('Search for books in all folders') +
|
||||||
|
':::' +
|
||||||
|
_('Setting this option tells calibre to look for books in all '
|
||||||
|
'folders on the device and its cards. This permits calibre to '
|
||||||
|
'find books put on the device by other software and by '
|
||||||
|
'wireless download.')
|
||||||
]
|
]
|
||||||
EXTRA_CUSTOMIZATION_DEFAULT = [
|
EXTRA_CUSTOMIZATION_DEFAULT = [
|
||||||
', '.join(['series', 'tags']),
|
', '.join(['series', 'tags']),
|
||||||
False,
|
False,
|
||||||
False,
|
False,
|
||||||
|
True,
|
||||||
True
|
True
|
||||||
]
|
]
|
||||||
|
|
||||||
OPT_COLLECTIONS = 0
|
OPT_COLLECTIONS = 0
|
||||||
OPT_UPLOAD_COVERS = 1
|
OPT_UPLOAD_COVERS = 1
|
||||||
OPT_REFRESH_COVERS = 2
|
OPT_REFRESH_COVERS = 2
|
||||||
|
OPT_PRESERVE_ASPECT_RATIO = 3
|
||||||
|
OPT_SCAN_FROM_ROOT = 4
|
||||||
|
|
||||||
plugboard = None
|
plugboard = None
|
||||||
plugboard_func = None
|
plugboard_func = None
|
||||||
@ -147,11 +157,13 @@ class PRS505(USBMS):
|
|||||||
self.booklist_class.rebuild_collections = self.rebuild_collections
|
self.booklist_class.rebuild_collections = self.rebuild_collections
|
||||||
# Set the thumbnail width to the theoretical max if the user has asked
|
# Set the thumbnail width to the theoretical max if the user has asked
|
||||||
# that we do not preserve aspect ratio
|
# that we do not preserve aspect ratio
|
||||||
if not self.settings().extra_customization[3]:
|
if not self.settings().extra_customization[self.OPT_PRESERVE_ASPECT_RATIO]:
|
||||||
self.THUMBNAIL_WIDTH = 168
|
self.THUMBNAIL_WIDTH = 168
|
||||||
# Set WANTS_UPDATED_THUMBNAILS if the user has asked that thumbnails be
|
# Set WANTS_UPDATED_THUMBNAILS if the user has asked that thumbnails be
|
||||||
# updated on every connect
|
# updated on every connect
|
||||||
self.WANTS_UPDATED_THUMBNAILS = self.settings().extra_customization[2]
|
self.WANTS_UPDATED_THUMBNAILS = \
|
||||||
|
self.settings().extra_customization[self.OPT_REFRESH_COVERS]
|
||||||
|
self.SCAN_FROM_ROOT = self.settings().extra_customization[self.OPT_SCAN_FROM_ROOT]
|
||||||
|
|
||||||
def filename_callback(self, fname, mi):
|
def filename_callback(self, fname, mi):
|
||||||
if getattr(mi, 'application_id', None) is not None:
|
if getattr(mi, 'application_id', None) is not None:
|
||||||
|
@ -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,9 +175,13 @@ 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)
|
||||||
|
debug_print('USBMS: scan from root', self.SCAN_FROM_ROOT, ebook_dir)
|
||||||
if not os.path.exists(ebook_dir): continue
|
if not os.path.exists(ebook_dir): continue
|
||||||
# Get all books in the ebook_dir directory
|
# Get all books in the ebook_dir directory
|
||||||
if self.SUPPORTS_SUB_DIRS:
|
if self.SUPPORTS_SUB_DIRS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user