Support original-language movie requests and fix repair dialog layout
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from ..services.request_language import language_info, original_profile, is_original_profile
|
||||
from ..feature_guards import require_request_access
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
import asyncio
|
||||
@@ -3127,6 +3128,7 @@ async def request_options(
|
||||
"backdropPath": details.get("backdropPath") or details.get("backdrop_path"),
|
||||
"seasons": seasons,
|
||||
"existingRequestId": existing_request_id,
|
||||
"originalLanguage": language_info(details),
|
||||
},
|
||||
"destination": {
|
||||
"collector": destination["collector"],
|
||||
@@ -3227,7 +3229,16 @@ async def create_request(
|
||||
detail=f"Season selection is not available for this series: {invalid_seasons}",
|
||||
)
|
||||
|
||||
language = language_info(details)
|
||||
accept_original = payload.get("acceptOriginalLanguage", False)
|
||||
if not isinstance(accept_original, bool):
|
||||
raise HTTPException(400, "The language choice must be true or false.")
|
||||
if accept_original and not language:
|
||||
raise HTTPException(409, "The original language could not be verified. Reload this title.")
|
||||
destination = await _resolve_request_destination(runtime, client, media_type)
|
||||
if accept_original and media_type == "movie":
|
||||
destination["profile_id"] = await original_profile(
|
||||
RadarrClient(runtime.radarr_base_url, runtime.radarr_api_key), destination["profile_id"])
|
||||
|
||||
try:
|
||||
created = await client.create_request(
|
||||
@@ -3262,7 +3273,8 @@ async def create_request(
|
||||
"request_created",
|
||||
"Create request",
|
||||
"ok",
|
||||
f"{media_type} request created from discovery by {user.get('username')}.",
|
||||
f"{media_type} request created from discovery by {user.get('username')}."
|
||||
+ (f" Original-language audio accepted ({language['code']})." if accept_original else ""),
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -3445,6 +3457,11 @@ async def action_search_auto(request_id: str, user: Dict[str, str] = Depends(get
|
||||
raise HTTPException(status_code=400, detail="Radarr not configured")
|
||||
target_profile_id = _quality_profile_id(runtime.radarr_quality_profile_id)
|
||||
current_profile_id = _quality_profile_id(arr_item.get("qualityProfileId"))
|
||||
if current_profile_id and current_profile_id != target_profile_id:
|
||||
profiles = await client.get_quality_profiles()
|
||||
current = next((p for p in profiles if p.get("id") == current_profile_id), {})
|
||||
if is_original_profile(current):
|
||||
target_profile_id = current_profile_id
|
||||
profile_message = None
|
||||
movie_id = _quality_profile_id(arr_item.get("id"))
|
||||
if target_profile_id and movie_id and current_profile_id != target_profile_id:
|
||||
|
||||
Reference in New Issue
Block a user