This commit is contained in:
+27
-27
@@ -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)
|
||||
print(f"INFO: Processing movie: {item.name}")
|
||||
try:
|
||||
# Determine force_scan based on scan mode
|
||||
force_scan = (scan_mode == "full")
|
||||
shutdown_event = dependencies.get("shutdown_event")
|
||||
result = movie_processor.process_movie(item, webhook_mode=False, force_scan=force_scan, shutdown_event=shutdown_event)
|
||||
movie_total += 1
|
||||
if result == "skipped":
|
||||
movie_skipped += 1
|
||||
elif result == "processed":
|
||||
movie_processed += 1
|
||||
elif result == "no_video_files":
|
||||
print(f"INFO: Skipped empty directory: {item.name}")
|
||||
movie_skipped += 1
|
||||
elif result == "shutdown":
|
||||
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping movie scan gracefully")
|
||||
return
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed processing movie {item}: {e}")
|
||||
movie_total += 1
|
||||
# Determine force_scan based on scan mode
|
||||
force_scan = (scan_mode == "full")
|
||||
shutdown_event = dependencies.get("shutdown_event")
|
||||
result = movie_processor.process_movie(item, webhook_mode=False, force_scan=force_scan, shutdown_event=shutdown_event)
|
||||
movie_total += 1
|
||||
if result == "skipped":
|
||||
movie_skipped += 1
|
||||
elif result == "processed":
|
||||
movie_processed += 1
|
||||
elif result == "no_video_files":
|
||||
print(f"INFO: Skipped empty directory: {item.name}")
|
||||
movie_skipped += 1
|
||||
elif result == "shutdown":
|
||||
print("INFO: ⚠️ SHUTDOWN SIGNAL RECEIVED - Stopping movie scan gracefully")
|
||||
return
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed processing movie {item}: {e}")
|
||||
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)
|
||||
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...")
|
||||
|
||||
# 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
|
||||
# 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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user