| Summary | Adds configured Tags, Performers and/or Studio to all newly scanned Scenes, Images and Galleries. | |
| Repository | https://github.com/stashapp/CommunityScripts/tree/main/plugins/defaultDataForPath | |
| Source URL | https://stashapp.github.io/CommunityScripts/stable/index.yml | |
| Install | How to install a plugin? |
Define default tags/performers/studio for Scenes, Images, and Galleries by file path.
Big thanks to @WithoutPants - I based this entire script off of yours (markerTagToScene) and learned about Stash plugins during the process ![]()
Requirements
- Stash
Installation
- Download the whole folder âdefaultDataForPathâ (defaultDataForPath.js, defaultDataForPath.yml)
- Place it in your plugins folder
- Reload plugins (Settings > Plugins)
- Default Data For Path (1.0) should appear.
Usage
- This plugin will execute on Tasks->Scan. Any new file added to Stash will be created with the specified data if configured.
Configuration
- Edit jsonData array. Refer to Examples.
Notes
- Remember to escape file paths!
- Note this script only works on NEWLY created Scenes/Images/Galleries. To run on existing content, the content will need to be removed from Stash and then rescanned.
- There is NO validation of tags/performers/studios being performed. They must exist in Stash and be spelled exactly the same to work. These values are not updated when they are updated in Stash. They will have to manually be configured. If there is a mismatch, an error will be logged and the affected file will not have any default data added. The Scan task will continue to execute however.
- If you misconfigure the script, the Task->Scan will complete and files will be created, but you can remove those files from Stash, fix the script, and try again.
- I recommend using VS Code but any text editor should do. I especially recommend an editor with collapse functionality as your config JSON grows.
- This requires a decent bit of manual effort and verbosity to configure, but only needs to be maintained after that.
- This may slow down your Task->Scan. This script is probably sloppily written, I was not sober when I wrote it, and havenât looked much at it since it works ÂŻ\_(ă)_/ÂŻ
Examples
Here is a simple config Object. It defines data for any Scene/Image/Gallery found within the paths listed (it includes all subfolders). Matching files will be assigned Studio âBrazzersâ and Tag âDefault_Data_For_Path_Taggedâ assuming that Studio and Tag exist in Stash and are spelled this way.
ânameâ is optional and not used by the script. Feel free to include it for the purposes of organization.
âpathsâ is optional and defines what file paths the current Object config should apply to. If it is not included, then no files will be matched to this config, unless âchildrenâ is used, in which case, those files in âchildrenâ will be matched to this config. See next example.
âstudioâ is optional and defines a Studio to apply to file matches. The Studio must exist in Stash and be spelled the same.
âtagsâ is optional and defines Tags to apply to file matches. The Tags must exist in Stash and be spelled the same.
var jsonData = [
{
"name": "OPTIONAL NAME - NOT USED IN SCRIPT",
"paths": [
"C:\\Users\\UserName\\Desktop\\NOTPORN\\Brazzers",
"D:\\SecretStorage\\Porn\\Brazzers"
],
"studio": "Brazzers",
"tags": [
"Default_Data_For_Path_Tagged"
]
}
];
This config introduces a new concept. Note the âInstagram Rootâ config object has no paths. It defines a studio and then children. This means all child config object of this will recieve the Studio âInstagramâ (it will overwrite any child config object studio definitions if different). You may also specify Performers and Tags in this way, those will be appended to child config objects definitions. See the 'Celebritiesâ config object is used in a similar way to add the tag 'PERFORMER - Celebrityâ to its underlying children (which also recieve the Instagram studio as it is their ancestor). It saves you from having to add the tag to each config object seperately and allows for more logical config groupings to be created.
If you also add a âpathsâ value to âInstagram Rootâ, then the data specified on âInstagram Rootâ config object will be applied to files in that path as well. Data from children will not be carried over. For example, âPornHub Rootâ applies studio PornHub to all files in âC:\Users\UserName\Desktop\Pornhubâ, and has children objects with more specific config. Instagram Root does not have such a paths specification. So a file in path âC:\Users\UserName\Desktop\Pornhub\SweetBunnyâ will have Studio PornHub added while a file in âC:\Users\UserName\Desktop\Instagram\Kylie Jennerâ will not have Studio Instagram added.
So say a file is scanned that has file path âC:\Users\UserName\Desktop\Instagram\alexisfawx\video1.mp4â. The data added will be:
Studio: Instagram - because the âAlexis Fawxâ Config object is a descendant of the Instagram config object, and the scanned file matches âAlexis Fawxâ Config object paths.
Tag: ORGANIZED - Unorganized - because the scanned file matches âDefault Tag - Matches all scanned filesâ Config object paths.
Tag: PERFORMER - Pornstar - because the âAlexis Fawxâ Config object is a child of the Pornstars config object, and the scanned file matches âAlexis Fawxâ Config object paths.
Tag: PERFORMER - Caucasian - beacause the scanned file matches âAlexis Fawxâ Config object paths.
Tag: PERFORMER - Fake Tits - beacause the scanned file matches âAlexis Fawxâ Config object paths.
Performer: Alexis Fawx - beacause the scanned file matches âAlexis Fawxâ Config object paths.
var jsonData = [
{
"name": "Default Tag - Matches all scanned files",
"paths": [
""
],
"tags": [
"ORGANIZED - Unorganized"
]
},
{
"name": "Instagram Root",
"studio": "Instagram",
"children": [
{
"name": "Celebrities",
"tags": [
"PERFORMER - Celebrity"
],
"children": [
{
"name": "Kim Kardashian",
"paths": [
"C:\\Users\\UserName\\Desktop\\Instagram\\kimkardashian"
],
"performers": [
"Kim Kardashian"
],
"tags": [
"PERFORMER - Armenian",
"PERFORMER - Big Ass"
]
},
{
"name": "Katy Perry",
"paths": [
"C:\\Users\\UserName\\Desktop\\Instagram\\katyperry"
],
"performers": [
"Katy Perry"
],
"tags": [
"PERFORMER - Caucasian,
"PERFORMER - Big Tits"
]
}
]
},
{
"name": "Pornstars",
"tags": [
"PERFORMER - Pornstar
],
"children": [
{
"name": "Alexis Fawx",
"paths": [
"C:\\Users\\UserName\\Desktop\\Instagram\\alexisfawx"
],
"performers": [
"Alexis Fawx"
],
"tags": [
"PERFORMER - Caucasian",
"PERFORMER - Fake Tits"
]
}
]
}
]
},
{
"name": "PornHub Root",
"paths": [
"C:\\Users\\UserName\\Desktop\\PornHub"
]
"studio": "PornHub",
"children": [
(etc...)
]
}
];