feat(torrent_api): show priority
Torrent API CI / test (push) Successful in 12s
Torrent API CI / lint (push) Successful in 8s
Torrent API CI / build (push) Successful in 29s
Torrent API CI / install (mediahost) (push) Successful in 2s
Torrent API CI / install (serverhost) (push) Successful in 2s
Torrent API CI / install (vivohost) (push) Successful in 3s
Torrent API CI / install (quiethost) (push) Successful in 6s

test(torrent)asd
This commit is contained in:
Lucas Vivo committed 2026-11-23 17:26:28 +01:00
1 parent 6010a3921b
commit dae16a6f46
2 files changed
+7 -4

No files matched your search

+5 -2
View File
@@ -134,16 +134,19 @@ class Qbittorrent:
{
"name": Path(file["name"]),
"progress": file["progress"],
"priority": file["priority"],
}
for file in content
if file.get("progress") >= progress_threshold and file.get("priority") > 0
]
max_len = 150
max_len = 110
name_w = min(max((len(str(item["name"])) for item in finished_file_names), default=0), max_len)
for item in finished_file_names:
print(f"{str(item['name'])[:max_len]:<{name_w}} Progress: {item['progress']*100:.0f}%")
print(f"{str(item['name'])[:max_len]:<{name_w}} "
f"Progress: {item['progress']*100:.0f}% "
f"Priority: {item['priority']}")
if copy_to is not None:
completed_files = [file for file in content if file.get("progress") >= 1.0]
+2 -2
View File
@@ -78,9 +78,9 @@ class TorrentHelpersTest(unittest.TestCase):
self.instance.show_and_copy_torrent_contents(
identifier, progress_threshold=0.5
)
self.assertIn("folder/file.txt Progress: 100%", output.getvalue())
self.assertIn("folder/file.txt Progress: 100% Priority: 1", output.getvalue())
self.assertIn("partial.txt", output.getvalue())
self.assertIn("Progress: 50%", output.getvalue())
self.assertIn("Progress: 50% Priority: 1", output.getvalue())
self.assertNotIn("skipped.txt", output.getvalue())
get.assert_called_with(
"http://localhost:8080/api/v2/torrents/files",