chore: standardize security and quality foundations
This commit is contained in:
@@ -32,6 +32,7 @@ from ..models import ActionOption, NormalizedState, RequestType, Snapshot, Timel
|
||||
from .collector_search import read_search_status
|
||||
from .media_repair import current_cycle_torrents, evaluate_media_repair
|
||||
from .download_labels import label_episode_downloads
|
||||
from .arr import RootFolderNotFoundError, resolve_root_folder_path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1234,11 +1235,6 @@ async def build_snapshot(request_id: str) -> Snapshot:
|
||||
arr_item = None
|
||||
arr_queue = None
|
||||
episodes = None
|
||||
media_status = jelly_request.get("media", {}).get("status")
|
||||
try:
|
||||
media_status_code = int(media_status) if media_status is not None else None
|
||||
except (TypeError, ValueError):
|
||||
media_status_code = None
|
||||
if snapshot.request_type == RequestType.tv:
|
||||
tvdb_id = jelly_request.get("media", {}).get("tvdbId")
|
||||
if tvdb_id:
|
||||
@@ -1390,11 +1386,15 @@ async def build_snapshot(request_id: str) -> Snapshot:
|
||||
if runtime.radarr_quality_profile_id and runtime.radarr_root_folder:
|
||||
radarr_client = RadarrClient(runtime.radarr_base_url, runtime.radarr_api_key)
|
||||
if radarr_client.configured():
|
||||
root_folder = await _resolve_root_folder_path(
|
||||
radarr_client, runtime.radarr_root_folder, "Radarr"
|
||||
)
|
||||
try:
|
||||
root_folder = await resolve_root_folder_path(
|
||||
radarr_client, runtime.radarr_root_folder, "Radarr"
|
||||
)
|
||||
except RootFolderNotFoundError as exc:
|
||||
logger.warning("Skipping Jellyfin-to-Radarr sync: %s", exc)
|
||||
root_folder = ""
|
||||
tmdb_id = jelly_request.get("media", {}).get("tmdbId")
|
||||
if tmdb_id:
|
||||
if tmdb_id and root_folder:
|
||||
try:
|
||||
await radarr_client.add_movie(
|
||||
int(tmdb_id),
|
||||
@@ -1409,11 +1409,15 @@ async def build_snapshot(request_id: str) -> Snapshot:
|
||||
if runtime.sonarr_quality_profile_id and runtime.sonarr_root_folder:
|
||||
sonarr_client = SonarrClient(runtime.sonarr_base_url, runtime.sonarr_api_key)
|
||||
if sonarr_client.configured():
|
||||
root_folder = await _resolve_root_folder_path(
|
||||
sonarr_client, runtime.sonarr_root_folder, "Sonarr"
|
||||
)
|
||||
try:
|
||||
root_folder = await resolve_root_folder_path(
|
||||
sonarr_client, runtime.sonarr_root_folder, "Sonarr"
|
||||
)
|
||||
except RootFolderNotFoundError as exc:
|
||||
logger.warning("Skipping Jellyfin-to-Sonarr sync: %s", exc)
|
||||
root_folder = ""
|
||||
tvdb_id = jelly_request.get("media", {}).get("tvdbId")
|
||||
if tvdb_id:
|
||||
if tvdb_id and root_folder:
|
||||
try:
|
||||
await sonarr_client.add_series(
|
||||
int(tvdb_id),
|
||||
|
||||
Reference in New Issue
Block a user