[sankaku] restore old 'tags' format (#6043)

lowercase + words separated by underscores
pull/4768/head
Mike Fährmann 1 month ago
parent e29f4ef226
commit ef4c1b4fc5
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -66,7 +66,8 @@ class SankakuExtractor(BooruExtractor):
def _prepare(self, post):
post["created_at"] = post["created_at"]["s"]
post["date"] = text.parse_timestamp(post["created_at"])
post["tags"] = [tag["name"] for tag in post["tags"] if tag["name"]]
post["tags"] = [tag["name"].lower().replace(" ", "_")
for tag in post["tags"] if tag["name"]]
post["tag_string"] = " ".join(post["tags"])
post["_http_validate"] = self._check_expired
@ -79,7 +80,7 @@ class SankakuExtractor(BooruExtractor):
for tag in post["tags"]:
name = tag["name"]
if name:
tags[types[tag["type"]]].append(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)

@ -142,7 +142,7 @@ __tests__ = (
"#sha1_content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
"id": "y0abGlDOr2o",
"notes": [],
"notes": (),
"tags_artist": [
"bonocho",
],
@ -219,6 +219,12 @@ __tests__ = (
"tags_general": [
"key(mangaka)",
"key(mangaka)",
"english_language",
"english_language",
"high_resolution",
"tagme",
"very_high_resolution",
"large_filesize",
],
},

Loading…
Cancel
Save