Bionus / imgbrd-grabber

Very customizable imageboard/booru downloader with powerful filenaming features.
https://www.bionus.org/imgbrd-grabber/
Apache License 2.0
2.58k stars 220 forks source link

fix: Danbooru.js script adjustments #3276

Closed Eddyall-1 closed 2 months ago

Eddyall-1 commented 3 months ago

Adjusted the Danbooru.js script to work with a self-hosted instance on Unraid. Also adjusted the rating to work by making them output the first letter in lower case which seems to be the accepted input as of now.

Bionus commented 2 months ago

Hello 👋

From my understanding, there are two changes in this PR, right?

  1. Send the rating again (seems like it was commented out) by fixing the casing
  2. Add a bunch of await new Promise(r => setTimeout(r, 1)); (looks like a 1ms sleep?) between each step of the image upload

1 sounds good, but not sure I understand the second one? Why do you need this for it to work on unraid?

Eddyall-1 commented 2 months ago

Exactly

  1. The line was commented out, likely due to the first character being set to upper case, which was incorrect with current setup. Making it lower case worked out.
  2. I not well versed enough in node to understand why, but while trying to debug the script I noticed that it started working when adding console output around the line of that block of code. Those lines were not executing without some break. I switch to timeout to reduce the impact on the log.

I didn't try with only a single timeout at the end of the block and realised just now maybe the issue is that the script was completing while the lines in that block were executing, killing their process before they were done.