You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting 'Max Pages' has a minimum accepted value of 1, and when setting to 1 page the final url it generates to search has the parameter pid=1. However the first page should be pid=0.
This causes the extension to never be able to find the first 100 images for any tag searched.
This is a problem when the tags searched returns less than 100 images (such as some artist tags, character tags and more obscure general tags).
Also, when using the ComfyUI node version of the extension I didn't find any way to set 'Max Pages', which causes the search to frequently fail.
In addition to that, I'd like to suggest an alternative:
Instead of manually inputting 'Max Pages', make an initial search with pid=100 and lookup the number of search results ('count' as seen below).
Made some changes that fixes the bug of the first page never being considered in the randomization.
Also made changes to fix another bug, when the number of results is less than the POST_AMOUNT = 100.
In a separate second commit:
Modified get_data functions to loop once if the number of search results are fewer than max_pages*POST_AMOUNT (100 results per page).
The second time the get_data function runs it uses a max_pages value small enough to return the results.
With these changes, it should all work correctly even with few results, as long as there is 1 search result.
I made the changes in 2 separate commits since the loop once implementation was the best I could come up with, in case you have a better or cleaner way of doing it.
When setting 'Max Pages' has a minimum accepted value of 1, and when setting to 1 page the final url it generates to search has the parameter pid=1. However the first page should be pid=0.
This causes the extension to never be able to find the first 100 images for any tag searched.
This is a problem when the tags searched returns less than 100 images (such as some artist tags, character tags and more obscure general tags).
Also, when using the ComfyUI node version of the extension I didn't find any way to set 'Max Pages', which causes the search to frequently fail.
In addition to that, I'd like to suggest an alternative:
Instead of manually inputting 'Max Pages', make an initial search with pid=100 and lookup the number of search results ('count' as seen below).
Using the count number you can calculate 'Max Pages' based on how many results per page there is.
The text was updated successfully, but these errors were encountered: