35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
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
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(description="Hipsterfy - A Spotify Playlist Manager")
|
|
parser.add_argument('--spotify_client_id', type=str, required=True, help='Spotify Client ID')
|
|
parser.add_argument('--spotify_client_secret', type=str, required=True, help='Spotify Client Secret')
|
|
parser.add_argument('--port', type=int, default=5006, help='Port to run the Panel app on')
|
|
return parser.parse_args()
|
|
|
|
def panel_main():
|
|
args = parse_args()
|
|
hipsterfy = Hipsterfy(args.spotify_client_id, args.spotify_client_secret)
|
|
playlist_uri = 'https://open.spotify.com/playlist/5grJs3PKyLE0cL5NYmkGIF'
|
|
app = lambda: create_panel_page(hipsterfy, playlist_uri)
|
|
|
|
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()
|