Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[artstation] add 'num' and 'count' metadata fields #2764

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gallery_dl/extractor/artstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def items(self):
data = self.metadata()

for project in self.projects():
for asset in self.get_project_assets(project["hash_id"]):
for num, asset in enumerate(
self.get_project_assets(project["hash_id"]), 1):
asset.update(data)
adict = asset["asset"]
asset["num"] = num
yield Message.Directory, asset

if adict["has_embedded_player"] and self.external:
Expand Down Expand Up @@ -85,6 +87,7 @@ def get_project_assets(self, project_id):
assets = data["assets"]
del data["assets"]

data["count"] = len(assets)
if len(assets) == 1:
data["asset"] = assets[0]
yield data
Expand Down