removed downloaded and total mb

This commit is contained in:
Lukas 2025-11-20 19:34:01 +01:00
parent 72a0455d59
commit 9a42442f47
3 changed files with 21 additions and 28 deletions

View File

@ -1,25 +1,5 @@
{
"pending": [
{
"id": "c4bb6196-7a58-4338-8747-100970fd3834",
"serie_id": "highschool-dxd",
"serie_folder": "Highschool DxD",
"serie_name": "Highschool DxD",
"episode": {
"season": 1,
"episode": 3,
"title": null
},
"status": "cancelled",
"priority": "NORMAL",
"added_at": "2025-11-20T17:12:34.485225Z",
"started_at": "2025-11-20T18:15:48.216607Z",
"completed_at": "2025-11-20T18:16:38.929297Z",
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "96d0ecfe-95f1-4f1d-abb8-493b88616e1b",
"serie_id": "highschool-dxd",
@ -943,5 +923,5 @@
],
"active": [],
"failed": [],
"timestamp": "2025-11-20T18:16:38.929570+00:00"
"timestamp": "2025-11-20T18:27:28.516768+00:00"
}

View File

@ -90,13 +90,24 @@ class AnimeService:
loop
)
elif args.status == "progress":
# Build metadata with item_id and speed
progress_metadata = {}
if args.item_id:
progress_metadata["item_id"] = args.item_id
if args.mbper_sec is not None:
progress_metadata["speed_mbps"] = round(args.mbper_sec, 2)
if args.eta is not None:
progress_metadata["eta"] = args.eta
asyncio.run_coroutine_threadsafe(
self._progress_service.update_progress(
progress_id=progress_id,
current=args.progress,
total=100,
message=args.message or "Downloading...",
metadata={"item_id": args.item_id} if args.item_id else None,
metadata=(
progress_metadata if progress_metadata else None
),
),
loop
)

View File

@ -393,6 +393,7 @@ class QueueManager {
// Extract progress information - handle both ProgressService and yt-dlp formats
const progress = data.progress || data;
const percent = progress.percent || 0;
const metadata = progress.metadata || data.metadata || {};
// Check if we have detailed yt-dlp progress (downloaded_mb, total_mb, speed_mbps)
// or basic ProgressService progress (current, total)
@ -407,12 +408,13 @@ class QueueManager {
// ProgressService basic format - convert bytes to MB
downloaded = (progress.current / (1024 * 1024)).toFixed(1);
total = progress.total > 0 ? (progress.total / (1024 * 1024)).toFixed(1) : 'Unknown';
speed = '0.0'; // Speed not available in basic format
// Check for speed in metadata
speed = metadata.speed_mbps ? metadata.speed_mbps.toFixed(1) : '0.0';
} else {
// Fallback
downloaded = '0.0';
total = 'Unknown';
speed = '0.0';
speed = metadata.speed_mbps ? metadata.speed_mbps.toFixed(1) : '0.0';
}
// Update progress bar
@ -428,7 +430,7 @@ class QueueManager {
const speedSpan = progressInfo.querySelector('.download-speed');
if (percentSpan) {
percentSpan.textContent = `${percent.toFixed(1)}% (${downloaded} MB / ${total} MB)`;
percentSpan.textContent = percent > 0 ? `${percent.toFixed(1)}%` : 'Starting...';
}
if (speedSpan) {
speedSpan.textContent = `${speed} MB/s`;
@ -487,8 +489,8 @@ class QueueManager {
const progress = download.progress || {};
const progressPercent = progress.percent || 0;
const speed = progress.speed_mbps ? `${progress.speed_mbps.toFixed(1)} MB/s` : '0 MB/s';
const downloaded = progress.downloaded_mb ? `${progress.downloaded_mb.toFixed(1)} MB` : '0 MB';
const total = progress.total_mb ? `${progress.total_mb.toFixed(1)} MB` : 'Unknown';
const downloaded = progress.downloaded_mb ? `${progress.downloaded_mb.toFixed(1)} MB` : '0.0';
const total = progress.total_mb ? `${progress.total_mb.toFixed(1)} MB` : '0.0';
return `
<div class="download-card active" data-download-id="${download.id}">
@ -503,7 +505,7 @@ class QueueManager {
<div class="progress-fill" style="width: ${progressPercent}%"></div>
</div>
<div class="progress-info">
<span>${progressPercent.toFixed(1)}% (${downloaded} / ${total})</span>
<span>${progressPercent > 0 ? `${progressPercent.toFixed(1)}%` : 'Starting...'}</span>
<span class="download-speed">${speed}</span>
</div>
</div>