Skip to content

Commit ce2bc8e

Browse files
authored
Merge pull request #196 from Drazzilb08/master
Merge to Dev
2 parents 013fc3e + 6ee1a3a commit ce2bc8e

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

config/config.sample.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ poster_renamerr:
173173
log_level: info
174174
dry_run: false
175175
sync_posters: true # <- This will run sync_gdrive before renaming
176-
action_type: copy # <- Options: copy, move
176+
action_type: copy # <- Options: copy, move, hardlink, symlink (Note: 'hardlink' and 'symlink' require "source_dirs" and "destination_dir" to be on the same filesystem)
177177
asset_folders: false # <- This will copy the folder structure of the source_dir to the destination_dir, this MUST be the same as you use in Plex-Meta-Manager
178178
print_only_renames: false # <- This will print the renames to the log, but will not actually rename anything
179179
# This will integrate border_replacer with poster_renamerr, set this to true if you want to use them at the same time (no need to schedule border_replacer)

extra-scripts/exclude-file.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ com.plexapp.plugins.library.db-*
2323
*/logs
2424
*/Cache/Transcode/*
2525
*/Cache/PhotoTranscoder/*
26-
.DS_Store
26+
.DS_Store
27+
*/@eaDir
28+
Thumbs.db

modules/poster_renamerr.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,26 @@ def rename_files(matched_assets, script_config, logger):
313313
new_file_path = os.path.join(dest_dir, new_file_name)
314314

315315
# Check if the new file path already exists
316-
if os.path.isfile(new_file_path):
316+
if os.path.lexists(new_file_path):
317317
existing_file = os.path.join(dest_dir, new_file_name)
318-
# Check if the existing file is the same as the new file True = same, False = different
319-
if not filecmp.cmp(file, existing_file):
320-
if file_name != new_file_name:
321-
messages.append(f"{file_name} -renamed-> {new_file_name}")
322-
discord_messages.append(f"{new_file_name}")
323-
else:
324-
if not print_only_renames:
325-
messages.append(f"{file_name} -not-renamed-> {new_file_name}")
318+
try:
319+
# Check if the existing file is the same as the new file True = same, False = different
320+
if not filecmp.cmp(file, existing_file):
321+
if file_name != new_file_name:
322+
messages.append(f"{file_name} -renamed-> {new_file_name}")
326323
discord_messages.append(f"{new_file_name}")
324+
else:
325+
if not print_only_renames:
326+
messages.append(f"{file_name} -not-renamed-> {new_file_name}")
327+
discord_messages.append(f"{new_file_name}")
328+
if not dry_run:
329+
if action_type in ["hardlink", "symlink"]:
330+
os.remove(new_file_path)
331+
process_file(file, new_file_path, action_type, logger)
332+
except FileNotFoundError:
333+
# Handle the case where existing_file is a broken symlink
327334
if not dry_run:
335+
os.remove(new_file_path)
328336
process_file(file, new_file_path, action_type, logger)
329337
else:
330338
if file_name != new_file_name:

schemas/config-schema.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
},
312312
"action_type": {
313313
"type": "string",
314-
"pattern": "^copy|move$"
314+
"pattern": "^copy|move|hardlink|symlink$"
315315
},
316316
"asset_folders": {
317317
"type": "boolean"
@@ -512,12 +512,16 @@
512512
"tag_name": {
513513
"type": "string"
514514
},
515-
"ignore_tag":
516-
{
515+
"ignore_tag": {
517516
"type": "string"
518517
},
519518
"unattended": {
520519
"type": "boolean"
520+
},
521+
"season_monitored_threshold": {
522+
"type": "number",
523+
"minimum": 0,
524+
"maximum": 1
521525
}
522526
},
523527
"required": [

0 commit comments

Comments
 (0)