✨ Pastille 'Radarr lie' (filtre + maj au scan) et ln nomme comme le fichier Radarr

This commit is contained in:
Orionis312050 committed 2026-10-11 19:39:46 +00:00
1 parent 78e6b0bb22
commit f0b5f2b21e
9 files changed
+71 -204

No files matched your search

+8 -1
View File
@@ -10,7 +10,7 @@ import httpx
from fastapi import Cookie, Depends, FastAPI, HTTPException, Response
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse
from sqlalchemy import inspect, select, text
from sqlalchemy import inspect, select, text, update
from sqlalchemy.orm import Session
from app import auth
@@ -54,6 +54,7 @@ async def lifespan(_: FastAPI):
"failed_step": "TEXT",
"last_error": "TEXT",
"poster_url": "TEXT",
"radarr_linked": "BOOLEAN DEFAULT 1",
}
with engine.begin() as conn:
for column, ddl in migrations.items():
@@ -270,6 +271,10 @@ async def scan_radarr(db: DbSession) -> ScanResult:
iso_files = created = updated = 0
now = datetime.now(UTC)
# Pastille "Radarr lie": on repart de zero, la boucle marque les films
# toujours presents cote Radarr; les fichiers supprimes ou remplaces
# passent donc a False.
db.execute(update(IsoMovie).values(radarr_linked=False))
for movie in movies:
movie_file = movie.get("movieFile") or {}
path = movie_file_path(movie)
@@ -295,6 +300,7 @@ async def scan_radarr(db: DbSession) -> ScanResult:
path=path,
size=movie_file.get("size"),
poster_url=_poster_url(movie),
radarr_linked=True,
last_seen_at=now,
)
db.add(item)
@@ -305,6 +311,7 @@ async def scan_radarr(db: DbSession) -> ScanResult:
item.path = path
item.size = movie_file.get("size")
item.poster_url = _poster_url(movie)
item.radarr_linked = True
item.last_seen_at = now
updated += 1
db.commit()