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

sankaku metadata problem #1388

Closed
wankio opened this issue Mar 18, 2021 · 9 comments
Closed

sankaku metadata problem #1388

wankio opened this issue Mar 18, 2021 · 9 comments

Comments

@wankio
Copy link
Contributor

wankio commented Mar 18, 2021

"filename": "{tags_artist[:50]}_{tags[:100]}

like before it should have limit character with [:xx] but now

['chihunhentai']_['genshin_impact', 'noelle_(genshin_impact)', 'chihunhentai', 'high_resolution', 'very_high_resolution', 'large_filesize', 'depth_of_field', 'blurry_background', 'paid_reward', '1girl', 'bangs', 'blurry', 'blush', 'braid', 'breasts', 'clavicle', 'eyebrows_visible_through_hair', 'female', 'female_focus', 'female_only', 'female_solo', 'flower', 'green_eyes', 'hair_ornament', 'hand_on_breast', 'hand_on_chest', 'hand_on_own_chest', 'indoors', 'large_breasts', 'light-skinned', 'light-skinned_female', 'looking_at_viewer', 'navel', 'nipples', 'nude', 'nude_female', 'parted_lips', 'petals', 'pink_flower', 'pink_rose', 'purple_hair', 'rose', 'rose_petals', 'short_hair', 'silver_hair', 'smile', 'smiley_face', 'smiling_at_viewer', 'smiling_face', 'solo']_24711085_1615880262_.jpg.part"
download: Failed to download ['chihunhentai']_['genshin_impact', 'noelle_(genshin_impact)', 'chihunhentai', 'high_resolution', 'very_high_resolution', 'large_filesize', 'depth_of_field', 'blurry_background', 'paid_reward', '1girl', 'bangs', 'blurry', 'blush', 'braid', 'breasts', 'clavicle', 'eyebrows_visible_through_hair', 'female', 'female_focus', 'female_only', 'female_solo', 'flower', 'green_eyes', 'hair_ornament', 'hand_on_breast', 'hand_on_chest', 'hand_on_own_chest', 'indoors', 'large_breasts', 'light-skinned', 'light-skinned_female', 'looking_at_viewer', 'navel', 'nipples', 'nude', 'nude_female', 'parted_lips', 'petals', 'pink_flower', 'pink_rose', 'purple_hair', 'rose', 'rose_petals', 'short_hair', 'silver_hair', 'smile', 'smiley_face', 'smiling_at_viewer', 'smiling_face', 'solo']_24711085_1615880262_.jpg

['chihunhentai']_ - and with this " [' '] " sometime it cannot read by windows, i must rename it so it can be read by windows

@mikf
Copy link
Owner

mikf commented Mar 18, 2021

Since switching to the beta.sankakucomplex.com/sankaku.app interface in ecdea79 (v1.16.0), tags, tags_artist, etc. behave a bit differently and can't be shortened with [:xx], or at least not like you'd expect.

What you can do is limit the number of tags with {tags[:5]} or {tags_artist[:1]}, but you can't directly limit the number of characters anymore. You can also use {tags!S} or {tags:J, } to transform tags into a regular string without [ and ], e.g. {tags[:5]!S}.

['chihunhentai']_ - and with this " [' '] " sometime it cannot read by windows, i must rename it so it can be read by windows

Shouldn't be the case that [ or ] by themself cause trouble. Maybe very long filenames cause problems with some programs?

@Fukitsu
Copy link

Fukitsu commented Mar 18, 2021

I was going to ask something kind of similar, when downloading books from beta.sankakucomplex.com I'm trying to set the directory name like this:
"directory":["Sankaku", "Books", "{pool[id]}][{pool[artist_tags][][name]}] - {pool[name]}"]
But I get an error:
[sankaku][error] DirectoryFormatError: Applying directory format string failed (ValueError: Empty attribute in format string)

If I change it to:
"directory": ["Sankaku", "Books", "{pool[id]}][{pool[artist_tags][name]}] - {pool[name]}"]
It starts downloading but the {pool[artist_tags][name]} field in the folder name is set to None. What's the correct way to get the artist's name?

@mikf
Copy link
Owner

mikf commented Mar 18, 2021

@Fukitsu You can use {pool[artist_tags][0][name]} to get the first entry from artist_tags, but there is no good way to list the names of all artists when there's more than one.

@Fukitsu
Copy link

Fukitsu commented Mar 20, 2021

Thank you, another question. Sankaku doesn't seem to have a num field available like exhentai does for example, is there a generic way to number the pages of a book downloaded like 01.png 02.png depending on how many pages a book has?

mikf added a commit that referenced this issue Mar 23, 2021
The 'join()'ed version of 'tags'.
Handling lists in format strings isn't properly supported yet.
mikf added a commit that referenced this issue Mar 23, 2021
normalize 'tags' and 'artist_tags' to a string-list
@mikf
Copy link
Owner

mikf commented Mar 23, 2021

@wankio There are now tag_string metadata fields for sankaku (d085ade, same as the tag_string fields on danbooru). Replace "filename": "{tags_artist[:50]}_{tags[:100]} with "filename": "{tag_string_artist[:50]}_{tag_string[:100]} and it'll work like before.

@Fukitsu There isn't a generic way to number files yet (#1074). Commit 2dffd23 adds a num field for sankaku pools/books, although it doesn't automatically zero-fill. You'll have to use {num:02} and adjust as necessary.

I've also "simplified" the tags and artist_tags fields to string-lists, meaning you can now do {pool[artist_tags]!S} to have all artists in a reasonable format ({pool[artist_tags][0]} to only get the first one).

@Fukitsu
Copy link

Fukitsu commented Mar 25, 2021

It works, thank you. I've got yet another question, sorry. I was wondering how to use Python expressions with the directory names, for example I wanted to do something like
{pool[artist_tags]!S}.replace('_',' ').capitalize() but I'm not sure how to do it. I tried with --filter but doesn't seem to work,

@mikf
Copy link
Owner

mikf commented Mar 25, 2021

You can't use Python expressions in format strings.
.replace('_',' ') can be emulated with R_/ / ({pool[artist_tags]!S:R_/ /}), but there isn't a way to apply a .capitalize() afterwards. Theoretically it can be done with !C, but the "conversion" spot only allows for 1 entry and is already in use (!S).
The whole string formatting system needs to be overhauled in some way, but that is for v2.0.0. #1390 would definitely be an option.

@mo-han
Copy link
Contributor

mo-han commented May 25, 2021

tried {artist_tags} {tags_artist} {tags_string_artist}, all gave None, for sankaku site.
are these keywords valid or not in the end?

@mikf
Copy link
Owner

mikf commented May 26, 2021

@mo-han you need to enable the tags option to get more than the regular tags/tag_string. It would be tags_artist for a list and tag_string_artist for a string.

are these keywords valid or not in the end?

You can always check with -K or -j.

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

4 participants