Skip to content

Commit

Permalink
feat(cli): better description of postprocessing currently happening
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Oct 29, 2023
1 parent 16e9c09 commit 1d9bfea
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/cli/ydcli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
from ydcore import VideoWithOptionsAndStatus


POSTPROCESSOR_LOOKUP = {
'extractaudio': 'EXTRACTING AUDIO',
'videoconvertor': 'CONVERTING VIDEO',
'metadata': 'EMBEDDING',
'embedthumbnail': 'EMBEDDING',
'embedsubtitle': 'EMBEDDING',
'movefiles': 'FINALIZING',
}


def on_status_update(update: VideoWithOptionsAndStatus) -> None:
state = update.status.state
progress = update.status.progress
Expand All @@ -10,6 +20,8 @@ def on_status_update(update: VideoWithOptionsAndStatus) -> None:
if state == DownloadState.DOWNLOADING and progress is not None:
output += f' - {progress:3.1f}%'
elif state == DownloadState.PROCESSING and postprocessor is not None:
output += f' - {postprocessor}'
postprocessor_text = POSTPROCESSOR_LOOKUP.get(postprocessor.lower())
if postprocessor_text is not None:
output += f' - {postprocessor_text}'
print('\033[K', end='\r')
print(output, end='\n' if state == DownloadState.DONE else '\r')

1 comment on commit 1d9bfea

@vercel
Copy link

@vercel vercel bot commented on 1d9bfea Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.