diff --git a/textual1/app.py b/textual1/app.py index 51d6c09..2d4e427 100644 --- a/textual1/app.py +++ b/textual1/app.py @@ -411,7 +411,8 @@ class CoverArtPixels(Container): class QueueTable(Widget): BINDINGS = [ - ("p", "play_queue_song()", "Play") + ("p", "play_queue_song()", "Play"), + ("f", "star_song()", "Star Song") ] song_ids: list[str] = [] @@ -472,6 +473,14 @@ class QueueTable(Widget): # Update the visual queue table self.update_queue() + async def action_star_song(self) -> None: + queue: list[SubSonic.Song] = app.user_queue.copy() + queue.extend(app.song_queue) + + song = queue[self.selected_row_key] + + asyncio.create_task(asyncio.to_thread(conn.star, song.id)) + # Fine to be a static renderable because it's not big enough to need a scroll class NowPlayingInfo(Container): song = reactive[SubSonic.Song | None](None, layout=True) @@ -551,6 +560,7 @@ class TextualSubpyPlayer(App): ("s", "skip()", "⏭"), ("d", "volume_down()", "🕩"), ("u", "volume_up()", "🕪"), + ("F", "star_c_song()", "Star Current Song"), ("f1", "switch_mode('main')", "Overview"), ("f2", "switch_mode('artists')", "Artists"), ("f3", "switch_mode('albums')", "Albums"), @@ -728,6 +738,10 @@ class TextualSubpyPlayer(App): self.song_queue.append(song) self.update_queue_table() + async def action_star_c_song(self) -> None: + if self.currently_playing: + asyncio.create_task(asyncio.to_thread(conn.star, self.currently_playing.id)) + def on_key(self, event: events.Key) -> None: logging.debug(event.key)