dev #62
+15
-13
@@ -1545,16 +1545,17 @@ async def get_episodes_missing_nfo_dateadded(dependencies: dict):
|
||||
print("🔧 Calling core container for NFO repair scan...")
|
||||
|
||||
# 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"
|
||||
print(f"🔍 DEBUG: Calling core container at: {core_url}")
|
||||
|
||||
async with httpx.AsyncClient(timeout=300.0) as client: # 5 minute timeout for filesystem scan
|
||||
response = await client.get(core_url)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
timeout = aiohttp.ClientTimeout(total=300.0) # 5 minute timeout for filesystem scan
|
||||
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||
async with session.get(core_url) as response:
|
||||
if response.status == 200:
|
||||
result = await response.json()
|
||||
print(f"✅ Core container scan complete: {result['total_missing']} items missing dateadded")
|
||||
|
||||
# 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']
|
||||
}
|
||||
}
|
||||
else:
|
||||
print(f"❌ Core container scan failed: {response.status_code} - {response.text}")
|
||||
return {
|
||||
"success": False,
|
||||
"error": f"Core container scan failed: {response.status_code}",
|
||||
"message": f"Failed to check NFO files via core container: {response.status_code}"
|
||||
}
|
||||
else:
|
||||
error_text = await response.text()
|
||||
print(f"❌ Core container scan failed: {response.status} - {error_text}")
|
||||
return {
|
||||
"success": False,
|
||||
"error": f"Core container scan failed: {response.status}",
|
||||
"message": f"Failed to check NFO files via core container: {response.status}"
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error calling core container for NFO repair scan: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user