diff --git a/hipsterfy/main.py b/hipsterfy/main.py index 7cb432c..cf58075 100644 --- a/hipsterfy/main.py +++ b/hipsterfy/main.py @@ -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() - \ No newline at end of file diff --git a/hipsterfy/static/scan.html b/hipsterfy/static/scan.html new file mode 100644 index 0000000..f038ac6 --- /dev/null +++ b/hipsterfy/static/scan.html @@ -0,0 +1,175 @@ + + + + + Spotify QR-Scanner + + + + +
+

Spotify QR-Scanner

+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ad13de0..2ee2b46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,9 @@ authors = [ "Jonas Weinz" ] readme = "README.md" +include = [ + "hipsterfy/static/*" +] [build-system]