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

Support for Web API that doesn't provide each image download url #164

Open
xx790 opened this issue Jun 3, 2023 · 2 comments
Open

Support for Web API that doesn't provide each image download url #164

xx790 opened this issue Jun 3, 2023 · 2 comments
Assignees

Comments

@xx790
Copy link

xx790 commented Jun 3, 2023

What I'm trying to achieve:

I want to use certain Web API as the source of my background pictures.
(I want to use SingleEach mode with Web API - I hope this is possible!)
This API has an endpoint to get all image IDs or hashes in arrays.
Then, a separate endpoint URL has to be made with an ID or hash.

What is currently possible with ClaudiaIDE:

image

API Endpoint is expected to contain download URLs.
URLs are expected to be found under certain JSON key - it is unclear to me whether this key can be an array.

What can be done to enable my use case:

  • Rename API Endpoint to Image search endpoint;
  • Make sure JSON Key can understand arrays as well as single values, numbers as well as strings. Consider supporting something like XPath/JSONPath to allow more specific queries;
  • Add Image download endpoint with a template parameter to substitute values extracted with JSON Key from the search response. Something like http://example.com/api/download_image?id={};
  • Image download endpoint can be set to just the template placeholder like {} by default to achieve current behavior.

Practical example:

The API: https://hydrusnetwork.github.io/hydrus/developer_api.html#searching_and_fetching_files

It can return a response like this:

{
  "hashes" : [
    "1b04c4df7accd5a61c5d02b36658295686b0abfebdc863110e7d7249bba3f9ad",
    "fe416723c731d679aa4d20e9fd36727f4a38cd0ac6d035431f0f452fad54563f",
    "b53505929c502848375fbc4dab2f40ad4ae649d34ef72802319a348f81b52bad"
  ],
  "file_ids" : [125462, 4852415, 123]
}

And then a separate URL have to be made either with ID or a hash.
There is no way to obtain a random image with a single API call as far as I'm aware.

@buchizo
Copy link
Owner

buchizo commented Jun 3, 2023

support SingleEach

I will consider it.

Rename API Endpoint to Image search endpoint;

I not change it, because this property mean is not image search url.

Make sure JSON Key can understand arrays as well as single values, numbers as well as strings. Consider supporting something like XPath/JSONPath to allow more specific queries;

I will consider it. However If I implement it even if, I use this property for specific single image url.

Add Image download endpoint with a template parameter to substitute values extracted with JSON Key from the search response. Something like http://example.com/api/download_image?id={};
Image download endpoint can be set to just the template placeholder like {} by default to achieve current behavior.

This feature require is simple behavior. If you want to that spec, you can prepare converter server. Anyway CluaidaIDE's this feature can support api call and use one image url from response.

@xx790
Copy link
Author

xx790 commented Jun 3, 2023

I considered making a converter server. But I don't like the idea of maintaining a server for that one simple task.

I think I will be doing a separate extension for what I need.

While I'm here, I can suggest another idea I also considered:

  • For SlideShow Directory Path - look for images in subfolders recursively (always or as an option).

This is more limited than what I need, but it is still an improvement.

@buchizo buchizo self-assigned this Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants