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

[Tech support] Format string OR conditional #1454

Closed
Slider-Whistle opened this issue Apr 10, 2021 · 2 comments
Closed

[Tech support] Format string OR conditional #1454

Slider-Whistle opened this issue Apr 10, 2021 · 2 comments

Comments

@Slider-Whistle
Copy link

Hi, sorry if this is already documented somewhere, but is it possible for one keyword to be valid, only if the previous keyword is invalid? (false, "None", etc.) Basically something like the equivalent of sh's "||" operator.
As for the specific use case, I like to download e-hentai galleries into directories named after "title_jpn" where possible, but some uploaders forget to use that field, so in those cases I'd like for gallery-dl to use "title" as a fallback.
I did some searching and found some information related to actual Python code, which I'm not sure how to apply to the config file, and an issue where you pointed out that some similar conditional logic has been implemented.

Possibly related issue: #1394

@mikf
Copy link
Owner

mikf commented Apr 10, 2021

Alternatives in format strings can be specified with |: {title_jpn|title}
{title_jpn[:255]|title[:255]} to shorten titles longer than allowed is also possible.

if this is already documented somewhere

It isn't, together with a lot of other formatting options ...

@Slider-Whistle
Copy link
Author

Slider-Whistle commented Apr 10, 2021 via email

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