mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Improve visuals
I never liked cyan anyway
This commit is contained in:
parent
cd445674e5
commit
b03c19dac1
@ -305,7 +305,7 @@ def main():
|
||||
print_err(e)
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
print_err("Operation canceled")
|
||||
print_err("\nOperation canceled")
|
||||
sys.exit(1)
|
||||
except GQLError as e:
|
||||
print_err(e)
|
||||
|
@ -6,7 +6,7 @@ from statistics import mean
|
||||
from typing import Dict, Optional
|
||||
|
||||
from twitchdl.output import print_out
|
||||
from twitchdl.utils import format_size, format_duration
|
||||
from twitchdl.utils import format_size, format_time
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -116,11 +116,10 @@ class Progress:
|
||||
|
||||
progress = " ".join([
|
||||
f"Downloaded {self.vod_downloaded_count}/{self.vod_count} VODs",
|
||||
f"({self.progress_perc}%)",
|
||||
f"<cyan>{format_size(self.progress_bytes)}</cyan>",
|
||||
f"of <cyan>~{format_size(self.estimated_total)}</cyan>" if self.estimated_total else "",
|
||||
f"at <cyan>{format_size(self.speed)}/s</cyan>" if self.speed else "",
|
||||
f"remaining <cyan>~{format_duration(self.remaining_time)}</cyan>" if self.remaining_time is not None else "",
|
||||
f"<blue>{self.progress_perc}%</blue>",
|
||||
f"of <blue>~{format_size(self.estimated_total)}</blue>" if self.estimated_total else "",
|
||||
f"at <blue>{format_size(self.speed)}/s</blue>" if self.speed else "",
|
||||
f"ETA <blue>{format_time(self.remaining_time)}</blue>" if self.remaining_time is not None else "",
|
||||
])
|
||||
|
||||
print_out(f"\r{progress} ", end="")
|
||||
|
@ -40,6 +40,19 @@ def format_duration(total_seconds):
|
||||
return "{} sec".format(seconds)
|
||||
|
||||
|
||||
def format_time(total_seconds):
|
||||
total_seconds = int(total_seconds)
|
||||
hours = total_seconds // 3600
|
||||
remainder = total_seconds % 3600
|
||||
minutes = remainder // 60
|
||||
seconds = total_seconds % 60
|
||||
|
||||
if hours:
|
||||
return f"{hours:02}:{minutes:02}:{seconds:02}"
|
||||
|
||||
return f"{minutes:02}:{seconds:02}"
|
||||
|
||||
|
||||
def read_int(msg, min, max, default):
|
||||
msg = msg + " [default {}]: ".format(default)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user