Show total items to scan in progress overlay
- Add total_items parameter to broadcast_scan_started and broadcast_scan_progress - Pass total from SeriesApp to WebSocket broadcasts in AnimeService - Update JS overlay to show progress bar and current/total count - Add CSS for progress bar styling - Add unit tests for new total_items parameter - All 1024 tests passing
This commit is contained in:
@@ -498,27 +498,36 @@ class WebSocketService:
|
||||
}
|
||||
await self._manager.send_personal_message(message, connection_id)
|
||||
|
||||
async def broadcast_scan_started(self, directory: str) -> None:
|
||||
async def broadcast_scan_started(
|
||||
self, directory: str, total_items: int = 0
|
||||
) -> None:
|
||||
"""Broadcast that a library scan has started.
|
||||
|
||||
Args:
|
||||
directory: The root directory path being scanned
|
||||
total_items: Total number of items to scan (for progress display)
|
||||
"""
|
||||
message = {
|
||||
"type": "scan_started",
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
"data": {
|
||||
"directory": directory,
|
||||
"total_items": total_items,
|
||||
},
|
||||
}
|
||||
await self._manager.broadcast(message)
|
||||
logger.info("Broadcast scan_started", directory=directory)
|
||||
logger.info(
|
||||
"Broadcast scan_started",
|
||||
directory=directory,
|
||||
total_items=total_items,
|
||||
)
|
||||
|
||||
async def broadcast_scan_progress(
|
||||
self,
|
||||
directories_scanned: int,
|
||||
files_found: int,
|
||||
current_directory: str,
|
||||
total_items: int = 0,
|
||||
) -> None:
|
||||
"""Broadcast scan progress update to all clients.
|
||||
|
||||
@@ -526,6 +535,7 @@ class WebSocketService:
|
||||
directories_scanned: Number of directories scanned so far
|
||||
files_found: Number of MP4 files found so far
|
||||
current_directory: Current directory being scanned
|
||||
total_items: Total number of items to scan (for progress display)
|
||||
"""
|
||||
message = {
|
||||
"type": "scan_progress",
|
||||
@@ -534,6 +544,7 @@ class WebSocketService:
|
||||
"directories_scanned": directories_scanned,
|
||||
"files_found": files_found,
|
||||
"current_directory": current_directory,
|
||||
"total_items": total_items,
|
||||
},
|
||||
}
|
||||
await self._manager.broadcast(message)
|
||||
|
||||
Reference in New Issue
Block a user