Route grabs through Sonarr/Radarr only
This commit is contained in:
@@ -1619,29 +1619,7 @@ async def action_grab(
|
|||||||
try:
|
try:
|
||||||
response = await client.grab_release(str(guid), int(indexer_id))
|
response = await client.grab_release(str(guid), int(indexer_id))
|
||||||
except httpx.HTTPStatusError as exc:
|
except httpx.HTTPStatusError as exc:
|
||||||
status_code = exc.response.status_code if exc.response is not None else 502
|
raise HTTPException(status_code=502, detail=f"Sonarr grab failed: {exc}") from exc
|
||||||
if status_code == 404 and download_url:
|
|
||||||
qbit = QBittorrentClient(
|
|
||||||
runtime.qbittorrent_base_url,
|
|
||||||
runtime.qbittorrent_username,
|
|
||||||
runtime.qbittorrent_password,
|
|
||||||
)
|
|
||||||
if not qbit.configured():
|
|
||||||
raise HTTPException(status_code=400, detail="qBittorrent not configured")
|
|
||||||
try:
|
|
||||||
await qbit.add_torrent_url(str(download_url), category=f"magent-{request_id}")
|
|
||||||
except httpx.HTTPStatusError as qbit_exc:
|
|
||||||
raise HTTPException(status_code=502, detail=str(qbit_exc)) from qbit_exc
|
|
||||||
await asyncio.to_thread(
|
|
||||||
save_action,
|
|
||||||
request_id,
|
|
||||||
"grab",
|
|
||||||
"Grab release",
|
|
||||||
"ok",
|
|
||||||
"Sent to qBittorrent via Prowlarr.",
|
|
||||||
)
|
|
||||||
return {"status": "ok", "message": "Sent to qBittorrent.", "via": "qbittorrent"}
|
|
||||||
raise HTTPException(status_code=502, detail=str(exc)) from exc
|
|
||||||
await asyncio.to_thread(
|
await asyncio.to_thread(
|
||||||
save_action, request_id, "grab", "Grab release", "ok", "Grab sent to Sonarr."
|
save_action, request_id, "grab", "Grab release", "ok", "Grab sent to Sonarr."
|
||||||
)
|
)
|
||||||
@@ -1653,29 +1631,7 @@ async def action_grab(
|
|||||||
try:
|
try:
|
||||||
response = await client.grab_release(str(guid), int(indexer_id))
|
response = await client.grab_release(str(guid), int(indexer_id))
|
||||||
except httpx.HTTPStatusError as exc:
|
except httpx.HTTPStatusError as exc:
|
||||||
status_code = exc.response.status_code if exc.response is not None else 502
|
raise HTTPException(status_code=502, detail=f"Radarr grab failed: {exc}") from exc
|
||||||
if status_code == 404 and download_url:
|
|
||||||
qbit = QBittorrentClient(
|
|
||||||
runtime.qbittorrent_base_url,
|
|
||||||
runtime.qbittorrent_username,
|
|
||||||
runtime.qbittorrent_password,
|
|
||||||
)
|
|
||||||
if not qbit.configured():
|
|
||||||
raise HTTPException(status_code=400, detail="qBittorrent not configured")
|
|
||||||
try:
|
|
||||||
await qbit.add_torrent_url(str(download_url), category=f"magent-{request_id}")
|
|
||||||
except httpx.HTTPStatusError as qbit_exc:
|
|
||||||
raise HTTPException(status_code=502, detail=str(qbit_exc)) from qbit_exc
|
|
||||||
await asyncio.to_thread(
|
|
||||||
save_action,
|
|
||||||
request_id,
|
|
||||||
"grab",
|
|
||||||
"Grab release",
|
|
||||||
"ok",
|
|
||||||
"Sent to qBittorrent via Prowlarr.",
|
|
||||||
)
|
|
||||||
return {"status": "ok", "message": "Sent to qBittorrent.", "via": "qbittorrent"}
|
|
||||||
raise HTTPException(status_code=502, detail=str(exc)) from exc
|
|
||||||
await asyncio.to_thread(
|
await asyncio.to_thread(
|
||||||
save_action, request_id, "grab", "Grab release", "ok", "Grab sent to Radarr."
|
save_action, request_id, "grab", "Grab release", "ok", "Grab sent to Radarr."
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user