[danbooru] provide 'tags' as list (#4942)

keep the old 'tag_string' values around, similar to sankaku

a lot of repeat code ...
would be a lot less bad if "".split(" ") returned an empty list
This commit is contained in:
Mike Fährmann
2023-12-21 14:39:38 +01:00
parent fbebc58189
commit 627ed794a2
2 changed files with 144 additions and 0 deletions

View File

@@ -72,6 +72,25 @@ class DanbooruExtractor(BaseExtractor):
post["date"] = text.parse_datetime(
post["created_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
post["tags"] = (
post["tag_string"].split(" ")
if post["tag_string"] else ())
post["tags_artist"] = (
post["tag_string_artist"].split(" ")
if post["tag_string_artist"] else ())
post["tags_character"] = (
post["tag_string_character"].split(" ")
if post["tag_string_character"] else ())
post["tags_copyright"] = (
post["tag_string_copyright"].split(" ")
if post["tag_string_copyright"] else ())
post["tags_general"] = (
post["tag_string_general"].split(" ")
if post["tag_string_general"] else ())
post["tags_meta"] = (
post["tag_string_meta"].split(" ")
if post["tag_string_meta"] else ())
if post["extension"] == "zip":
if self.ugoira:
post["frames"] = self._ugoira_frames(post)