stash icon indicating copy to clipboard operation
stash copied to clipboard

[API] Allow deleting primary files

Open RyanCrossby opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. At the moment, the Stash API do not allow deleting a file that is marked as primary for a Scene. This obviously makes sense, to prevent accidental file deletions and what not. Also, I understand Stash doesn't work particularly great on fileless scenes, but since it cannot prevent the file from being deleted from the file system, it is inevitable that it also has work on these scenes too (at least partially).
I might have an unusual use case: I use stash for organizational purposed and to keep track of metadata, but I don't have a big hard drive and I have to periodically delete already watched files. I'd still want to retain the scene metadata tho-.
I have made a simple script that periodically tag deletable scenes via GraphQL , the next step would be to delete those files as well. However, I'm being blocked by the APIs, and have to resort to manual deletions on the file system.

Describe the solution you'd like Expand the GraphQL deleteFiles mutation to allow deleting a scene primary file (making the scene fileless). Could be disabled by default, requiring an additional flag to unlock, if needed.

Describe alternatives you've considered The current alternatives that I see are:

  • manual file system deletion, searching each file one by one, which is a really long error-prone process
  • renaming files of deletable scenes using some automation (eg, custom script or the renamerOnUpdate plugin), and then manually deleting all files with a given prefix / name (what I'm currently using right now)
  • writing a Python plugin (AFAIK, JS plugins have no access to the file system API, correct me if I'm wrong) that interact with file system APIs

Additional context In general, I feel like fileless scenes could have better support (eg, removing the movie player and resizing the left column accordingly, if there are no files to play). At that point, I feel the Delete File button on the UI could also be enabled on the primary file.

RyanCrossby avatar Jul 14 '24 10:07 RyanCrossby