-
-
Notifications
You must be signed in to change notification settings - Fork 965
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
[Pixiv] Translated tags as a separate keyword? #5250
Comments
My use case: I'm trying out creating a custom SQLite database for saving Pixiv metadata using the following postprocessor: "pixiv": {
"postprocessors": [{
"name": "exec",
"command": [
"sqlite3",
"~/gallery-dl/pixiv/pixiv.sqlite3",
"INSERT OR REPLACE INTO pixiv_gdl (filename, filepath, page_count, rating, tags, translated-tags, title, description, date) VALUES('{filename}.{extension}', '{user['id']} {user['account']}', '{page_count}', '{rating}', '[\"{tags:J\", \"/}\"]', '[\"{translated-tags:J\", \"/}\"]', '{title}', '{caption}', '{date}');"
]
}]
} |
You could use a
Not a valid Python identifier. I'll probably call it |
@mikf can you give me a basic example of how it can can be done? |
cfg.json {
"tags": "original",
"postprocessors": [
{
"name": "python",
"event": "prepare",
"function": "~/gdl_utils.py:pixiv_tags"
}
]
} gdl_utils.py def pixiv_tags(metadata):
metadata["tags_translated"] = list(dict.fromkeys(
tag["translated_name"] or tag["name"]
for tag in metadata["tags"]
))
metadata["tags_japanese"] = [
tag["name"]
for tag in metadata["tags"]
] This will add a |
Hmm, that works. My issue has been solved then. Closing it now Thanks for the help! |
I think there should be a separate keyword for array of translated tags, simply called
translated-tags
which can be used while also having the original japanesetags
keyword available for use.Maybe add
extractors.pixiv.translated-tags
as a boolean setting for enabling the keyword if disabled by default?I can't use
extractors.pixiv.tags = "original"
because it doesn't seem like there is any way to separate out the jp and en tags within the config file. Also I don't think it is possible to use something like{tags[]['name']}
.The text was updated successfully, but these errors were encountered: