gallery-dl icon indicating copy to clipboard operation
gallery-dl copied to clipboard

[NOOB QUESTION] What programming language the config file uses? So I can search tips in the web more easily + How to replace underscores by spaces in filename?

Open KonoVitoDa opened this issue 2 years ago • 8 comments

My knowledge in programming is almost 0, so there's a lot of great and simple things possible that I'm not aware, and the documentation doesn't seems to talk about them (because they are of basic knowledge, probably). For example: I don't knew until recently the existence of useful filename modifiers for MangaDex, like !S ({group!S} prevent creating Group folders with a bad name style, like ['Group'] turning it into Group instead, !u (makes the text uppercase), {page:>02} (makes the page number have 2 digits); and modifiers I use for other sites, like {date:%Y-%m-%d}, and other ones that I don't remenber now.

For now, I was looking for a way to replace underscores by spaces in Danbooru's filename, notably in {tag_string_artist}.

KonoVitoDa avatar Mar 05 '22 22:03 KonoVitoDa

gallery-dl.conf is a JSON file.

To modify the representation of values of the keys (which you can list with -K flag) it uses the follow rules: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md

AlttiRi avatar Mar 05 '22 22:03 AlttiRi

For example, {tag_string_copyright:R_/ /}.

However, are you really want to destroy some useful information of the tags?

You want to transform this: xiaoyu kuroe_shizuku sono_bisque_doll_wa_koi_wo_suru (3 tags) to xiaoyu kuroe shizuku sono bisque doll wa koi wo suru (??? tags).

AlttiRi avatar Mar 05 '22 22:03 AlttiRi

To modify the representation of values of the keys (which you can list with -K flag) it uses the follow rules: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md

@AlttiRi Oh, thank you very much, man! I can't believe I was missing such useful guide.

However, are you really want to destroy some useful information of the tags?

You want to transform this: xiaoyu kuroe_shizuku sono_bisque_doll_wa_koi_wo_suru (3 tags) to xiaoyu kuroe shizuku sono bisque doll wa koi wo suru (??? tags).

Well, for Boorus I used to use Imgbrd Grabber, which let me just separate multiple tags by commas. Can gallery-dl do it too? If not, seems like underscores will be a must-have...

EDIT: Managed to do it with {tag_string_character:R /, /R_/ /}

KonoVitoDa avatar Mar 06 '22 01:03 KonoVitoDa

How could I replace a "/" (forward slash) character? I need to replace "
".

KonoVitoDa avatar Jul 07 '22 05:07 KonoVitoDa

Assuming it works like most other search and replace features, you just need to add a escape character. so you'd just write \/

kattjevfel avatar Jul 07 '22 09:07 kattjevfel

Assuming it works like most other search and replace features, you just need to add a escape character. so you'd just write \/

I tried.

KonoVitoDa avatar Jul 07 '22 10:07 KonoVitoDa

Where and why do you wanna replace a forward slash ?

rautamiekka avatar Jul 07 '22 16:07 rautamiekka

Oh, sorry, I need to replace <br /> that comes in Pixiv captions.

KonoVitoDa avatar Jul 07 '22 17:07 KonoVitoDa