add small player widget

This commit is contained in:
2025-08-04 16:43:46 +02:00
parent b6e90be86f
commit b954b93dd6
3 changed files with 192 additions and 10 deletions

View File

@ -1,5 +1,7 @@
import importlib.resources
import panel as pn
import argparse
import os
from hipsterfy.hipsterfy import Hipsterfy, HipsterfyPlaylist
from hipsterfy.panel_page import create_panel_page
@ -14,17 +16,19 @@ def parse_args():
def panel_main():
args = parse_args()
hipsterfy = Hipsterfy(args.spotify_client_id, args.spotify_client_secret)
# Create a Panel app
pn.extension()
# Example usage of Hipsterfy
playlist_uri = 'https://open.spotify.com/playlist/5grJs3PKyLE0cL5NYmkGIF' # Replace with your playlist URI
playlist_uri = 'https://open.spotify.com/playlist/5grJs3PKyLE0cL5NYmkGIF'
app = lambda: create_panel_page(hipsterfy, playlist_uri)
# Serve the Panel app
pn.serve(app, port=args.port, websocket_origin='*', show=False)
static_dir = os.path.join(os.path.dirname(__file__), "static")
pn.serve(
{
"/": app,
},
static_dirs={"qr": static_dir},
port=args.port,
websocket_origin='*',
show=False,
)
if __name__ == "__main__":
panel_main()