[renamerOnUpdate] Add option to ignore the Path Length reduction. (#23)

* Update renamerOnUpdate.py

* Update config.py

* Update renamerOnUpdate.yml
This commit is contained in:
Belleyy 2022-01-16 00:08:27 +01:00 committed by GitHub
parent fe0f4d7256
commit ce347a029c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -63,8 +63,12 @@ prevent_title_performer = False
# Only rename 'Organized' scenes.
only_organized = False
# If the new path is over 240 characters, the plugin will try to reduce it. Set to True to ignore that.
ignore_path_length = False
# Field to remove if the path is too long. First in list will be removed then second then ... if length is still too long.
order_field = ["$video_codec", "$audio_codec", "$resolution", "$height", "$studio_family", "$studio", "$parent_studio","$performer"]
# Alternate way to show diff. Not useful at all.
alt_diff_display = False

View File

@ -252,13 +252,13 @@ filename_template = None
# READING CONFIG
PERFORMER_SPLITCHAR = config.performer_splitchar
PERFORMER_LIMIT = config.performer_limit
PERFORMER_IGNORE_MALE = config.performer_ignore_male
PREVENT_TITLE_PERF = config.prevent_title_performer
IGNORE_PATH_LENGTH = config.ignore_path_length
PROCESS_KILL = config.process_kill_attach
PROCESS_ALLRESULT = config.process_getall
UNICODE_USE = config.use_ascii
@ -385,7 +385,7 @@ new_path = current_path.rstrip(current_filename) + new_filename
# Trying to prevent error with long paths for Win10
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd
if len(new_path) > 240:
if len(new_path) > 240 and not IGNORE_PATH_LENGTH:
log.LogWarning("Resulting Path is too long ({})...".format(len(new_path)))
for word in ORDER_SHORTFIELD:
if word not in filename_template:

View File

@ -1,7 +1,7 @@
name: renamerOnUpdate
description: Rename filename based on a template.
url: https://github.com/stashapp/CommunityScripts
version: 1.3
version: 1.4
exec:
- python
- "{pluginDir}/renamerOnUpdate.py"