From 4ef38e686cfb2f67575eaf7470d9a188bea95fb2 Mon Sep 17 00:00:00 2001 From: xxyzz Date: Sat, 4 Feb 2023 15:57:28 +0800 Subject: [PATCH] Ignore AppleDouble files on ebook device When macOS sends file to e-reader device, it also sends a AppleDouble format file has the same name with "._" prefix. Ignore these files so they won't be added to the device metadata file. --- src/calibre/devices/usbms/driver.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index 0fc1e9ebd7..c398aaad8c 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -239,6 +239,9 @@ class USBMS(CLI, Device): def update_booklist(filename, path, prefix): changed = False + # Ignore AppleDouble files + if filename.startswith("._"): + return False if path_to_ext(filename) in all_formats and self.is_allowed_book_file(filename, path, prefix): try: lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2]