30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import panel as pn
|
|
import argparse
|
|
|
|
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)
|
|
|
|
# Create a Panel app
|
|
pn.extension()
|
|
|
|
# Example usage of Hipsterfy
|
|
playlist_uri = 'https://open.spotify.com/playlist/294v6cT4ZWxtpsKQPZyC5h' # Replace with your playlist URI
|
|
app = create_panel_page(hipsterfy, playlist_uri)
|
|
|
|
# Serve the Panel app
|
|
pn.serve(app, port=args.port, websocket_origin='*', show=False)
|
|
|
|
if __name__ == "__main__":
|
|
panel_main()
|
|
|