Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion src/utils/loadScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ async def getProtectedAndPrivateFromQbit(settingsDict):
privateDowloadIDs.append(str.upper(qbitItem['hash']))
else:
qbitItemProperties = await rest_get(settingsDict['QBITTORRENT_URL']+'/torrents/properties',params={'hash': qbitItem['hash']}, cookies=settingsDict['QBIT_COOKIE'])
if not qbitItemProperties:
logger.error("Torrent %s not found on qBittorrent - potentially already removed whilst checking if torrent is private. Consider upgrading qBit to v5.1.0 or newer to avoid this problem.", qbitItem['hash'])
continue
if qbitItemProperties.get('is_private', False):
privateDowloadIDs.append(str.upper(qbitItem['hash']))
qbitItem['private'] = qbitItemProperties.get('is_private', None) # Adds the is_private flag to qbitItem info for simplified logging
Expand Down Expand Up @@ -201,9 +204,10 @@ async def instanceChecks(settingsDict):
if version.parse(qbit_version) < version.parse(settingsDict['QBITTORRENT_MIN_VERSION']):
error_occured = True
logger.error('-- | %s *** Error: %s ***', 'qBittorrent', 'Please update qBittorrent to at least version %s Current version: %s',settingsDict['QBITTORRENT_MIN_VERSION'], qbit_version)

if not error_occured:
logger.info('OK | %s', 'qBittorrent')
if version.parse(settingsDict['QBIT_VERSION']) < version.parse('5.1.0'):
logger.info('>>> [Tip!] qBittorrent (Consider upgrading to v5.1.0 or newer to reduce network overhead. You are on %s)', qbit_version) # Particularly if people have many torrents and use private trackers
logger.debug('Current version of %s: %s', 'qBittorrent', qbit_version)


Expand Down
19 changes: 7 additions & 12 deletions src/utils/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,8 @@ def formattedQueueInfo(queue):
return "empty"
formatted_list = []
for queue_item in queue:
download_id = queue_item["downloadId"]
title = queue_item["title"]
item_id = queue_item["id"]
download_id = queue_item.get("downloadId", None)
item_id = queue_item.get("id", None)
# Check if there is an entry with the same download_id and title
existing_entry = next(
(item for item in formatted_list if item["downloadId"] == download_id),
Expand All @@ -365,21 +364,17 @@ def formattedQueueInfo(queue):
if existing_entry:
existing_entry["IDs"].append(item_id)
else:
new_entry = {
formatted_list.append({
"downloadId": download_id,
"downloadTitle": title,
"downloadTitle": queue_item.get("title"),
"IDs": [item_id],
}
formatted_list.append(new_entry)
"protocol": [queue_item.get("protocol")],
"status": [queue_item.get("status")],
})
return formatted_list
except Exception as error:
errorDetails("formattedQueueInfo", error)
logger.debug("formattedQueueInfo/queue for debug: %s", str(queue))
if isinstance(error, KeyError):
logger.debug(
"formattedQueueInfo/queue_item with error for debug: %s", queue_item
)

return "error"


Expand Down
Loading