This commit is contained in:
+40
-4
@@ -597,10 +597,46 @@ async def update_episode_date(dependencies: dict, imdb_id: str, season: int, epi
|
||||
has_video_file=episode_data.get('has_video_file', False)
|
||||
)
|
||||
|
||||
# Note: NFO file updates are handled by the core container
|
||||
# The web container only updates the database
|
||||
print(f"✅ Database updated for {imdb_id} S{season:02d}E{episode:02d}")
|
||||
print(f"ℹ️ NFO file updates will be handled by the core container on next scan")
|
||||
# Trigger NFO file update via core container
|
||||
try:
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import json
|
||||
import os
|
||||
|
||||
# Get core container connection details
|
||||
core_host = os.environ.get("CORE_API_HOST", "nfoguard-core")
|
||||
core_port = os.environ.get("CORE_API_PORT", "8080")
|
||||
|
||||
# Call core container to update NFO file
|
||||
nfo_update_url = f"http://{core_host}:{core_port}/api/episodes/{imdb_id}/{season}/{episode}/update-nfo"
|
||||
|
||||
# Create request data
|
||||
request_data = {
|
||||
"dateadded": dateadded,
|
||||
"source": source,
|
||||
"aired": episode_data.get('aired').isoformat() if episode_data.get('aired') else None
|
||||
}
|
||||
|
||||
# Make POST request to core container
|
||||
req = urllib.request.Request(
|
||||
nfo_update_url,
|
||||
data=json.dumps(request_data).encode('utf-8'),
|
||||
headers={'Content-Type': 'application/json'},
|
||||
method='POST'
|
||||
)
|
||||
|
||||
with urllib.request.urlopen(req, timeout=10) as response:
|
||||
if response.status == 200:
|
||||
print(f"✅ Database and NFO file updated for {imdb_id} S{season:02d}E{episode:02d}")
|
||||
else:
|
||||
print(f"✅ Database updated for {imdb_id} S{season:02d}E{episode:02d}")
|
||||
print(f"⚠️ NFO file update failed (HTTP {response.status})")
|
||||
|
||||
except Exception as e:
|
||||
print(f"✅ Database updated for {imdb_id} S{season:02d}E{episode:02d}")
|
||||
print(f"⚠️ NFO file update failed: {e}")
|
||||
print(f"ℹ️ NFO will be updated on next scan")
|
||||
|
||||
# Add to processing history
|
||||
db.add_processing_history(
|
||||
|
||||
Reference in New Issue
Block a user