Locate Changed Extensions

Recently I’ve been using tdarr to re-encode my library into a more space-efficient codec. (My library was taking up almost 8 TiB :sob:) For many files (e.g. avi, wmv) this results in the file extension being changed, which Stash picks up as a new scene, without any of your lovingly added metadata.

This plugin designed to detect & fix such cases in bulk.

Installation

This plugin can easily be installed via Stash’s in-built plugin manager. It has zero external dependencies and works great even in Docker installations of Stash.

How to use

  1. Make sure you have scanned your Stash and generated phashes. Make sure you HAVE NOT cleaned your library since your extensions changed. This plugin expects that the old scene (with good metadata but a missing file) still exists, and that the new scene (based on the new file extension) has been created.
  2. In Settings > Tasks, find the “Locate Changed Extensions” plugin and click “Fix scenes with changed extensions”

How it works

Detection criteria:

  • Looks for duplicate scenes (with High search accuracy)
  • Duplicate scene set must contain exactly 2 scenes
  • Each scene must contain exactly 1 file
  • The paths of the files associated with each scene must exactly match apart from the extension
  • The file associated with exactly one scene must no longer exist on disk

Operations:

  1. Deletes scene associated with existing file (since it’s assumed to be newly scanned)
  2. Assigns existing file to scene associated with missing file
  3. Makes existing file the primary file
  4. Deletes missing file from scene

Caveats

Due to limitations in Stash’s Embedded Plugins system, detecting whether a file actually exists on the disk is quite challenging. I found a way to do it, but it’s super janky and generates a lot of warnings in the log file.

1 Like