Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client API: /get_files/paths/ #1539

Open
bbappserver opened this issue Apr 9, 2024 · 1 comment
Open

Client API: /get_files/paths/ #1539

bbappserver opened this issue Apr 9, 2024 · 1 comment
Labels

Comments

@bbappserver
Copy link
Contributor

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 #656

@GeorgeEBeresford
Copy link

GeorgeEBeresford commented May 12, 2024

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.

@Zweibach Zweibach added the system:api API related issues label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants