Skip to content

Commit ecacaff

Browse files
committed
Bugfixed offline download clients causing issues
1 parent c036163 commit ecacaff

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/utils/shared.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,8 @@ def formattedQueueInfo(queue):
354354
return "empty"
355355
formatted_list = []
356356
for queue_item in queue:
357-
download_id = queue_item["downloadId"]
358-
title = queue_item["title"]
359-
item_id = queue_item["id"]
357+
download_id = queue_item.get("downloadId", None)
358+
item_id = queue_item.get("id", None)
360359
# Check if there is an entry with the same download_id and title
361360
existing_entry = next(
362361
(item for item in formatted_list if item["downloadId"] == download_id),
@@ -365,21 +364,17 @@ def formattedQueueInfo(queue):
365364
if existing_entry:
366365
existing_entry["IDs"].append(item_id)
367366
else:
368-
new_entry = {
367+
formatted_list.append({
369368
"downloadId": download_id,
370-
"downloadTitle": title,
369+
"downloadTitle": queue_item.get("title"),
371370
"IDs": [item_id],
372-
}
373-
formatted_list.append(new_entry)
371+
"protocol": [queue_item.get("protocol")],
372+
"status": [queue_item.get("status")],
373+
})
374374
return formatted_list
375375
except Exception as error:
376376
errorDetails("formattedQueueInfo", error)
377377
logger.debug("formattedQueueInfo/queue for debug: %s", str(queue))
378-
if isinstance(error, KeyError):
379-
logger.debug(
380-
"formattedQueueInfo/queue_item with error for debug: %s", queue_item
381-
)
382-
383378
return "error"
384379

385380

0 commit comments

Comments
 (0)