✨ Validation: renommage Radarr (RenameMovie) apres rescan - le ln prend le nom de la config Media Management

This commit is contained in:
Orionis312050 committed 2026-10-13 21:23:06 +00:00
1 parent 5fccc71326
commit b4cd2dc855
4 files changed
+45 -21

No files matched your search

+21 -7
View File
@@ -28,6 +28,16 @@ class RadarrClient:
raise ValueError("Réponse Radarr inattendue")
return result
async def _command(self, payload: dict) -> None:
"""Enfile une commande Radarr (traitees sequentiellement par Radarr)."""
async with httpx.AsyncClient(timeout=30) as client:
response = await client.post(
f"{self._url}/api/v3/command",
headers=self._headers,
json=payload,
)
response.raise_for_status()
async def rescan_movie(self, movie_id: int) -> None:
"""Demande a Radarr de rescanner le dossier du film.
@@ -35,13 +45,17 @@ class RadarrClient:
le MKV lie (lien dur): Radarr l'adopte comme fichier du film a la
place de l'ISO supprimee.
"""
async with httpx.AsyncClient(timeout=30) as client:
response = await client.post(
f"{self._url}/api/v3/command",
headers=self._headers,
json={"name": "RescanMovie", "movieId": movie_id},
)
response.raise_for_status()
await self._command({"name": "RescanMovie", "movieId": movie_id})
async def rename_movie(self, movie_id: int) -> None:
"""Demande a Radarr de renommer les fichiers du film selon sa config
Media Management.
Enchaine apres le rescan: le MKV lie prend le nom standard Radarr
(l'ancien nom de l'ISO ne correspond pas au format attendu). Le
renommage preserve l'inode, le lien dur reste intact.
"""
await self._command({"name": "RenameMovie", "movieId": movie_id})
def movie_file_path(movie: dict) -> str | None: