Monitor media before issue repair searches
Magent CI/CD / verify (push) Successful in 10m43s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Successful in 19s

This commit is contained in:
2026-09-01 20:50:16 +12:00
parent 0ed22dd315
commit 6391fbfd81
5 changed files with 125 additions and 5 deletions
+10 -4
View File
@@ -1896,8 +1896,8 @@ def _issue_episode_payloads(
"released": released,
"monitored": monitored,
"has_file": has_file,
"missing": released and monitored and not has_file,
"best_fit": released and monitored and not has_file,
"missing": released and not has_file,
"best_fit": released and not has_file,
"file_id": episode.get("episodeFileId") if has_file else None,
}
)
@@ -2154,6 +2154,7 @@ async def action_replace_media(
radarr = RadarrClient(runtime.radarr_base_url, runtime.radarr_api_key)
if not radarr.configured():
raise HTTPException(status_code=400, detail="Radarr is not configured")
await radarr.monitor_movie(movie_id, True)
await radarr.delete_movie_file(file_ids[0])
await radarr.search(movie_id)
elif snapshot.request_type == RequestType.tv:
@@ -2184,6 +2185,7 @@ async def action_replace_media(
if not episode_ids:
raise HTTPException(status_code=409, detail="Sonarr could not match episodes to this file")
target_names = [_replacement_file_name(file_data) for file_data in selected_files]
await sonarr.monitor_episodes(episode_ids, True)
for selected_file_id in file_ids:
await sonarr.delete_episode_file(selected_file_id)
await sonarr.search_episodes(episode_ids)
@@ -2295,6 +2297,7 @@ async def action_search_missing_media(
radarr = RadarrClient(runtime.radarr_base_url, runtime.radarr_api_key)
if not radarr.configured():
raise HTTPException(status_code=400, detail="Radarr is not configured")
await radarr.monitor_movie(collector_id, True)
await radarr.search(collector_id)
message = "Radarr started searching for the missing movie."
searched_ids: List[int] = []
@@ -2319,14 +2322,17 @@ async def action_search_missing_media(
item_id
for item_id, episode in episode_map.items()
if _released_episode(episode)
and episode.get("monitored") is not False
and not (
episode.get("hasFile") is True
or (isinstance(episode.get("episodeFileId"), int) and episode.get("episodeFileId") > 0)
)
and (not season_numbers or episode.get("seasonNumber") in season_numbers)
and (
(season_numbers and episode.get("seasonNumber") in season_numbers)
or (not season_numbers and episode.get("monitored") is not False)
)
]
if searched_ids:
await sonarr.monitor_episodes(searched_ids, True)
await sonarr.search_episodes(searched_ids)
message = f"Sonarr started searching for {len(searched_ids)} selected missing episode(s)."
else: