Format playing video differently, show in !list
This commit is contained in:
parent
773a174007
commit
ef7c146897
1 changed files with 20 additions and 5 deletions
|
|
@ -93,9 +93,18 @@ class Playlist:
|
||||||
return f"{hours:02}:{minutes:02}:{seconds:02}"
|
return f"{hours:02}:{minutes:02}:{seconds:02}"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_list_entry(video, position, played_in):
|
def format_list_entry(video, position=None, played_in=None):
|
||||||
played_in = Playlist.format_duration(played_in)
|
if position is None:
|
||||||
lines = [f"[{position:2}] {video.title!r} will be played in [{played_in}]"]
|
position = "playing"
|
||||||
|
|
||||||
|
info = f"[{position:2}] {video.title!r}"
|
||||||
|
|
||||||
|
if played_in is not None:
|
||||||
|
played_in = Playlist.format_duration(played_in)
|
||||||
|
info = f"{info} will be played in [{played_in}]"
|
||||||
|
|
||||||
|
#lines = [f"[{position:2}] {video.title!r} will be played in [{played_in}]"]
|
||||||
|
lines = [info]
|
||||||
|
|
||||||
blocked = None
|
blocked = None
|
||||||
if video.blocked is not None:
|
if video.blocked is not None:
|
||||||
|
|
@ -433,8 +442,8 @@ class ArgonDJBot(yaboli.Bot):
|
||||||
|
|
||||||
playing = self.playlist.play(room)
|
playing = self.playlist.play(room)
|
||||||
if playing:
|
if playing:
|
||||||
video, _, until = in_playlist[0]
|
video, _, _ = in_playlist[0]
|
||||||
info = Playlist.format_list_entry(video, "playing", until)
|
info = Playlist.format_list_entry(video)
|
||||||
lines.extend(info)
|
lines.extend(info)
|
||||||
|
|
||||||
in_playlist = [(v, p-1, u) for v, p, u in in_playlist[1:]]
|
in_playlist = [(v, p-1, u) for v, p, u in in_playlist[1:]]
|
||||||
|
|
@ -480,6 +489,12 @@ class ArgonDJBot(yaboli.Bot):
|
||||||
@yaboli.command("list", "l")
|
@yaboli.command("list", "l")
|
||||||
async def command_list(self, room, message):
|
async def command_list(self, room, message):
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
|
if self.playlist.playing():
|
||||||
|
(video, _) = self.playlist.playing_video
|
||||||
|
info = Playlist.format_list_entry(video)
|
||||||
|
lines.extend(info)
|
||||||
|
|
||||||
for position, (video, _) in self.playlist.items():
|
for position, (video, _) in self.playlist.items():
|
||||||
until = self.playlist.playtime_until(position)
|
until = self.playlist.playtime_until(position)
|
||||||
info = Playlist.format_list_entry(video, position, until)
|
info = Playlist.format_list_entry(video, position, until)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue