Make scan_all optional in sony driver, with default True

This commit is contained in:
Charles Haley 2011-03-27 20:31:57 +01:00
parent ef4278850e
commit 199738861a
2 changed files with 16 additions and 4 deletions

View File

@ -57,7 +57,7 @@ class PRS505(USBMS):
MUST_READ_METADATA = True
SUPPORTS_USE_AUTHOR_SORT = True
EBOOK_DIR_MAIN = 'database/media/books'
SCAN_FROM_ROOT = True
SCAN_FROM_ROOT = False
ALL_BY_TITLE = _('All by title')
ALL_BY_AUTHOR = _('All by author')
@ -88,18 +88,27 @@ class PRS505(USBMS):
_('Set this option if you want the cover thumbnails to have '
'the same aspect ratio (width to height) as the cover. '
'Unset it if you want the thumbnail to be the maximum size, '
'ignoring aspect ratio.')
'ignoring aspect ratio.'),
_('Scan 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 = [
', '.join(['series', 'tags']),
False,
False,
True,
True
]
OPT_COLLECTIONS = 0
OPT_UPLOAD_COVERS = 1
OPT_REFRESH_COVERS = 2
OPT_PRESERVE_ASPECT_RATIO = 3
OPT_SCAN_FROM_ROOT = 4
plugboard = None
plugboard_func = None
@ -148,11 +157,13 @@ class PRS505(USBMS):
self.booklist_class.rebuild_collections = self.rebuild_collections
# Set the thumbnail width to the theoretical max if the user has asked
# 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
# Set WANTS_UPDATED_THUMBNAILS if the user has asked that thumbnails be
# 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):
if getattr(mi, 'application_id', None) is not None:

View File

@ -181,6 +181,7 @@ class USBMS(CLI, Device):
ebook_dir = self.normalize_path( \
os.path.join(prefix, *(ebook_dir.split('/'))) \
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
# Get all books in the ebook_dir directory
if self.SUPPORTS_SUB_DIRS: