Skip to content

Is there a way to limit number of tags, instead of characters ? booru filename #4942

Closed Answered by mikf
tealkami asked this question in Q&A
Discussion options

You must be logged in to vote

Like this:

"filename": "\fF {id}---{', '.join(tags_artist.split(' ')[:1])}---{tag_string_copyright[:50]|'':?/---/}{', '.join(tags_character.split(' ')[:5])}|'':?/---/}"

Unfortunately, that does not work. f-strings do not support | or :?/---/ or basically anything from docs/formatting, at least not with the documented syntax. It would be possible but incredibly long, complicated, and unreadable.

Each single tag category would be something like

{(', '.join(tag_string_character.split(' ')[:5]) + '---') if tag_string_character else ''}

I have since added some new tags metadata fields for Danbooru that provide them as a list of tags: 627ed79
(the old tag_string_character etc fields are stil…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@tealkami
Comment options

@Hrxn
Comment options

@mikf
Comment options

mikf Dec 22, 2023
Maintainer

Answer selected by tealkami
@Hrxn
Comment options

@mikf
Comment options

mikf Dec 22, 2023
Maintainer

@Hrxn
Comment options

@mikf
Comment options

mikf Dec 22, 2023
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants