mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
USBMS: Do not check for books in subdirs on devices that do not support subdirs.
This commit is contained in:
parent
1edbd88e73
commit
c06f894229
@ -57,12 +57,17 @@ class USBMS(Device):
|
||||
prefix = self._card_prefix if oncard else self._main_prefix
|
||||
ebook_dir = self.EBOOK_DIR_CARD if oncard else self.EBOOK_DIR_MAIN
|
||||
|
||||
# Get all books in all directories under the root ebook_dir directory
|
||||
for path, dirs, files in os.walk(os.path.join(prefix, ebook_dir)):
|
||||
# Filter out anything that isn't in the list of supported ebook
|
||||
# types
|
||||
for book_type in self.FORMATS:
|
||||
for filename in fnmatch.filter(files, '*.%s' % (book_type)):
|
||||
# Get all books in the ebook_dir directory
|
||||
if self.SUPPORTS_SUB_DIRS:
|
||||
for path, dirs, files in os.walk(os.path.join(prefix, ebook_dir)):
|
||||
# Filter out anything that isn't in the list of supported ebook types
|
||||
for book_type in self.FORMATS:
|
||||
for filename in fnmatch.filter(files, '*.%s' % (book_type)):
|
||||
bl.append(self.__class__.book_from_path(os.path.join(path, filename)))
|
||||
else:
|
||||
path = os.path.join(prefix, ebook_dir)
|
||||
for filename in os.listdir(path):
|
||||
if path_to_ext(filename) in self.FORMATS:
|
||||
bl.append(self.__class__.book_from_path(os.path.join(path, filename)))
|
||||
return bl
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user