fix: support v2 and hybrid qBittorrent identities

This commit is contained in:
2026-07-23 11:48:08 +00:00
parent 69709c778b
commit 6ca94a546e
10 changed files with 240 additions and 74 deletions
+16 -7
View File
@@ -686,6 +686,12 @@ class ClientJobExecutor:
self.qb_api_root.as_posix(),
info_hash,
)
resource = self.qbittorrent.get_resource(info_hash)
if resource is None:
raise JobExecutionError(
"added qBittorrent resource did not become visible"
)
qb_torrent_id = resource.summary.qb_torrent_id
target_union = _union_selection(
definition.transfer.target_baseline_files,
definition.transfer.transfer_delta_files,
@@ -694,9 +700,11 @@ class ClientJobExecutor:
total_files = len(
decode_message_metainfo(metainfo_path).files
)
self.qbittorrent.set_selection(info_hash, selected, total_files)
self.qbittorrent.set_selection(
qb_torrent_id, selected, total_files
)
self.qbittorrent.recheck_and_wait(
info_hash,
qb_torrent_id,
selected,
timeout=self.verification_timeout,
poll_interval=self.poll_interval,
@@ -708,7 +716,7 @@ class ClientJobExecutor:
),
)
if should_start:
self.qbittorrent.start(info_hash)
self.qbittorrent.start(qb_torrent_id)
verified = self.qbittorrent.get_resource(info_hash)
if verified is None:
raise JobExecutionError(
@@ -753,18 +761,19 @@ class ClientJobExecutor:
info_hash = _info_hash(definition)
present = self.qbittorrent.get_resource(info_hash)
if present is not None:
qb_torrent_id = present.summary.qb_torrent_id
if baseline.get("present"):
selected = baseline.get("selected_file_indices")
if isinstance(selected, list) and selected:
self.qbittorrent.set_selection(
info_hash, selected, len(present.files)
qb_torrent_id, selected, len(present.files)
)
if baseline.get("stopped"):
self.qbittorrent.stop(info_hash)
self.qbittorrent.stop(qb_torrent_id)
else:
self.qbittorrent.start(info_hash)
self.qbittorrent.start(qb_torrent_id)
else:
self.qbittorrent.delete_entry(info_hash)
self.qbittorrent.delete_entry(qb_torrent_id)
compensate_materialized_files(
job_id=definition.job_id,
qb_root=self.qb_root,