forked from Github/Axter-Stash
Updates to plugins RenameFile and DupFileManager
RenameFile Plugin Changes ### 0.5.6 - Fixed bug with studio getting the studio ID instead of the name of the studio in rename process. - Improved performance by having code get all required scene details in one call to stash. - To remove UI clutter, move rarely used options (performerAppendEnable, studioAppendEnable, tagAppendEnable, & fileRenameViaMove) to renamefile_settings.py - Change options (performerAppendEnable, studioAppendEnable, tagAppendEnable) to default to True (enabled) DupFileManager Plugin Changes ### 0.2.2 - Added dropdown menu logic to Advance Menu and reports. - Added Graylist deletion option to Advance Menu. - Report option to clear all flags from report. - Report option to clear all (_DuplicateMarkForDeletion_?) tag from all scenes. - Report option to delete from Stash DB all scenes with missing files in file system. - Added popup tag list to report which list all tags associated with scene. - Added popup performer list to report which list all performers associated with scene. - Added popup gallery list to report which list all galleries associated with scene. - Added popup group list to report which list all groups associated with scene. - After merging tags in report, the report gets updated with the merged scene metadata. - Added graylist deletion option to [**Advance Duplicate File Deletion Menu**]. - Added pinklist option to Settings->Plugins->Plugins and to [**Advance Duplicate File Deletion Menu**] - The pinklist is only used with the [**Advance Duplicate File Deletion Menu**], and it's **NOT** used in the primary process to selected candidates for deletion. - Advance Menu now works with non-tagged scenes that are in the current report.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# RenameFile: Ver 0.5.5 (By David Maisonave)
|
||||
# RenameFile: Ver 0.5.6 (By David Maisonave)
|
||||
RenameFile is a [Stash](https://github.com/stashapp/stash) plugin. Starting version 0.5.5, user can add the current title to the title input field by clicking on the current title. Also, the Stash database gets updated directly instead of running a scan task as long as the database is version 68.
|
||||
|
||||
- The plugin allows user to rename one scene at a time by editing the **[Title]** field and then clicking **[Save]**.
|
||||
|
||||
@@ -42,12 +42,8 @@ exitMsg = "Change success!!"
|
||||
# **********************************************************************
|
||||
# ----------------------------------------------------------------------
|
||||
settings = {
|
||||
"performerAppend": False,
|
||||
"studioAppend": False,
|
||||
"tagAppend": False,
|
||||
"yRenameEvenIfTitleEmpty": False,
|
||||
"z_keyFIeldsIncludeInFileName": False,
|
||||
"zafileRenameViaMove": False,
|
||||
"zfieldKeyList": DEFAULT_FIELD_KEY_LIST,
|
||||
"zmaximumTagKeys": 12,
|
||||
"zseparators": DEFAULT_SEPERATOR,
|
||||
@@ -114,7 +110,7 @@ if endpointHost == "0.0.0.0":
|
||||
endpoint = f"{stash.JSON_INPUT['server_connection']['Scheme']}://{endpointHost}:{stash.JSON_INPUT['server_connection']['Port']}/graphql"
|
||||
|
||||
# stash.Trace(f"(endpoint={endpoint})")
|
||||
move_files = stash.pluginSettings["zafileRenameViaMove"]
|
||||
move_files = stash.Setting("fileRenameViaMove")
|
||||
fieldKeyList = stash.pluginSettings["zfieldKeyList"] # Default Field Key List with the desired order
|
||||
if not fieldKeyList or fieldKeyList == "":
|
||||
fieldKeyList = DEFAULT_FIELD_KEY_LIST
|
||||
@@ -150,7 +146,7 @@ def getPerformers(scene, title):
|
||||
title = title.lower()
|
||||
results = ""
|
||||
for performer in scene['performers']:
|
||||
name = stash.find_performer(performer['id'])['name']
|
||||
name = performer['name']
|
||||
stash.Trace(f"performer = {name}")
|
||||
if not include_keyField_if_in_name:
|
||||
if name.lower() in title:
|
||||
@@ -162,7 +158,7 @@ def getPerformers(scene, title):
|
||||
def getGalleries(scene, title):
|
||||
results = ""
|
||||
for gallery in scene['galleries']:
|
||||
name = stash.find_gallery(gallery['id'])['title']
|
||||
name = gallery = stash.find_gallery(gallery['id'])['title']
|
||||
stash.Trace(f"gallery = {name}")
|
||||
if not include_keyField_if_in_name:
|
||||
if name.lower() in title:
|
||||
@@ -175,10 +171,9 @@ def getTags(scene, title):
|
||||
title = title.lower()
|
||||
results = ""
|
||||
for tag in scene['tags']:
|
||||
tag_details = stash.find_tag(int(tag['id']))
|
||||
name = tag_details['name']
|
||||
name = tag['name']
|
||||
stash.Trace(f"tag = {name}")
|
||||
if excludeIgnoreAutoTags == True and tag_details['ignore_auto_tag'] == True:
|
||||
if excludeIgnoreAutoTags == True and tag['ignore_auto_tag'] == True:
|
||||
stash.Trace(f"Skipping tag name '{name}' because ignore_auto_tag is True.")
|
||||
continue
|
||||
if not include_keyField_if_in_name:
|
||||
@@ -231,8 +226,12 @@ def form_filename(original_file_stem, scene_details):
|
||||
|
||||
for key in fieldKeyList:
|
||||
if key == 'studio':
|
||||
if stash.pluginSettings["studioAppend"]:
|
||||
studio_name = scene_details.get('code', {})
|
||||
if stash.Setting("studioAppendEnable"):
|
||||
studio = scene_details.get('studio')
|
||||
if studio != None:
|
||||
studio_name = studio.get('name')
|
||||
else:
|
||||
studio_name = None
|
||||
stash.Trace(f"(studio_name={studio_name})")
|
||||
if studio_name:
|
||||
studio_name += POSTFIX_STYLES.get('studio')
|
||||
@@ -251,7 +250,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
else:
|
||||
filename_parts.append(title)
|
||||
elif key == 'performers':
|
||||
if stash.pluginSettings["performerAppend"]:
|
||||
if stash.Setting("performerAppendEnable"):
|
||||
performers = getPerformers(scene_details, title)
|
||||
if performers != "":
|
||||
performers += POSTFIX_STYLES.get('performers')
|
||||
@@ -261,7 +260,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
else:
|
||||
filename_parts.append(performers)
|
||||
elif key == 'date':
|
||||
scene_date = scene_details.get('date', '')
|
||||
scene_date = scene_details.get('date')
|
||||
if scene_date:
|
||||
scene_date += POSTFIX_STYLES.get('date')
|
||||
if WRAPPER_STYLES.get('date'):
|
||||
@@ -269,8 +268,10 @@ def form_filename(original_file_stem, scene_details):
|
||||
if scene_date not in title:
|
||||
filename_parts.append(scene_date)
|
||||
elif key == 'resolution':
|
||||
width = str(scene_details.get('files', [{}])[0].get('width', '')) # Convert width to string
|
||||
height = str(scene_details.get('files', [{}])[0].get('height', '')) # Convert height to string
|
||||
# width = str(scene_details.get('files', [{}])[0].get('width', '')) # Convert width to string
|
||||
# height = str(scene_details.get('files', [{}])[0].get('height', '')) # Convert height to string
|
||||
width = str(scene_details['files'][0]['width'])
|
||||
height = str(scene_details['files'][0]['height'])
|
||||
if width and height:
|
||||
resolution = width + POSTFIX_STYLES.get('width_height_seperator') + height + POSTFIX_STYLES.get('resolution')
|
||||
if WRAPPER_STYLES.get('resolution'):
|
||||
@@ -278,7 +279,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
if resolution not in title:
|
||||
filename_parts.append(resolution)
|
||||
elif key == 'width':
|
||||
width = str(scene_details.get('files', [{}])[0].get('width', '')) # Convert width to string
|
||||
width = str(scene_details['files'][0]['width'])
|
||||
if width:
|
||||
width += POSTFIX_STYLES.get('width')
|
||||
if WRAPPER_STYLES.get('width'):
|
||||
@@ -286,7 +287,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
if width not in title:
|
||||
filename_parts.append(width)
|
||||
elif key == 'height':
|
||||
height = str(scene_details.get('files', [{}])[0].get('height', '')) # Convert height to string
|
||||
height = str(scene_details['files'][0]['height'])
|
||||
if height:
|
||||
height += POSTFIX_STYLES.get('height')
|
||||
if WRAPPER_STYLES.get('height'):
|
||||
@@ -294,7 +295,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
if height not in title:
|
||||
filename_parts.append(height)
|
||||
elif key == 'video_codec':
|
||||
video_codec = scene_details.get('files', [{}])[0].get('video_codec', '').upper() # Convert to uppercase
|
||||
video_codec = scene_details['files'][0]['video_codec'].upper() # Convert to uppercase
|
||||
if video_codec:
|
||||
video_codec += POSTFIX_STYLES.get('video_codec')
|
||||
if WRAPPER_STYLES.get('video_codec'):
|
||||
@@ -302,7 +303,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
if video_codec not in title:
|
||||
filename_parts.append(video_codec)
|
||||
elif key == 'frame_rate':
|
||||
frame_rate = str(scene_details.get('files', [{}])[0].get('frame_rate', '')) + 'FPS' # Convert to string and append ' FPS'
|
||||
frame_rate = str(scene_details['files'][0]['frame_rate']) + 'FPS' # Convert to string and append ' FPS'
|
||||
if frame_rate:
|
||||
frame_rate += POSTFIX_STYLES.get('frame_rate')
|
||||
if WRAPPER_STYLES.get('frame_rate'):
|
||||
@@ -319,7 +320,7 @@ def form_filename(original_file_stem, scene_details):
|
||||
filename_parts.append(galleries)
|
||||
stash.Trace(f"(galleries={galleries})")
|
||||
elif key == 'tags':
|
||||
if stash.pluginSettings["tagAppend"]:
|
||||
if stash.Setting("tagAppendEnable"):
|
||||
tags = getTags(scene_details, title)
|
||||
if tags != "":
|
||||
tags += POSTFIX_STYLES.get('tag')
|
||||
@@ -343,7 +344,8 @@ def form_filename(original_file_stem, scene_details):
|
||||
def rename_scene(scene_id):
|
||||
global exitMsg
|
||||
POST_SCAN_DELAY = 3
|
||||
scene_details = stash.find_scene(scene_id)
|
||||
fragment = 'id title performers {name} tags {id name ignore_auto_tag} studio {name} galleries {id} files {id path width height video_codec frame_rate} date'
|
||||
scene_details = stash.find_scene(scene_id, fragment)
|
||||
stash.Trace(f"(scene_details={scene_details})")
|
||||
if not scene_details:
|
||||
stash.Error(f"Scene with ID {scene_id} not found.")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: RenameFile
|
||||
description: Renames video (scene) file names when the user edits the [Title] field located in the scene [Edit] tab.
|
||||
version: 0.5.5
|
||||
version: 0.5.6
|
||||
url: https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/RenameFile
|
||||
ui:
|
||||
css:
|
||||
@@ -8,18 +8,6 @@ ui:
|
||||
javascript:
|
||||
- renamefile.js
|
||||
settings:
|
||||
performerAppend:
|
||||
displayName: Append Performers
|
||||
description: Enable to append performers name to file name when renaming a file. Requires performers to be included in [Key Fields] list, which by default it is included.
|
||||
type: BOOLEAN
|
||||
studioAppend:
|
||||
displayName: Append Studio
|
||||
description: Enable to append studio name to file name when renaming a file. Requires studio to be included in [Key Fields] list, which by default it is included.
|
||||
type: BOOLEAN
|
||||
tagAppend:
|
||||
displayName: Append Tags
|
||||
description: Enable to append tag names to file name when renaming a file. Requires tags to be included in [Key Fields] list, which by default it is included.
|
||||
type: BOOLEAN
|
||||
yRenameEvenIfTitleEmpty:
|
||||
displayName: Empty Title Rename
|
||||
description: If enable, rename files even if TITLE field is empty.
|
||||
@@ -28,10 +16,6 @@ settings:
|
||||
displayName: Include Existing Key Field
|
||||
description: Enable to append performer, tags, studios, & galleries even if name already exists in the original file name.
|
||||
type: BOOLEAN
|
||||
zafileRenameViaMove:
|
||||
displayName: Move Instead of Rename
|
||||
description: Enable to move file instead of rename file. (Not recommended for Windows OS)
|
||||
type: BOOLEAN
|
||||
zfieldKeyList:
|
||||
displayName: Key Fields
|
||||
description: '(Default=title,performers,studio,tags) Define key fields to use to format the file name. This is a comma seperated list, and the list should be in the desired format order. For example, if the user wants the performers name before the title, set the performers name first. Example:"performers,title,tags". This is an example of user adding height:"title,performers,tags,height" Here''s an example using all of the supported fields: "title,performers,tags,studio,galleries,resolution,width,height,video_codec,frame_rate,date".'
|
||||
|
||||
@@ -49,6 +49,14 @@ config = {
|
||||
"max_filename_length": 255,
|
||||
# Exclude tags with ignore_auto_tag set to True
|
||||
"excludeIgnoreAutoTags": True,
|
||||
# Enable to append performers name to file name when renaming a file. Requires performers to be included in [Key Fields] list, which by default it is included.
|
||||
"performerAppendEnable": True,
|
||||
# Enable to append studio name to file name when renaming a file. Requires studio to be included in [Key Fields] list, which by default it is included.
|
||||
"studioAppendEnable": True,
|
||||
# Enable to append tag names to file name when renaming a file. Requires tags to be included in [Key Fields] list, which by default it is included.
|
||||
"tagAppendEnable": True,
|
||||
# Enable to move file instead of rename file. (Not recommended for Windows OS)
|
||||
"fileRenameViaMove": False,
|
||||
|
||||
# handleExe is for Windows only.
|
||||
# In Windows, a file can't be renamed if the file is opened by another process.
|
||||
|
||||
6
plugins/RenameFile/version_history/README.md
Normal file
6
plugins/RenameFile/version_history/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
##### This page was added starting on version 0.5.6 to keep track of newly added features between versions.
|
||||
### 0.5.6
|
||||
- Fixed bug with studio getting the studio ID instead of the name of the studio in rename process.
|
||||
- Improved performance by having code get all required scene details in one call to stash.
|
||||
- To remove UI clutter, move rarely used options (performerAppendEnable, studioAppendEnable, tagAppendEnable, & fileRenameViaMove) to renamefile_settings.py
|
||||
- Change options (performerAppendEnable, studioAppendEnable, tagAppendEnable) to default to True (enabled)
|
||||
Reference in New Issue
Block a user