fix: download cases
Build and Publish Container / Publish Linux container (push) Successful in 3m53s
Build and Publish Container / Publish Linux container (push) Successful in 3m53s
This commit is contained in:
@@ -43,7 +43,9 @@ class SteamWorkshopClient:
|
||||
self.session.mount("https://", HTTPAdapter(max_retries=retries))
|
||||
self.session.headers.update({"User-Agent": "ProgressionMods/1.0"})
|
||||
|
||||
def get_collections(self, collection_ids: list[str]) -> dict[str, list[str]]:
|
||||
def get_collections(
|
||||
self, collection_ids: list[str]
|
||||
) -> tuple[dict[str, list[str]], set[str]]:
|
||||
payload: dict[str, str | int] = {"collectioncount": len(collection_ids)}
|
||||
for index, collection_id in enumerate(collection_ids):
|
||||
payload[f"publishedfileids[{index}]"] = collection_id
|
||||
@@ -55,6 +57,7 @@ class SteamWorkshopClient:
|
||||
details = response.json().get("response", {}).get("collectiondetails", [])
|
||||
|
||||
result: dict[str, list[str]] = {}
|
||||
collection_references: set[str] = set()
|
||||
for detail in details:
|
||||
collection_id = str(detail.get("publishedfileid", ""))
|
||||
if int(detail.get("result", 0)) != 1:
|
||||
@@ -63,10 +66,21 @@ class SteamWorkshopClient:
|
||||
detail.get("children", []),
|
||||
key=lambda child: int(child.get("sortorder", 0)),
|
||||
)
|
||||
result[collection_id] = [
|
||||
str(child["publishedfileid"]) for child in children
|
||||
]
|
||||
return result
|
||||
child_ids = [str(child["publishedfileid"]) for child in children]
|
||||
result[collection_id] = child_ids
|
||||
collection_references.update(
|
||||
str(child["publishedfileid"])
|
||||
for child in children
|
||||
if int(child.get("filetype", 0) or 0) == 2
|
||||
)
|
||||
|
||||
# Steam currently reports filetype=2 for nested collections. Also
|
||||
# recognize configured collections by id in case that field is absent.
|
||||
all_children = {
|
||||
workshop_id for workshop_ids in result.values() for workshop_id in workshop_ids
|
||||
}
|
||||
collection_references.update(set(collection_ids) & all_children)
|
||||
return result, collection_references
|
||||
|
||||
def get_item_details(self, workshop_ids: list[str]) -> dict[str, WorkshopDetails]:
|
||||
result: dict[str, WorkshopDetails] = {}
|
||||
|
||||
Reference in New Issue
Block a user