Replace Tracks.print() calls with new rich tree

This commit is contained in:
rlaphoenix 2023-02-25 13:10:49 +00:00
parent 48e35fb4c4
commit 984582d19d
2 changed files with 4 additions and 9 deletions

View File

@ -332,7 +332,8 @@ class dl:
title.tracks.sort_chapters()
console.log("> All Tracks:")
title.tracks.print()
available_tracks = title.tracks.tree()
console.log(available_tracks)
console.log("> Selected Tracks:") # log early so errors logs make sense
@ -413,8 +414,8 @@ class dl:
if not subs_only:
title.tracks.subtitles.clear()
title.tracks.print()
selected_tracks = title.tracks.tree()
console.log(selected_tracks)
if list_:
continue # only wanted to see what tracks were available and chosen

View File

@ -151,12 +151,6 @@ class Tracks:
if duplicates:
log.warning(f" - Found and skipped {duplicates} duplicate tracks...")
def print(self, level: int = logging.INFO) -> None:
"""Print the __str__ to log at a specified level."""
log = logging.getLogger("Tracks")
for line in str(self).splitlines(keepends=False):
log.log(level, line)
def sort_videos(self, by_language: Optional[Sequence[Union[str, Language]]] = None) -> None:
"""Sort video tracks by bitrate, and optionally language."""
if not self.videos: