Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yande.re tags #92

Closed
ChiChi32 opened this issue Jun 26, 2018 · 4 comments
Closed

Yande.re tags #92

ChiChi32 opened this issue Jun 26, 2018 · 4 comments

Comments

@ChiChi32
Copy link

Hello again. Could you add tag recognition as "artist", "copyright" for yande.re? It would be very convenient to save files for example "konosuba - megimin_id.jpg". I apologize if I ask for something difficult, but this is the only reason for using another program for yande.re.

@mikf
Copy link
Owner

mikf commented Jun 29, 2018

API responses from yande.re only include a "flat" list of tags without any additional information (e.g. "tags": "tag1 tag2 tag3 ..."), so to get the "artist", "character", etc. labels, one additional request per post to https://yande.re/post/show/[id] is necessary.

This basically doubles the amount of HTTP requests to yande.re, so I've added an options to enables this functionality as needed. Setting extractor.yandere.tags to true splits the tag-list into several sub-lists for artists, characters, and so on and should do what you want.

This functionality should be generalized and made available for other booru-sites as well, so I'm going to leave this open until this is done.

@ChiChi32
Copy link
Author

Thanks, works fine. There is one thing I forgot to write about. Sometimes there are no tags, or too many. It is possible to make that missing replacing "unknown * or" no_tag ", and those which are many like" multyple "?

@mikf
Copy link
Owner

mikf commented Jul 4, 2018

I changed the tags option a bit to only provide tags_<type> fields if any tags for a specific type are available. So, if, for example, no character tag exists, it will now omit the tags_character field entirely instead of it being an empty string. Missing replacement fields will be replaced by whatever keywords-default is set to, so you can use that for missing tags.

As for the "too many tags"-case: There is currently no way to deal with that in a sensible manner. It should preferably be handled as a custom format string option, but I'm not really sure about the syntax ...

mikf added a commit that referenced this issue Jul 29, 2018
The L option allows for the contents of a format field to be replaced
with <replacement> if its length is greater than <maxlen>.

Example:
{f:L5/too long/} -> "foo"      (if "f" is "foo")
                 -> "too long" (if "f" is "foobar")

(#92) (#94)
@mikf
Copy link
Owner

mikf commented Jul 29, 2018

You can now use the L format specifier to set a replacement if the format field value is too long. For example {tags:L100/too many tags/} (e0dd8df).

Another way to limit a field's size is string slicing: {tags[0:100]} (8fe9056)

@mikf mikf closed this as completed Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants