[pixiv] Fix tag write when tags setting is set to original #3675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See this issue: #3674
The following command will fail on current master:
gallery-dl --ignore-config --write-tags --option "extractor.pixiv.tags=original" --verbose https://www.pixiv.net/en/artworks/105480642
The traceback:
The issue:
When the tags setting for Pixiv is set to original the tags are returned as a list of dict objects. The code that is bombing out expects tags to be list of str.
There is already branching logic to handle the different formats that tags come back as from the extractors so I've extended that logic to handle when tags come back as list of dict objects. As you can see sometimes the values are None so there is handling to remove those from the returned list as well.
This will make the list of tags written just a flat list of strings, loosing the mapping between Japanese tag and the translated version, but that is just how the file is. Ideally I think it would be great to have this change be in the Pixiv extractor but if I flatten out the mapping there, then we'll loose the mapping in that variable that is useful in other parts, such as the json metadata write.