本文整理汇总了Python中calibre.devices.usbms.driver.USBMS.sync_booklists方法的典型用法代码示例。如果您正苦于以下问题:Python USBMS.sync_booklists方法的具体用法?Python USBMS.sync_booklists怎么用?Python USBMS.sync_booklists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.devices.usbms.driver.USBMS
的用法示例。
在下文中一共展示了USBMS.sync_booklists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sync_booklists
# 需要导入模块: from calibre.devices.usbms.driver import USBMS [as 别名]
# 或者: from calibre.devices.usbms.driver.USBMS import sync_booklists [as 别名]
def sync_booklists(self, booklists, end_session=True):
debug_print("PRST1: starting sync_booklists")
opts = self.settings()
if opts.extra_customization:
collections = [x.strip() for x in opts.extra_customization[self.OPT_COLLECTIONS].split(",")]
else:
collections = []
debug_print("PRST1: collection fields:", collections)
if booklists[0] is not None:
self.update_device_database(booklists[0], collections, None)
if len(booklists) > 1 and booklists[1] is not None:
self.update_device_database(booklists[1], collections, "carda")
USBMS.sync_booklists(self, booklists, end_session=end_session)
debug_print("PRST1: finished sync_booklists")
示例2: sync_booklists
# 需要导入模块: from calibre.devices.usbms.driver import USBMS [as 别名]
# 或者: from calibre.devices.usbms.driver.USBMS import sync_booklists [as 别名]
def sync_booklists(self, booklists, end_session=True):
debug_print('PRS505: started sync_booklists')
c = self.initialize_XML_cache()
blists = {}
for i in c.paths:
try:
if booklists[i] is not None:
blists[i] = booklists[i]
except IndexError:
pass
opts = self.settings()
if opts.extra_customization:
collections = [x.strip() for x in
opts.extra_customization[self.OPT_COLLECTIONS].split(',')]
else:
collections = []
debug_print('PRS505: collection fields:', collections)
pb = None
if self.plugboard_func:
pb = self.plugboard_func(self.__class__.__name__,
'device_db', self.plugboards)
debug_print('PRS505: use plugboards', pb)
c.update(blists, collections, pb)
c.write()
if opts.extra_customization[self.OPT_REFRESH_COVERS]:
debug_print('PRS505: uploading covers in sync_booklists')
for idx,bl in blists.items():
prefix = self._card_a_prefix if idx == 1 else \
self._card_b_prefix if idx == 2 \
else self._main_prefix
for book in bl:
try:
p = os.path.join(prefix, book.lpath)
self._upload_cover(os.path.dirname(p),
os.path.splitext(os.path.basename(p))[0],
book, p)
except:
debug_print('FAILED to upload cover',
prefix, book.lpath)
else:
debug_print('PRS505: NOT uploading covers in sync_booklists')
USBMS.sync_booklists(self, booklists, end_session=end_session)
debug_print('PRS505: finished sync_booklists')