1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-24 19:52:32 +01:00

[sankaku] improve tag categorization code

translate tag type ID to name for each category
instead of for each tag
This commit is contained in:
Mike Fährmann 2024-11-03 09:21:39 +01:00
parent 5ba1280220
commit d5fa1d6aba
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -76,14 +76,15 @@ class SankakuExtractor(BooruExtractor):
def _tags(self, post, page):
tags = collections.defaultdict(list)
types = self.TAG_TYPES
for tag in post["tags"]:
name = tag["name"]
if name:
tags[types[tag["type"]]].append(name.lower().replace(" ", "_"))
for key, value in tags.items():
post["tags_" + key] = value
post["tag_string_" + key] = " ".join(value)
tags[tag["type"]].append(name.lower().replace(" ", "_"))
types = self.TAG_TYPES
for type, values in tags.items():
name = types[type]
post["tags_" + name] = values
post["tag_string_" + name] = " ".join(values)
def _notes(self, post, page):
if post.get("has_notes"):