This commit is contained in:
+28
-28
@@ -720,35 +720,35 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
|
|||||||
update_scan_status(current_item=item.name, movies_processed=movie_count)
|
update_scan_status(current_item=item.name, movies_processed=movie_count)
|
||||||
print(f"INFO: Processing movie: {item.name}")
|
print(f"INFO: Processing movie: {item.name}")
|
||||||
try:
|
try:
|
||||||
# Determine force_scan based on scan mode
|
# Determine force_scan based on scan mode
|
||||||
force_scan = (scan_mode == "full")
|
force_scan = (scan_mode == "full")
|
||||||
shutdown_event = dependencies.get("shutdown_event")
|
shutdown_event = dependencies.get("shutdown_event")
|
||||||
result = movie_processor.process_movie(item, webhook_mode=False, force_scan=force_scan, shutdown_event=shutdown_event)
|
result = movie_processor.process_movie(item, webhook_mode=False, force_scan=force_scan, shutdown_event=shutdown_event)
|
||||||
movie_total += 1
|
movie_total += 1
|
||||||
if result == "skipped":
|
if result == "skipped":
|
||||||
movie_skipped += 1
|
movie_skipped += 1
|
||||||
elif result == "processed":
|
elif result == "processed":
|
||||||
movie_processed += 1
|
movie_processed += 1
|
||||||
elif result == "no_video_files":
|
elif result == "no_video_files":
|
||||||
print(f"INFO: Skipped empty directory: {item.name}")
|
print(f"INFO: Skipped empty directory: {item.name}")
|
||||||
movie_skipped += 1
|
movie_skipped += 1
|
||||||
elif result == "shutdown":
|
elif result == "shutdown":
|
||||||
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping movie scan gracefully")
|
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping movie scan gracefully")
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"ERROR: Failed processing movie {item}: {e}")
|
print(f"ERROR: Failed processing movie {item}: {e}")
|
||||||
movie_total += 1
|
movie_total += 1
|
||||||
|
|
||||||
|
# Yield control every 2 movies to allow other requests (webhooks, web interface)
|
||||||
|
if movie_count % 2 == 0:
|
||||||
|
await asyncio.sleep(0.2) # 200ms yield to process other requests
|
||||||
|
print(f"INFO: Processed {movie_count} movies, yielding to other requests...")
|
||||||
|
|
||||||
# Yield control every 2 movies to allow other requests (webhooks, web interface)
|
# Check for shutdown signal
|
||||||
if movie_count % 2 == 0:
|
shutdown_event = dependencies.get("shutdown_event")
|
||||||
await asyncio.sleep(0.2) # 200ms yield to process other requests
|
if shutdown_event and shutdown_event.is_set():
|
||||||
print(f"INFO: Processed {movie_count} movies, yielding to other requests...")
|
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping scan gracefully")
|
||||||
|
return
|
||||||
# Check for shutdown signal
|
|
||||||
shutdown_event = dependencies.get("shutdown_event")
|
|
||||||
if shutdown_event and shutdown_event.is_set():
|
|
||||||
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping scan gracefully")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"INFO: Completed movie scan: {movie_count} movies processed in {scan_path}")
|
print(f"INFO: Completed movie scan: {movie_count} movies processed in {scan_path}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user