Fixed misc bugs
This commit is contained in:
@@ -46,7 +46,7 @@ class WebSocketCallback(ProgressCallback):
|
||||
"""Send progress update to WebSocket"""
|
||||
print(f"📊 [{self.websocket_id}] Progress: {event.message}")
|
||||
if event.progress is not None:
|
||||
print(f" Progress: {event.progress:.1f}%")
|
||||
print(f" Progress: {int(round(event.progress))}%")
|
||||
if event.data:
|
||||
print(f" Data: {event.data}")
|
||||
|
||||
@@ -109,7 +109,7 @@ async def example_basic_usage():
|
||||
print("❌ Download not found!")
|
||||
break
|
||||
|
||||
print(f"📊 Status: {status['status']} | Progress: {status['progress']:.1f}%")
|
||||
print(f"📊 Status: {status['status']} | Progress: {int(round(status['progress']))}%")
|
||||
|
||||
if status['status'] in ['completed', 'failed', 'cancelled']:
|
||||
print(f"🏁 Download finished with status: {status['status']}")
|
||||
@@ -162,7 +162,7 @@ async def example_advanced_usage():
|
||||
download_ids.remove(download_id)
|
||||
continue
|
||||
|
||||
print(f"📊 {download_id}: {status['status']} ({status['progress']:.1f}%)")
|
||||
print(f"📊 {download_id}: {status['status']} ({int(round(status['progress']))}%)")
|
||||
|
||||
if status['status'] in ['completed', 'failed', 'cancelled']:
|
||||
print(f"🏁 Download {download_id} finished")
|
||||
@@ -203,7 +203,7 @@ async def example_user_download():
|
||||
print("❌ Download not found")
|
||||
break
|
||||
|
||||
print(f"📊 Status: {status['status']} | Progress: {status['progress']:.1f}%")
|
||||
print(f"📊 Status: {status['status']} | Progress: {int(round(status['progress']))}%")
|
||||
|
||||
if status['status'] in ['completed', 'failed']:
|
||||
break
|
||||
@@ -236,7 +236,7 @@ async def example_archive_operation():
|
||||
print("❌ Archive not found")
|
||||
break
|
||||
|
||||
print(f"📊 Archive status: {status['status']} | Progress: {status['progress']:.1f}%")
|
||||
print(f"📊 Archive status: {status['status']} | Progress: {int(round(status['progress']))}%")
|
||||
|
||||
if status['status'] in ['completed', 'failed']:
|
||||
print(f"🏁 Archive finished with status: {status['status']}")
|
||||
@@ -325,7 +325,7 @@ async def example_web_integration():
|
||||
user_downloads = await app.get_user_downloads(user_id)
|
||||
print(f"User has {len(user_downloads)} active downloads:")
|
||||
for download in user_downloads:
|
||||
print(f" - {download['id']}: {download['status']} ({download['progress']:.1f}%)")
|
||||
print(f" - {download['id']}: {download['status']} ({int(round(download['progress']))}%)")
|
||||
|
||||
# Cancel one download
|
||||
if user_downloads:
|
||||
|
||||
Reference in New Issue
Block a user