CommunityScripts icon indicating copy to clipboard operation
CommunityScripts copied to clipboard

[renamerOnUpdate] Add a callback for custom logic for file name and path template

Open DuctTape42 opened this issue 2 years ago • 0 comments

renamerOnUpdate supports some limited conditional path and name template functionality (basically tag and studio templates). It would be nice if it supported an "advanced" use case where some python code could run to produce the correct templates.

In my case I have a few more complicated cases. I have a Download directory, and I leave stuff there for a 90 days (a convenient way to avoid duplicate downloads) After 90 days, I want to move everything that has been tagged to one of two Library directories. In my case I have a subset of my library saved so that it can be consumed by Kodi (using the Kodi metadata exporter). In that case the directories are by stashid. Otherwise they're organized by studio hierarchy.

I ended up implementing a version of this locally. @scruffynerf liked the idea, but felt like this is a "post rewrite" sort of feature (it also should be pulled out into a separate separate config). I'm filing this Issue so that we don't lose track of this idea after the major overhaul is done.

Other things I considered:

  • I used to do this manually by marking files older than X days as organized and then running renamerOnUpdate on organized files only. This was a drag because of limitations in the saved filters functionality (dates can't be relative, doesn't support more complex boolean expressions, etc).
  • Instead of a callback function, I thought about implementing this as an enhancement to tag_templates/studio_templates and p_tag_templates/p_studio_templates/p_path_templates. I thought about allowing lambdas as keys in those dicts. Then you could reuse most of the same configuration structure. It would also have a more clear fallback to the existing declarative configuration. It's something to consider as an alternative implementation.

DuctTape42 avatar Oct 16 '23 23:10 DuctTape42