-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[gallery-dl + Exiftool] How to overcome special characters problems? #2734
Comments
I think this would be easiest by using a Anyway, the {
"name": "metadata",
"event": "after",
"filename": "ARG FILE.txt",
"directory": "~/gallery-dl",
"mode": "custom",
"format": [
"-title={content:?//R\n/ /}",
"-xpcomment={favorite_count} Likes",
"-keywords={hashtags!S}",
"-createdate={date}"
]
} but, as I said, that's missing the |
Thanks. This will be a good solution once But for now, a (better?) solution I found on the Exiftool forum was this: By the way, what does |
This is called using the Python Array Slicing Syntax to get a range (a slice) from a string.
I mean, that's what the exec postprocessor is for, right? Should be easy enough on gallery-dl's side.. "postprocessor":
{
"exiftool-twitter":
{
"name": "exec",
"async": false,
"command": ["powershell.exe", "-File", "D:/path/to/scriptfile.ps1", "~/gallery-dl/ARG FILE.txt "],
"event" : "after"
}
} (Anything else with regard to metadata we need to pass on here?) Depending on the length of the script, this could also be wrapped into a Anyway, I'm here and willing to help with testing 😄 |
This is now possible with the It works similar to
I made a mistake up in #2734 (comment)
What I actually meant to write was
|
Try whitelisting characters with a regex and use an f-string maybe? What I do myself is allow characters like a-z A-Z or 0-9 and dismiss evertything else. If you want to take a look at the snippet, it also replaces all occurences of multiple spaces into a single one. The [:48] at the end is to limit the title length but you are free to adjust that.
|
TL;DR: I need an exec.command to write the downloaded file path and metadata values to a text file (just the chosen ones, one per line and with an Exiftool command appended to the beginning), so I can use this generated text file as an arg file in my Exiftool postprocessor command to overcome problems with special characters.
Whenever a special character like ⧸ or any Japanese character is written to the exif file metadata using Exiftool, they are replaced by a bunch of "???". And when they are present in the filename, Exiftool can't even find the files. It looks like it's a problem on the Windows side, which can't handle these characters well. The Exiftool documentation says here and here that using a arg file is a good way to bypass this problem, so a solution I thought of would be to use an exec.command to first write the metadata values and the file path to a text file, each one preceded by the corresponding Exiftool command (1), and then run a second exec.command using this arg file (2) to correctly write special characters in their respective fields, and also avoid problems with special characters in filenames.
1. WHAT THE TEXT FILE WOULD LOOK LIKE:
PS: Note that the values in { } must have already been converted to real values, so taking this tweet as an example, the arg file would become:
2. USING THE GENERATED TEXT FILE AS AN ARG FILE FOR EXIFTOOL:
So how could I generate this text file with one argument per line using an exec.command postprocessor? it would require just a Powershell/CMD command I think, but I don't know how to do so (I'm a newbie). And it would be good if the text file was replaced on each new file downloaded, so I don't end up with hundreds of txt files.
And if there's an easier way to correctly read/write these special characters, please let me know.
Windows 10 Home 21H2 19044.1766 | gallery-dl 1.22.3 | Exiftool 12.42 (Windows Executable)
The text was updated successfully, but these errors were encountered: