mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
455afaa08f
commit
07547628cc
@ -136,7 +136,7 @@ class USBMS(CLI, Device):
|
|||||||
def books(self, oncard=None, end_session=True):
|
def books(self, oncard=None, end_session=True):
|
||||||
from calibre.ebooks.metadata.meta import path_to_ext
|
from calibre.ebooks.metadata.meta import path_to_ext
|
||||||
|
|
||||||
debug_print ('USBMS: Fetching list of books from device. Device=',
|
debug_print('USBMS: Fetching list of books from device. Device=',
|
||||||
self.__class__.__name__,
|
self.__class__.__name__,
|
||||||
'oncard=', oncard)
|
'oncard=', oncard)
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class USBMS(CLI, Device):
|
|||||||
self.EBOOK_DIR_CARD_B if oncard == 'cardb' else \
|
self.EBOOK_DIR_CARD_B if oncard == 'cardb' else \
|
||||||
self.get_main_ebook_dir()
|
self.get_main_ebook_dir()
|
||||||
|
|
||||||
debug_print ('USBMS: dirs are:', prefix, ebook_dirs)
|
debug_print('USBMS: dirs are:', prefix, ebook_dirs)
|
||||||
|
|
||||||
# get the metadata cache
|
# get the metadata cache
|
||||||
bl = self.booklist_class(oncard, prefix, self.settings)
|
bl = self.booklist_class(oncard, prefix, self.settings)
|
||||||
@ -185,13 +185,13 @@ class USBMS(CLI, Device):
|
|||||||
if idx is not None:
|
if idx is not None:
|
||||||
bl_cache[lpath] = None
|
bl_cache[lpath] = None
|
||||||
if self.update_metadata_item(bl[idx]):
|
if self.update_metadata_item(bl[idx]):
|
||||||
#print 'update_metadata_item returned true'
|
# print 'update_metadata_item returned true'
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
if bl.add_book(self.book_from_path(prefix, lpath),
|
if bl.add_book(self.book_from_path(prefix, lpath),
|
||||||
replace_metadata=False):
|
replace_metadata=False):
|
||||||
changed = True
|
changed = True
|
||||||
except: # Probably a filename encoding error
|
except: # Probably a filename encoding error
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return changed
|
return changed
|
||||||
@ -202,11 +202,12 @@ class USBMS(CLI, Device):
|
|||||||
if self.SCAN_FROM_ROOT:
|
if self.SCAN_FROM_ROOT:
|
||||||
ebook_dir = self.normalize_path(prefix)
|
ebook_dir = self.normalize_path(prefix)
|
||||||
else:
|
else:
|
||||||
ebook_dir = self.normalize_path( \
|
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)
|
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 or self.SUPPORTS_SUB_DIRS_FOR_SCAN:
|
if self.SUPPORTS_SUB_DIRS or self.SUPPORTS_SUB_DIRS_FOR_SCAN:
|
||||||
# build a list of files to check, so we can accurately report progress
|
# build a list of files to check, so we can accurately report progress
|
||||||
@ -237,9 +238,9 @@ class USBMS(CLI, Device):
|
|||||||
need_sync = True
|
need_sync = True
|
||||||
del bl[idx]
|
del bl[idx]
|
||||||
|
|
||||||
debug_print('USBMS: count found in cache: %d, count of files in metadata: %d, need_sync: %s' % \
|
debug_print('USBMS: count found in cache: %d, count of files in metadata: %d, need_sync: %s' %
|
||||||
(len(bl_cache), len(bl), need_sync))
|
(len(bl_cache), len(bl), need_sync))
|
||||||
if need_sync: #self.count_found_in_bl != len(bl) or need_sync:
|
if need_sync: # self.count_found_in_bl != len(bl) or need_sync:
|
||||||
if oncard == 'cardb':
|
if oncard == 'cardb':
|
||||||
self.sync_booklists((None, None, bl))
|
self.sync_booklists((None, None, bl))
|
||||||
elif oncard == 'carda':
|
elif oncard == 'carda':
|
||||||
@ -272,7 +273,7 @@ class USBMS(CLI, Device):
|
|||||||
self.upload_cover(os.path.dirname(filepath),
|
self.upload_cover(os.path.dirname(filepath),
|
||||||
os.path.splitext(os.path.basename(filepath))[0],
|
os.path.splitext(os.path.basename(filepath))[0],
|
||||||
mdata, filepath)
|
mdata, filepath)
|
||||||
except: # Failure to upload cover is not catastrophic
|
except: # Failure to upload cover is not catastrophic
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user