54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
import TermTk as ttk
|
|
|
|
import SubSonic
|
|
|
|
u = 'pseudo'
|
|
p = 'telegram9dock-MICHEL'
|
|
conn = SubSonic.SubpyConn(u, p, "https://music.0x01fe.net")
|
|
|
|
echidna_id = "937004317800a879f0cddd471fb82387"
|
|
|
|
|
|
artists = conn.getArtists()
|
|
selected_artist = None
|
|
|
|
root = ttk.TTk(layout=ttk.TTkHBoxLayout())
|
|
|
|
# window = ttk.TTkWindow(parent=root, pos=(1, 1), size=(100, 30), title="Testing", border=True)
|
|
|
|
# ttk.TTkLabel(parent=window, pos=(5,2), text='hello world')
|
|
# artistMenu = ttk.TTkMenu(title="Artists", parent=root, border=True, size=(100, 30))
|
|
# for artist in artists:
|
|
# newButton = ttk.TTkMenuButton(text=artist.name, parent=artistMenu)
|
|
# artistMenu.addMenuItem(newButton)
|
|
|
|
artistList = ttk.TTkList(
|
|
name="Artists",
|
|
parent=root,
|
|
items=[artist.name for artist in artists]
|
|
)
|
|
|
|
albumList = ttk.TTkList(
|
|
name="ArtistAlbums",
|
|
parent=root
|
|
)
|
|
|
|
@ttk.pyTTkSlot(ttk.TTkWidgets.listwidget.TTkAbstractListItem)
|
|
def clickArtist(v: ttk.TTkWidgets.listwidget.TTkAbstractListItem):
|
|
# ttk.TTkLog.debug('test')
|
|
# print(v.text())
|
|
|
|
artist_name = v.text()
|
|
for artist in artists:
|
|
if artist.name == artist_name:
|
|
selected_artist = artist.id
|
|
|
|
albumList.removeItems(albumList.items())
|
|
albumList.addItems([album.name for album in conn.getArtistAlbums(selected_artist)])
|
|
|
|
|
|
artistList.itemClicked.connect(clickArtist)
|
|
|
|
root.mainloop()
|
|
|