Skip to content

Commit

Permalink
[sankaku] add 'tag_string' metadata field (#1388)
Browse files Browse the repository at this point in the history
The 'join()'ed version of 'tags'.
Handling lists in format strings isn't properly supported yet.
  • Loading branch information
mikf committed Mar 23, 2021
1 parent 2dffd23 commit d085ade
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gallery_dl/extractor/sankaku.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def _prepare(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"]]
post["tag_string"] = " ".join(post["tags"])

def _extended_tags(self, post):
tags = collections.defaultdict(list)
Expand All @@ -63,6 +64,7 @@ def _extended_tags(self, post):
tags[types[tag["type"]]].append(tag["name"])
for key, value in tags.items():
post["tags_" + key] = value
post["tag_string_" + key] = " ".join(value)


class SankakuTagExtractor(SankakuExtractor):
Expand Down

0 comments on commit d085ade

Please sign in to comment.