Client API: `/get_files/paths/`
I want to be able to resolve hashes int their absolute paths.
GET /get_files/file
Will serve a file like HTTP, but that means hydrus has to spend cycles sending me the file which is particularly inconvenient when it is under load, especially if I will be accessing many files multiple times for analysis purposes. In that case giving me file contents is best left to the OS. Since files in hydrus are WORM, it makes sense that I should be able to just get the path of any hash on file.
This operation would best be done in bulk, so I would like this request and response pair Note:Technically get request should not contain a body, but if you feel a GET is more suited to this that may work better although strict HTTP clients might be unhappy.
POST /get_files/paths
Content-Type: application/json
[
{ "hash":"some_sha"},
{ "hash":"some_sha2"}
]
Content-Type: application/json
Comment: I would expect my array to come back in the same order
[
{ "hash":"some_sha","path":"/abs/path/to/storage"},
{ "hash":"some_sha2","path":"/abs/path/to/storage"}
]
@floogulinc https://github.com/hydrusnetwork/hydrus/issues/656
While you're waiting for this, I found a way to do this. The actual files are stored in "db/client_files/f{x}/{y}{z}". replace {x} with the first 2 characters of the hash (found in the metadata), {y} with the whole hash and {z} with the file extension and you'll have your file. E.g. c3a018dee04729ed3cfb5ded3f7c9f6a1b45c82541eef7e95b3249cbc05adf1f.jpg will be found at "db/client_files/f74/74a1c5bc6db004be0e05cdd84d07c843a54f93de2c540d6bc7b20f1384061893.jpg"
The thumbnail is similar but it's stored at db/client_files/t{x}/{y}.thumbnail (I used a virtual directory as the application I was using was MVC and I didn't want to use a FileContentResult to read a 6GB video file just to return it as a byte array)
Hope that helps.