mirror of https://github.com/devine-dl/devine.git
Implement verbose arg on tree method of Movies and Album
This commit is contained in:
parent
375ccd7638
commit
401d0481df
|
@ -137,17 +137,18 @@ class Movies(SortedKeyList, ABC):
|
||||||
# TODO: Assumes there's only one movie
|
# TODO: Assumes there's only one movie
|
||||||
return self[0].name + (f" ({self[0].year})" if self[0].year else "")
|
return self[0].name + (f" ({self[0].year})" if self[0].year else "")
|
||||||
|
|
||||||
def tree(self, *_) -> Tree:
|
def tree(self, verbose: bool = False) -> Tree:
|
||||||
num_movies = len(self)
|
num_movies = len(self)
|
||||||
tree = Tree(
|
tree = Tree(
|
||||||
f"{num_movies} Movie{['s', ''][num_movies == 1]}",
|
f"{num_movies} Movie{['s', ''][num_movies == 1]}",
|
||||||
guide_style="bright_black"
|
guide_style="bright_black"
|
||||||
)
|
)
|
||||||
for movie in self:
|
if verbose:
|
||||||
tree.add(
|
for movie in self:
|
||||||
f"[bold]{movie.name}[/] [bright_black]({movie.year or '?'})",
|
tree.add(
|
||||||
guide_style="bright_black"
|
f"[bold]{movie.name}[/] [bright_black]({movie.year or '?'})",
|
||||||
)
|
guide_style="bright_black"
|
||||||
|
)
|
||||||
|
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
|
|
|
@ -132,17 +132,18 @@ class Album(SortedKeyList, ABC):
|
||||||
return super().__str__()
|
return super().__str__()
|
||||||
return f"{self[0].artist} - {self[0].album} ({self[0].year or '?'})"
|
return f"{self[0].artist} - {self[0].album} ({self[0].year or '?'})"
|
||||||
|
|
||||||
def tree(self, *_) -> Tree:
|
def tree(self, verbose: bool = False) -> Tree:
|
||||||
num_songs = len(self)
|
num_songs = len(self)
|
||||||
tree = Tree(
|
tree = Tree(
|
||||||
f"{num_songs} Song{['s', ''][num_songs == 1]}",
|
f"{num_songs} Song{['s', ''][num_songs == 1]}",
|
||||||
guide_style="bright_black"
|
guide_style="bright_black"
|
||||||
)
|
)
|
||||||
for song in self:
|
if verbose:
|
||||||
tree.add(
|
for song in self:
|
||||||
f"[bold]Track {song.track:02}.[/] [bright_black]({song.name})",
|
tree.add(
|
||||||
guide_style="bright_black"
|
f"[bold]Track {song.track:02}.[/] [bright_black]({song.name})",
|
||||||
)
|
guide_style="bright_black"
|
||||||
|
)
|
||||||
|
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue