mirror of
https://github.com/nathom/streamrip.git
synced 2025-06-06 09:41:19 -04:00
Add progress bar themes
This commit is contained in:
parent
9f79a47bb4
commit
96b15d9917
3 changed files with 25 additions and 7 deletions
|
@ -500,13 +500,24 @@ def downsize_image(filepath: str, width: int, height: int):
|
|||
resized_image.save(filepath)
|
||||
|
||||
|
||||
TQDM_BAR_FORMAT = (
|
||||
"{desc} |{bar}| ("
|
||||
+ click.style("{elapsed}", fg="magenta")
|
||||
+ " at "
|
||||
+ click.style("{rate_fmt}{postfix}", fg="cyan", bold=True)
|
||||
+ ")"
|
||||
)
|
||||
TQDM_THEMES = {
|
||||
"plain": None,
|
||||
"dainty": (
|
||||
"{desc} |{bar}| "
|
||||
+ click.style("{remaining}", fg="magenta")
|
||||
+ " left at "
|
||||
+ click.style("{rate_fmt}{postfix} ", fg="cyan", bold=True)
|
||||
),
|
||||
}
|
||||
|
||||
TQDM_DEFAULT_THEME = "dainty"
|
||||
|
||||
TQDM_BAR_FORMAT = TQDM_THEMES["dainty"]
|
||||
|
||||
|
||||
def set_progress_bar_theme(theme: str):
|
||||
global TQDM_BAR_FORMAT
|
||||
TQDM_BAR_FORMAT = TQDM_THEMES[theme]
|
||||
|
||||
|
||||
def tqdm_stream(iterator: DownloadStream, desc: Optional[str] = None) -> Generator:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue