This commit is contained in:
+15
-13
@@ -1545,16 +1545,17 @@ async def get_episodes_missing_nfo_dateadded(dependencies: dict):
|
|||||||
print("🔧 Calling core container for NFO repair scan...")
|
print("🔧 Calling core container for NFO repair scan...")
|
||||||
|
|
||||||
# Call the core container's NFO repair scan endpoint
|
# Call the core container's NFO repair scan endpoint
|
||||||
import httpx
|
import aiohttp
|
||||||
|
import asyncio
|
||||||
|
|
||||||
core_url = f"http://nfoguard-core:{config.core_api_port}/admin/nfo-repair-scan"
|
core_url = f"http://nfoguard-core:{config.core_api_port}/admin/nfo-repair-scan"
|
||||||
print(f"🔍 DEBUG: Calling core container at: {core_url}")
|
print(f"🔍 DEBUG: Calling core container at: {core_url}")
|
||||||
|
|
||||||
async with httpx.AsyncClient(timeout=300.0) as client: # 5 minute timeout for filesystem scan
|
timeout = aiohttp.ClientTimeout(total=300.0) # 5 minute timeout for filesystem scan
|
||||||
response = await client.get(core_url)
|
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||||
|
async with session.get(core_url) as response:
|
||||||
if response.status_code == 200:
|
if response.status == 200:
|
||||||
result = response.json()
|
result = await response.json()
|
||||||
print(f"✅ Core container scan complete: {result['total_missing']} items missing dateadded")
|
print(f"✅ Core container scan complete: {result['total_missing']} items missing dateadded")
|
||||||
|
|
||||||
# Transform the data to match the expected legacy format
|
# Transform the data to match the expected legacy format
|
||||||
@@ -1604,13 +1605,14 @@ async def get_episodes_missing_nfo_dateadded(dependencies: dict):
|
|||||||
"movies_missing": result['movies_missing']
|
"movies_missing": result['movies_missing']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
print(f"❌ Core container scan failed: {response.status_code} - {response.text}")
|
error_text = await response.text()
|
||||||
return {
|
print(f"❌ Core container scan failed: {response.status} - {error_text}")
|
||||||
"success": False,
|
return {
|
||||||
"error": f"Core container scan failed: {response.status_code}",
|
"success": False,
|
||||||
"message": f"Failed to check NFO files via core container: {response.status_code}"
|
"error": f"Core container scan failed: {response.status}",
|
||||||
}
|
"message": f"Failed to check NFO files via core container: {response.status}"
|
||||||
|
}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Error calling core container for NFO repair scan: {str(e)}")
|
print(f"❌ Error calling core container for NFO repair scan: {str(e)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user