Bionus / imgbrd-grabber

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

Download Tags metadata as txt or other formats #2332

Closed pxssy closed 3 years ago

pxssy commented 3 years ago

Is your feature request related to a problem? Please describe

Another booru downloader had the functionality to also save tags in a txt named identically to the image, along with the image. With some code, this can be a rather crude but very useful way to search for tagged images. Currently there's no way to actually do this unless you included tags into the names of the images, which is quite unwieldly to say the least, being that most booru just tag as greedily as possible.

Describe the solution you'd like

Rip tags from the post while downloading image, save as txt, or maybe a more high tech format in sqlite. All i know is that without even the txt, no metadata is saved currently, and when the post is deleted or booru goes down, all gets lost.

Describe alternatives you've considered

Using back that downloader, but its been abandoned for sometime, i doubt it will be fixed.

Additional context

For example https://danbooru.donmai.us/posts/3582852

the txt file could just be a simple one like

feng_ze :o 1girl ahoge azur_lane bag baltimore_(after-school_ace)_(azur_lane) baltimore_(azur_lane) black_choker black_neckwear black_skirt braid breasts brown_cardigan brown_footwear brown_hair buttons cardigan cardigan_around_waist choker cleavage clothes_around_waist collarbone collared_shirt duffel_bag feng_ze full_body hand_up holding holding_phone kneehighs large_breasts loafers looking_at_viewer miniskirt necktie official_alternate_costume official_art open_mouth phone pleated_skirt school_bag school_uniform shirt shirt_tucked_in shoes short_hair short_sleeves skindentation skirt solo standing thighs transparent_background turret white_legwear white_shirt yellow_eyes

sstabeler commented 3 years ago

You can actually do this already. Check the options for the "seperate log files" options.

It's also now possible to save the image metadata to the image file, albeit that's a little imperfect, given that if the image is overwritten, so is the metadata. (When I get the chance, I plan to poke around in the code to see if that can be changed)

kdoshere commented 3 years ago

Image

rating:%rating% %all:includenamespace,excludenamespace=general,unsafe,separator=\n%

9c2b4e671a14fbda251ec2cf7371d0d7.png.txt

rating:safe 1girl :o ahoge bag black_choker black_neckwear black_skirt braid breasts brown_cardigan brown_footwear brown_hair buttons cardigan cardigan_around_waist choker cleavage clothes_around_waist collarbone collared_shirt duffel_bag full_body hand_up holding holding_phone kneehighs large_breasts loafers looking_at_viewer miniskirt necktie official_alternate_costume open_mouth phone pleated_skirt school_bag school_uniform shirt shirt_tucked_in shoes short_hair short_sleeves skindentation skirt solo standing thighs transparent_background turret white_legwear white_shirt yellow_eyes artist:fengze character:baltimore(after-schoolace)(azurlane) character:baltimore(azur_lane) copyright:azur_lane meta:official_art

pxssy commented 3 years ago

Oh i didn't know!

So if i already have the images downloaded, will these tags be retroactively downloaded, or do i have to get both image and tags again? (Edit after testing, it seems like i do have to redownload the images for it to "log" the downloads. Is there any way around this?)

Additionally, i'm looking at this right now, https://bionus.github.io/imgbrd-grabber/docs/filename.html

What does %all% include? Does it always include ambiguous tag stuff like artist, character, copyright, meta, and things that aren't exactly tags like score, mpixels, height, width?

author and authorid refer to the artist or the uploader to the boorus? I didn't include them my naming scheme because they appear to be empty strings currently.

Bionus commented 3 years ago

Seems like the question was already answered, so I'll close the ticket 😄

What does %all% include? Does it always include ambiguous tag stuff like artist, character, copyright, meta, and things that aren't exactly tags like score, mpixels, height, width?

Only tags. Meta-data is not included.

author and authorid refer to the artist or the uploader to the boorus? I didn't include them my naming scheme because they appear to be empty strings currently.

Author is the uploader. You can use %source% if you want to investigate an image's actual source.

YukiSakuma commented 3 years ago

Bumping this cause I have some questions, how do you save tags character:baltimore_(after-school_ace)(azur_lane) but without the "character:" or any "x:" part?

And how do you use comma as separator? I keep trying separator=\\,% but in the text file the separator is a double backslash instead 6+girls\\angry\\aqua eyes\\aqua hair\\aqua neckwear\\

sstabeler commented 3 years ago

drop the includenamespace bit if you don't want the namespace, as for the seperator, you want seperator:,%

YukiSakuma commented 3 years ago

drop the includenamespace bit if you don't want the namespace, as for the seperator, you want seperator:,%

Thanks but the comma one won't work here's the output and the code 6+girlsangryaqua eyesaqua hairaqua

%all:,excludenamespace=general,unsafe,separator=,% but for some reason using semicolon as a separator works but I need to use comma Am using v7.5.1

Bionus commented 3 years ago

, is a special character in options since it is used as a separator for the options themselves ("%all:general,unsafe%"). You need to prefix it with ^ to use it directly.

Something like this should work:

%all:,excludenamespace=general,unsafe,separator=^,%

The same thing applies to % and =.