Blacksuan19 / plasma-wallpaper-wallhaven-reborn

Wallhaven wallpaper plugin for plasma 6
GNU General Public License v3.0
12 stars 1 forks source link

Multiple keywords support? #3

Closed Yasand123 closed 1 month ago

Yasand123 commented 2 months ago

This is such an awesome piece of software. It works really nicely with nice QoL features. However I couldn't help but notice that there's no way to enter multiple keywords as there's only one field. The way multiple keywords would work is to randomly pick 1 entry from the list and use that as the search query to pull new wallpapers.

So for example. I want "gaming", and I want "nature", and "space". Currently, I can only pick one. But it would be nice if I can add all of these keywords in a list and the software would pick one randomly when refreshing the wallpaper.

Blacksuan19 commented 1 month ago

You can already do multiple keywords in the same text field, just separate them by a space

Yasand123 commented 1 month ago

Maybe I am doing something wrong then? I have batman car landscape space in the field, but it says "No wallpapers found", but if I enter each word separately (one word at a time), there's gonna be wallpapers. So that made me think it treats the entire thing as one string even though it's space-separated.

Edit, maybe it does treat them as separate keywords, but it uses "and" instead of "or", meaning it looks for images that contain all of these keywords together. But if that's the case then this is not what I want, I'm asking for an "or" behavior. Meaning, I want it to randomly pick wallpapers of batman, cars, landscapes, or space. If that makes sense.

Blacksuan19 commented 1 month ago

This appears to be a limitation of the wallhaven API, there's no way to do "or" with multiple tags, it only allows "and" and "not" operations when using multiple keywords. Check the API spec here https://wallhaven.cc/help/api

Yasand123 commented 1 month ago

I wonder if that can be done locally even before you send the keywords to the API? You make the software randomly pick one field and then send the contents of the field it picked to the API. Each field has its own "and"/"not" keywords. This way you don't need an "and" operation at the API level.

It should be possible in theory, but if the implementation is difficult or out of scope, then you shouldn't worry about it, the software still works nicely as is.

Blacksuan19 commented 1 month ago

That's a good idea, I'll see what I can do

Blacksuan19 commented 1 month ago

I realized the current API behavior is actually weird and quite unusual, even I thought it would choose one of the several tags given rather than search for something that has all tags, I will make this the default behavior since it makes more sense, I doubt many people search for images with multiple tags, that's just way too specific.

Yasand123 commented 1 month ago

That's awesome, and yeah I think this behavior makes more sense to most people. I'll test it when I get the chance and report back if there's any issues.

Thank you!