From 4078bb467b08a56abef328929e58c24d4a466379 Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Mon, 3 May 2021 08:11:47 +0200 Subject: [PATCH 1/5] Add, allwo camera info in filename --- elodie/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index 92d7807e..c0778871 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -168,7 +168,7 @@ def get_file_name(self, metadata): place_name, ) break - elif part in ('album', 'extension', 'title'): + elif part in ('album', 'extension', 'title', 'camera_make', 'camera_model'): if metadata[part]: this_value = re.sub(self.whitespace_regex, '-', metadata[part].strip()) break From d01e1c8443c696abd25e96259822e7b081b18c14 Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Wed, 5 May 2021 10:40:00 +0200 Subject: [PATCH 2/5] update whitespace_regex mask --- elodie/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index c0778871..3b895d0f 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -42,7 +42,7 @@ def __init__(self): # It captures some additional characters like the unicode checkmark \u2713. # See build failures in Python3 here. # https://travis-ci.org/jmathai/elodie/builds/483012902 - self.whitespace_regex = '[ \t\n\r\f\v]+' + self.whitespace_regex = '[ \t\n\r\f\v,/]+' # Instantiate a plugins object self.plugins = Plugins() From c178ad2cce70398b70f328cd0cd0d82846bb8b9c Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Tue, 19 Jul 2022 10:34:05 +0200 Subject: [PATCH 3/5] ignore OSError on set utime --- elodie/filesystem.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index 3b895d0f..65878fcd 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -588,7 +588,10 @@ def process_file(self, _file, destination, media, **kwargs): # Set the utime based on what the original file contained # before we made any changes. # Then set the utime on the destination file based on metadata. - os.utime(_file, (stat_info_original.st_atime, stat_info_original.st_mtime)) + try: + os.utime(_file, (stat_info_original.st_atime, stat_info_original.st_mtime)) + except OSError: + pass self.set_utime_from_metadata(metadata, dest_path) db = Db() From fc1c7b9e8768842057821bff8a9b8ee2691f8a0b Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Tue, 19 Jul 2022 17:18:03 +0200 Subject: [PATCH 4/5] escape filenames --- elodie/filesystem.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index 65878fcd..fd862d20 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -218,6 +218,8 @@ def get_file_name(self, metadata): name, ) + name = re.sub('[\?\*\0:|<>]', '_', name) + config = load_config() if('File' in config and 'capitalization' in config['File'] and config['File']['capitalization'] == 'upper'): From 0d32be67cd02f0758030d651c16b9b7c9287a807 Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Tue, 19 Jul 2022 17:18:35 +0200 Subject: [PATCH 5/5] ignore issues with copy text --- elodie/media/text.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elodie/media/text.py b/elodie/media/text.py index 4e3c6bbf..f81b6cbb 100644 --- a/elodie/media/text.py +++ b/elodie/media/text.py @@ -179,7 +179,10 @@ def write_metadata(self, **kwargs): # Create an _original copy just as we do with exiftool # This is to keep all file processing logic in line with exiftool - copy2(source, source + '_original') + try: + copy2(source, source + '_original') + except: + return if has_metadata: # Update the first line of this file in place