Files
CommunityScripts/plugins/renamerOnUpdate
Belley fd44b90da1 [Renamer Hook] Fix log exit (#13)
* Update renamerOnUpdate.py
* Update renamerOnUpdate.yml
* using with open()
2021-09-28 09:59:02 +10:00
..
2021-06-23 09:49:49 +10:00

SQLITE Renamer for Stash

Using metadata from your stash to rename your file.

Requirement

  • Python (Tested on Python v3.9.1 64bit, Win10)
  • Request Module
  • Stash
  • Windows 10 ? (No idea if this work for all OS)
  • Log.py

Usage

  • Everytime you will update a scene, it will check/update your filename.
  • Replace things between Line 354 - 370
  • You can set a path for STASH_LOGFILE, so you will have a file with all changes that the plugins made. Could be useful to revert.

Filename template

Available: $date $performer $title $studio $height $parent_studio

The script will replace these field with the data from the database. Exemple:

Template Result
$title Her Fantasy Ball.mp4
$title $height Her Fantasy Ball 1080p.mp4
$date $title 2016-12-29 Her Fantasy Ball.mp4
$date $performer - $title [$studio] 2016-12-29 Eva Lovia - Her Fantasy Ball [Sneaky Sex].mp4
$parent_studio $date $performer - $title RealityKings 2016-12-29 Eva Lovia - Her Fantasy Ball.mp4

Note:

  • A regex will remove illegal character for Windows.
  • If you path will be more than 240 characters, the script will try to reduce it. It will only use Date + Title.
  • If your height of the video is 2160/4320, it will be replace by 4k/8k else it will be height + p (240p,720p,1080p...)
  • If the scene contains more than 3 performers, $performer will be replace by nothing.

Change scenes by tags

If you want differents formats by tags:

if scene_info.get("tags"):
    for tag in scene_info["tags"]:
        if tag["name"] == "WHOAAAA_TAGS1":
            result_template = "$date $performer - $title [$studio]"
        if tag["name"] == "WHOAAAA_TAGS2":
            result_template = "$title"
        if result_template:
            break

If you only want change 1 tag:

if scene_info.get("tags"):
    for tag in scene_info["tags"]:
        if tag["name"] == "WHOAAAA_TAGS1":
            result_template = "$date $performer - $title [$studio]"
        if result_template:
            break

If you want to change by studio:

if scene_info.get("studio"):
    if scene_info["studio"]["name"] == "STUDIO NAME":
        result_template = "$date $performer - $title [$studio]"
    if scene_info["studio"]["name"] == "STUDIO NAME 2":
        result_template = "$parent_studio $date $performer - $title"

Change all scenes

result_template = "$date $title"