Skip to content

Commit

Permalink
Only count written size when calculating download speed in completed …
Browse files Browse the repository at this point in the history
…download message
  • Loading branch information
trickerer01 committed Aug 14, 2024
1 parent cba5c15 commit ee2a2ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ async def download_video(vi: VideoInfo) -> DownloadResult:
vi.dstart_time = get_elapsed_time_i()
async for chunk in r.content.iter_chunked(512 * Mem.KB):
await outf.write(chunk)
vi.bytes_written += len(chunk)
status_checker.reset()
dwn.remove_from_writes(vi)

Expand All @@ -382,7 +383,7 @@ async def download_video(vi: VideoInfo) -> DownloadResult:

total_time = get_elapsed_time_i() - vi.dstart_time
Log.info(f'[download] {vi.sfsname} ({vi.link_quality}) completed in {format_time(total_time)} '
f'({(file_size / total_time) / Mem.KB:.1f} Kb/s)')
f'({(vi.bytes_written / total_time) / Mem.KB:.1f} Kb/s)')

vi.set_state(VideoInfo.State.DONE)
break
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
APP_NAME = 'NM'
APP_VER_MAJOR = '1'
APP_VER_SUB = '8'
APP_REVISION = '431'
APP_REVISION = '432'
APP_VERSION = f'{APP_VER_MAJOR}.{APP_VER_SUB}.{APP_REVISION}'

#
Expand Down
1 change: 1 addition & 0 deletions src/vinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, m_id: int, m_title='', m_link='', m_subfolder='', m_filename=
self.comments = ''
self.uploader = ''
self.expected_size = 0
self.bytes_written = 0
self.dstart_time = 0
self.start_size = 0
self.start_time = 0
Expand Down

0 comments on commit ee2a2ca

Please sign in to comment.