Bionus / imgbrd-grabber

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

Adding text on metadata as differentiators for keywords (IPTC / Exiftool ) #3063

Closed Reberebe closed 7 months ago

Reberebe commented 8 months ago

Is not really a bug or problem, but after looking in the documentation for metadata I couldn't find it

I'm looking to finally re-tag my gallery from system.properties to IPTC keywords but after looking for which fields to use, I was thinking that I could save myself the trouble and just use the Keywords for General - Copyright - Characters but I would like to add (parenthesis) and [Brackets]

Describe the solution you'd like For example if a picture is from a series that has sequels and what not, I would like the saved tags to be

[Copyright Title 1];[Copyright title n];(Character 1);(Character n);general_tag1;General_Tagn;

this way I could have a way to filter and visualize from how many series' and how many characters are in the gallery

I'm thinking on using: XMP:Creator %artist:separator=;% XMP-dc:Description %md5% IPTC:Keywords %all:separator=;% (Currently %all% but as mentioned would like to separated to something like %all:separator=;% %copyright:separator=;% %character:separator=;%, using brackets for each IP/Copyright title, and parenthesis for each character) I hope is possible and I'm not asking for something too silly Thanks in advance for your help

Bionus commented 8 months ago

It's not really possible "as-is", but if you use something like

(%character:separator=);(%)

It would generate:

(character1);(character2)

However, if there's no character it'll give

()

So you could use a conditional to not show anything when there's no character:

<%character%?(%character:separator=);(%)>

Or the short-hand:

<(%character:separator=);(%)>

Note that I didn't try any of those, but in theory that should work.

Reberebe commented 8 months ago

Thanks for your help, I just tried it, On the first attempt it worked, but after saving an image without character tags, and then saving another with character tags it stopped adding metadata all together in the Keywords field. Need to do further testing once I'm out of work.

I also tried the conditional with copyright Noticed that it only picks one copyright rather than whatever number of series are tagged, what could I use for it to add all the copyright tags? or if it can't be, is there a way to use a conditional for it to only use the parent copyright? like if there's Pokemon_(Series); Pokemon_XD; Pokemon_Whatever; it only picks the parent or one with most entries?

Also, and sorry to further bother you, how could I join the conditional for copyright + Conditional for Characters + %general:separator=;% So I can have [Copyrights];(characters); general; on the keywords field?

Really appreciate your help

Bionus commented 8 months ago

Noticed that it only picks one copyright rather than whatever number of series are tagged,

You need to make sure that you have the setting set to "Keep" all in the options (IIRC in "Options > Save > Tags > Copyright"). By default some tags only return 1.

or if it can't be, is there a way to use a conditional for it to only use the parent copyright? like if there's Pokemon_(Series); Pokemon_XD; Pokemon_Whatever; it only picks the parent or one with most entries?

There's a "use shorter" setting at the same place as mentioned above, but it only applies for stuff like "pokemon pokemon_xd" where one is the prefix of the other. If there's some "(Series)" stuff in the tag it won't work since Grabber doesn't know which one is the parent one.

Also, and sorry to further bother you, how could I join the conditional for copyright + Conditional for Characters + %general:separator=;%

Just put them all in the same field:

<[%copyright:separator=];[%]>;<(%character:separator=);(%)>;%general:separator=;%
Reberebe commented 8 months ago

Thanks for the quick reply,

I tried the code and it works, I've been doing some tryouts after work, but I ran with some problems some images were being saved without tags, for a moment I misguidedly thought it was the conditional, since I was following a coincidence as a clue, which was that some had "Copyright tag" without a "character tags", while others were the other way around, and some others had neither. After asking for help with a friend, noticed that I was way off, but the actual pattern was the format of the images, all the pngs weren't getting any tags for the IPTC:keywords field, I've worked with PNGs and MP4s IPTC tags before with Adobe bridge, so I went back to the documentation to confirm, it says that it should work on extensions supported by Exiftool

Is there something else I should do for it to account for PNGs and MP4s, am I doing something wrong? In Options>Save>Metadata>Exiftool>Extensions: I have "jpg jpeg png gif mp4" (as seen in the attached picture)

And the other thing I noticed, is that even when I removed the System.keywords field from Options>save>metadata the tags are being saved on System.keywords as well (using the conditionals applied on exiftool) (as shown in the attached picture) Is it possible to just save tags on the IPTC field without using the windows system.keywords field?

Thanks again for your help and time

METADATA

Bionus commented 8 months ago

Are you sure your PNG do not have tags, or simply that Windows is not showing them? AFAIK Windows does not support keywords for PNG files. It can be seen by right click > properties > details, the keywords field that is present on JPG files is missing. Did you try reading one of your PNG's metadata with a separate program, like Adobe Bridge as you mention or directly with exiftool itself?

Because all Grabber does is call exiftool with your file and the tags, and let it do its thing. So if exiftool supports the extension and property, Grabber will support it as well indirectly.

PS: any reason you're using IPTC keywords instead of using XMP since your other fields are using XMP? You could also remove the prefix altogether and let exiftool choose one automatically.

Reberebe commented 8 months ago

About verifying tags with Bridge, yeah all the trial and errors are being done with Adobe Bridge since the plan is to redownload the whole collection using Exiftool, while using Bridge to browse/filter the gallery. 🤞

Now, this is a bit irrelevant so feel free to skip this part, but may be helpful for someone in the future in case someone else uses the same tool and has this oddly specific issue.


when you mentioned on how PNGs don't have the tag/keywords field on the details pane I started to fear something, when I started using this great tool of yours a couple of years ago, I wasn't able to figure out the Exiftool aspect of it, so I took an easy exit, I used FileMeta https://github.com/Dijji/FileMeta by the late Dijji instead (RIP) Which allows you to "unlock" such fields on multiple file formats So with the help of that tool I used Grabber and I saved all the tags for PNGs JPGs and MP4s on System.Author for artist System.Keywords for tags System.Comments for rating It worked, I thought I had a system in place, but having tags like that wasn't as reliable since windows takes forever to find anything when needed. This year, the drives where I had my collection failed, twice! I'm not sure if it is hardware failure, or having a massive collection of pictures with metadata like that could be involved. So a sizeable amount of info was lost, which pushed me to finally try and updating the approach with exiftool, (in the hopes of friendlier browsing/filtering and, if that was one of the reasons for the drive failure, not giving so much of a hurdle to my drives) The plan, or hope, is to update the whole collection during holidays again in conjuction with Bridge.

So, about what I was fearing, I thought that the tool could be the reason exiftool was not saving tags on PNGs nor MP4s. I was waiting the whole day to come home and try to removing it for some more trial and error Which I did to no avail. But all this was me going in circles, since it was your edited question the last thing I just tried


About using IPTC rather than XMP, there was no real reason, other than ignorance, since... the whole process is been more of seeing what works while browsing the documentation when getting stuck, in the hopes of not bothering others too much, but skulls have been slammed into walls multiple times by now, So when I tried IPTC:keywords, the tags appeared in the filter tab from Bridge (which is ideal), (being the reason that I was looking to have a prefix for Artist/Characters, since everything will be thrown as a huge list of tags in the filter tab on Bridge, so would be cool to identify which ones are characters and which titles/copyright) so didn't try something else (seems that at some point I switched from XMP to IPTC while on those going on circles trying things moments) with that said, I checkmarked IPTC:keywords as a success, until now that I saw it didn't work for PNGs, So now that you asked that, I went back to the documentation and switched back to XMP-dc:Subject Lo and behold, PNGs are showing tags now, even MP4s!!!! This does bring a smile to my face (Guess I didn't need to delete Filemeta o_o' ) Thanks for mentioning it!!!! here's the current breakdown

XMP-dc:Subject <[%copyright:separator=];[%]>;<(%character:separator=);(%)>;%general:separator=;% XMP:Creator %artist:separator=;% XMP-dc:Rights %rating% XMP-dc:Description %md5%

•The thing I'm noticing now, is that JPGs are still being saved with tags on the WindowsPropertySYstem (System.Keywords) even when I have nothing on Options>Save>Metadata>WindowsPropertySystem, is there a way for them not to be, just to have them in XMP? (This is mainly because of the drive failure paranoia from before)

•Also, sorry again but, wdym with letting exiftool choose a prefix? as in for the artist/character tags? how could that be done?

Thanks again for taking the time and being so patient while helping

Bionus commented 8 months ago

Well glad to see you got your issue solved 😅

The thing I'm noticing now, is that JPGs are still being saved with tags on the WindowsPropertySYstem (System.Keywords)

If it's not in the Grabber settings, it shouldn't be Grabber setting those. It might simply be Windows actually reading the XML metadata from your JPG files, since it knows how to do that (although I'm not sure about reading some weird field like XMP-dc:Subject).

wdym with letting exiftool choose a prefix?

IIRC, if you just put Keywords instead of IPTC:Keywords for example, it will look for the most relevant "container" format by itself, and in this case likely choose XMP:Keywords. By adding the prefix you're forcing his hand to use a specific one for every single extension, while he might consider another one better. But for organization purposes it might be better this way, I was just randomly suggesting that.

Reberebe commented 8 months ago

yeah, happy to start working redownloading things, again thanks so much for taking the time, I've finally gave a tip on Patreon after quite the time of using the tool as appreciation, at least for a bit while I can throw some shekels

If you'd indulge me one more time, if I were to wanted to Instead use Parenthesis and brackets, and add a prefix to each Character/Copyright instead, how could I do that? As in

(Character):Character tag1;(Character):Character tagn

Thanks again for the help

Bionus commented 7 months ago

Hello 👋

Thanks for your patience, I was super busy for the last two weeks and hadn't had a chance to reply.

I've finally gave a tip on Patreon after quite the time of using the tool as appreciation, at least for a bit while I can throw some shekels

Thank you for your support! I'm always grateful as it shows what I'm doing helps people in a way 🎉

If you'd indulge me one more time, if I were to wanted to Instead use Parenthesis and brackets, and add a prefix to each Character/Copyright instead, how could I do that?

The trick is simply to identify what's between identical tokens, and what's before a set of identical tokens. In your case, you have:

So something like:

[Title]:%copyright:separator=;[Title]:%;(Character):%character:separator=;(Character):%

Separated for clariness:

[Title]:
%copyright:separator=;[Title]:%
;(Character):
%character:separator=;(Character):%

But if you're going that far, you might also simply want to use the includenamespace option:
https://www.bionus.org/imgbrd-grabber/docs/filename.html#include-namespace-boolean

So the filename would look like:

%tags:includenamespace,separator=;%

But at the end of the day it's up to you, given it's not the same result (tag_type:tag instead of [tag_type]:tag).

Reberebe commented 7 months ago

Thanks again for your reply and patience, I had a bit of a hard time understanding this, you explained well but I threw myself into a couple of walls since I was misinterpreting the result but I got it now! and it worked!!!!,

For documentation purposes and just in case someone with my lack of skills could be interested in the future (or if I lose my install and forget how to do it again)

If I wanted my tags to appear as [IP: X] where _X=series' title/copyright tag and [Character : Y] where Y=Character tag it goes like: <[IP:%copyright:separator=];[IP:%];><(Character:%character:separator=);(Character:%);>%general:separator=;%

the result for a picture with Bulma from dragon ball in it is: [IP:dragon_ball]; (Character:bulma_briefs); aqua_hair; belt; blue_eyes; braid;

or as pointed in your example above, having: <[IP]:%copyright:separator=;[IP]:%;><[Character]:%character:separator=;[Character]:%;>%general:separator=;% Would give: [IP]:dragon_ball; [Character]:bulma_briefs; aqua_hair; belt; blue_eyes; braid;

Thanks again for the answer and as I can't say enough, thanks again for this tool.

Bionus commented 7 months ago

Well I'm glad you got it working as you wanted eventually 🎉

I'll be closing this ticket then but feel free to re-open (or open another one) if there's something else. Or for small questions you can also ask directly on Discord 😃