本文整理汇总了Python中calibre.devices.usbms.driver.USBMS.delete_single_book方法的典型用法代码示例。如果您正苦于以下问题:Python USBMS.delete_single_book方法的具体用法?Python USBMS.delete_single_book怎么用?Python USBMS.delete_single_book使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.devices.usbms.driver.USBMS
的用法示例。
在下文中一共展示了USBMS.delete_single_book方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_single_book
# 需要导入模块: from calibre.devices.usbms.driver import USBMS [as 别名]
# 或者: from calibre.devices.usbms.driver.USBMS import delete_single_book [as 别名]
def delete_single_book(self, path):
try:
tp = self.thumbpath_from_filepath(path)
if tp:
try:
os.remove(tp)
except EnvironmentError as err:
if err.errno != errno.ENOENT:
prints(u'Failed to delete thumbnail for {!r} at {!r} with error: {}'.format(path, tp, err))
except Exception:
import traceback
traceback.print_exc()
USBMS.delete_single_book(self, path)
示例2: delete_single_book
# 需要导入模块: from calibre.devices.usbms.driver import USBMS [as 别名]
# 或者: from calibre.devices.usbms.driver.USBMS import delete_single_book [as 别名]
def delete_single_book(self, path):
if path.replace('\\', '/').endswith('.sdr/assets/metadata.kfx'):
kfx_path = get_kfx_path(path)
if DEBUG:
prints('Kindle driver: Attempting to delete kfx: %r -> %r' % (path, kfx_path))
if os.path.exists(kfx_path):
os.unlink(kfx_path)
sdr_path = kfx_path.rpartition('.')[0] + '.sdr'
if os.path.exists(sdr_path):
shutil.rmtree(sdr_path)
try:
os.removedirs(os.path.dirname(kfx_path))
except Exception:
pass
else:
return USBMS.delete_single_book(self, path)