stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
9.18k stars 791 forks source link

[Feature] GraphQL method to add fingerprint #4244

Closed scruffynerf closed 10 months ago

scruffynerf commented 11 months ago

With the recent changes to the schema turning fingerprints from specific fields into a single fingerprint item consisting of type and value, the potential to write a plugin and implement other fingerprints is ripe, but we lack any exposed ability to write them, only read them.

Adding some mutation in the form of file_add_fingerprint(id,[fingerprint]) would be wonderful, and allow all manner of new fingerprint uses. For example, phashing images, using SHA256 or other fingerprints tracking in other resources... essentially allowing scraping of all sorts, and not having to calculate the new hash 'on demand' repeatedly, but doing it one time (hook image_create_post for instance), and having it there ready to go.

As discussed in Discord, please add it to the backlog, @WithoutPants

stg-annon commented 11 months ago

I would explicitly disallow writing any stash managed fingerprints (OSHASH, MD5, ~PHASH~) with an error, any other type could be accepted

Edit: as WP mentioned writing PHASHs back from a remote device would be a useful use case and not critical to stash relocating files on the file system

WithoutPants commented 10 months ago

I would explicitly disallow writing any stash managed fingerprints (OSHASH, MD5, PHASH) with an error, any other type could be accepted

One possible use case for this is performing phashing on a seperate (more powerful) machine. I have done this myself and had to insert the fingerprints using SQL. An interface for doing this programatically would have been a lot simpler.

feederbox826 commented 10 months ago

I had plans for remote phash/md5/sha hashing. One method for validation (if absolutely necessary) I think would be a blind oshash confirmation since it is relatively light to calculate - either only allow adding another hash if oshash matches or apply it to a file based on oshash