From 2b5d80862e194e3ada63b458fb871ad6bf7fad35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 15 May 2021 01:12:07 +0200 Subject: [PATCH] [kemonoparty] add 'type' metadata field (#1556) 'file', 'attachment', or 'inline' --- gallery_dl/extractor/kemonoparty.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 3abf11be..de1b0be2 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -35,12 +35,17 @@ class KemonopartyExtractor(Extractor): for post in self.posts(): files = [] - if post["file"]: - files.append(post["file"]) - if post["attachments"]: - files.extend(post["attachments"]) + append = files.append + file = post["file"] + + if file: + file["type"] = "file" + append(file) + for attachment in post["attachments"]: + attachment["type"] = "attachment" + append(attachment) for path in find_inline(post["content"] or ""): - files.append({"path": path, "name": path}) + append({"path": path, "name": path, "type": "inline"}) post["date"] = text.parse_datetime( post["published"], "%a, %d %b %Y %H:%M:%S %Z")