made back menu a thing

This commit is contained in:
0x01FE committed 2025-01-21 13:39:05 -06:00
1 parent d3b5a2120f
commit 51c0e43add
2 files changed
+88 -15

No files matched your search

+17 -10
View File
@@ -44,8 +44,8 @@ class TextualSubpyPlayer(App):
albums: list[SubSonic.Album] albums: list[SubSonic.Album]
conn: SubSonic.SubpyConn conn: SubSonic.SubpyConn
currentMenu: int currentMenu: Menus
lastMenu: int lastMenu: Menus
def compose(self) -> ComposeResult: def compose(self) -> ComposeResult:
self.currentMenu = Menus.MAIN self.currentMenu = Menus.MAIN
@@ -62,11 +62,16 @@ class TextualSubpyPlayer(App):
logging.debug('Menu Back Called') logging.debug('Menu Back Called')
match self.lastMenu: match self.lastMenu:
case Menus.MAIN: case Menus.MAIN:
logging.debug("Moving back to the main menu")
await self.main_menu() await self.main_menu()
case Menus.ARTISTALBUMS: case Menus.ARTISTALBUMS:
logging.debug("Moving back to Artist Albums")
await self.selectArtistAlbumView(self.selectedArtist.id) await self.selectArtistAlbumView(self.selectedArtist.id)
case Menus.ARTISTS: case Menus.ARTISTS:
logging.debug("Moving backt to artists")
await self.selectArtistsView() await self.selectArtistsView()
case _:
logging.debug(f"Last Menu unknown, {self.lastMenu}")
def on_key(self, event: events.Key) -> None: def on_key(self, event: events.Key) -> None:
logging.debug(f'Key Pressed {event.name}') logging.debug(f'Key Pressed {event.name}')
@@ -79,13 +84,13 @@ class TextualSubpyPlayer(App):
) )
def _getArtistMenu(self) -> OptionList: async def _getArtistMenu(self) -> OptionList:
self.artists = self.conn.getArtists() self.artists = self.conn.getArtists()
return OptionList(id="ArtistList") return OptionList(id=Menus.ARTISTS.value)
@on(OptionList.OptionSelected, "#mainMenu") @on(OptionList.OptionSelected, f'#{Menus.MAIN.value}')
async def selectMainMenu(self, event: OptionList.OptionSelected) -> None: async def selectMainMenu(self, event: OptionList.OptionSelected) -> None:
match event.option_id: match event.option_id:
case "BrowseArtists": case "BrowseArtists":
@@ -93,7 +98,7 @@ class TextualSubpyPlayer(App):
await self.selectArtistsView() await self.selectArtistsView()
@on(OptionList.OptionSelected, "#ArtistList") @on(OptionList.OptionSelected, f"#{Menus.ARTISTS.value}")
async def artistSelected(self, event: OptionList.OptionSelected) -> None: async def artistSelected(self, event: OptionList.OptionSelected) -> None:
logging.debug(f'Artist {event.option.prompt} Selected') logging.debug(f'Artist {event.option.prompt} Selected')
self.lastMenu = Menus.ARTISTS self.lastMenu = Menus.ARTISTS
@@ -129,7 +134,7 @@ class TextualSubpyPlayer(App):
for song in songs: for song in songs:
albumSongs.add_row(song.trackNumber, song.title, song.artist, song.duration, song.bitRate, key=song.id) albumSongs.add_row(song.trackNumber, song.title, song.artist, song.duration, song.bitRate, key=song.id)
self.query_one(f"#{self.lastMenu}").remove() self.query_one(f"#{self.lastMenu.value}").remove()
async def selectArtistAlbumView(self, artist_id: str) -> None: async def selectArtistAlbumView(self, artist_id: str) -> None:
logging.debug("Setting up album DataTable") logging.debug("Setting up album DataTable")
@@ -147,7 +152,7 @@ class TextualSubpyPlayer(App):
for album in self.albums: for album in self.albums:
albumTable.add_row(album.title, album.songCount, key=album.id) albumTable.add_row(album.title, album.songCount, key=album.id)
self.query_one(f"#{self.lastMenu}").remove() self.query_one(f"#{self.lastMenu.value}").remove()
async def main_menu(self) -> None: async def main_menu(self) -> None:
await self.mount(OptionList( await self.mount(OptionList(
@@ -158,10 +163,12 @@ class TextualSubpyPlayer(App):
id=Menus.MAIN.value id=Menus.MAIN.value
)) ))
self.query_one(f"#{self.lastMenu}").remove() self.query_one(f"#{self.currentMenu.value}").remove()
async def selectArtistsView(self) -> None: async def selectArtistsView(self) -> None:
artistList: OptionList = self._getArtistMenu() artistList: OptionList = await self._getArtistMenu()
self.currentMenu = Menus.ARTISTS
await self.mount(artistList) await self.mount(artistList)
+71 -5
View File
@@ -1,5 +1,71 @@
[2025-01-19 13:15:06,036] DEBUG in proactor_events: Using proactor: IocpProactor [2025-01-21 09:35:07,989] DEBUG in selector_events: Using selector: EpollSelector
[2025-01-19 13:15:06,436] DEBUG in textual-test: Key Pressed enter [2025-01-21 09:35:08,547] DEBUG in textual-test: Key Pressed enter
[2025-01-19 13:15:06,563] DEBUG in textual-test: Key Pressed enter [2025-01-21 09:35:08,548] DEBUG in textual-test: View Artists Selected
[2025-01-19 13:15:06,800] DEBUG in textual-test: Key Pressed backspace [2025-01-21 09:35:08,550] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-19 13:15:06,800] DEBUG in textual-test: Menu Back Called [2025-01-21 09:35:08,732] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getIndexes?u=pseudo&t=a97d230d3166610b05dd3a30bb673f32&s=AOT38T3U&v=1.16.1&c=testing HTTP/1.1" 200 None
[2025-01-21 09:35:09,360] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:09,601] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:09,775] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:10,338] DEBUG in textual-test: Key Pressed backspace
[2025-01-21 09:35:10,339] DEBUG in textual-test: Menu Back Called
[2025-01-21 09:35:10,339] DEBUG in textual-test: Moving back to the main menu
[2025-01-21 09:35:11,388] DEBUG in textual-test: Key Pressed enter
[2025-01-21 09:35:11,389] DEBUG in textual-test: View Artists Selected
[2025-01-21 09:35:11,399] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-21 09:35:11,572] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getIndexes?u=pseudo&t=a28d65a7ebd5359e9c2ec2b8fa30478b&s=ZWOC8KFV&v=1.16.1&c=testing HTTP/1.1" 200 None
[2025-01-21 09:35:12,120] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,620] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,656] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,680] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,711] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,742] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,772] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,803] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,834] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,864] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,895] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,926] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:12,956] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:13,209] DEBUG in textual-test: Key Pressed backspace
[2025-01-21 09:35:13,210] DEBUG in textual-test: Menu Back Called
[2025-01-21 09:35:13,210] DEBUG in textual-test: Moving back to the main menu
[2025-01-21 09:35:13,779] DEBUG in textual-test: Key Pressed enter
[2025-01-21 09:35:13,780] DEBUG in textual-test: View Artists Selected
[2025-01-21 09:35:13,781] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-21 09:35:13,968] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getIndexes?u=pseudo&t=2931ef5d69cd6d656d7f9c20b2968f1b&s=RYEHVX5N&v=1.16.1&c=testing HTTP/1.1" 200 None
[2025-01-21 09:35:14,284] DEBUG in textual-test: Key Pressed backspace
[2025-01-21 09:35:14,284] DEBUG in textual-test: Menu Back Called
[2025-01-21 09:35:14,284] DEBUG in textual-test: Moving back to the main menu
[2025-01-21 09:35:15,494] DEBUG in textual-test: Key Pressed enter
[2025-01-21 09:35:15,495] DEBUG in textual-test: View Artists Selected
[2025-01-21 09:35:15,496] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-21 09:35:15,678] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getIndexes?u=pseudo&t=0463fa3d1d9c1537d395eb7fc64a8b24&s=IMVSYTQU&v=1.16.1&c=testing HTTP/1.1" 200 None
[2025-01-21 09:35:15,792] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,291] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,322] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,353] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,383] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,413] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,444] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,474] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,505] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,542] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,565] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,596] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,626] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:16,911] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:17,093] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:17,252] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:17,663] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:17,950] DEBUG in textual-test: Key Pressed enter
[2025-01-21 09:35:17,951] DEBUG in textual-test: Artist Daft Punk Selected
[2025-01-21 09:35:17,951] DEBUG in textual-test: Setting up album DataTable
[2025-01-21 09:35:17,957] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-21 09:35:18,134] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getMusicDirectory?u=pseudo&t=306fc4f8690b4c90a4502e59d3e985f1&s=GKUV4BSR&v=1.16.1&c=testing&id=39bfe262546e5598284a148b1eb59d4a HTTP/1.1" 200 816
[2025-01-21 09:35:19,063] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:19,223] DEBUG in textual-test: Key Pressed down
[2025-01-21 09:35:19,805] DEBUG in textual-test: Key Pressed backspace
[2025-01-21 09:35:19,805] DEBUG in textual-test: Menu Back Called
[2025-01-21 09:35:19,805] DEBUG in textual-test: Moving backt to artists
[2025-01-21 09:35:19,807] DEBUG in connectionpool: Starting new HTTPS connection (1): music.0x01fe.net:443
[2025-01-21 09:35:19,989] DEBUG in connectionpool: https://music.0x01fe.net:443 "GET /rest/getIndexes?u=pseudo&t=151c6db8f37e0b900d3ca7c6384de338&s=SPHUFUL3&v=1.16.1&c=testing HTTP/1.1" 200 None