-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·58 lines (46 loc) · 1.55 KB
/
Copy pathmain.py
File metadata and controls
executable file
·58 lines (46 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
main.py
-------
Entry point for Spotify AI DJ.
Routing:
No arguments -> GUI mode (opens the graphical window)
"any text request" -> CLI mode (plays immediately, no GUI)
--set-key KEY -> Save Gemini API key from terminal
--help / -h -> Print usage
Examples:
python main.py # open GUI
python main.py "dark techno" # play immediately
python main.py --set-key AIza... # save API key
python main.py --continue # more tracks, same vibe
dj "late night lo-fi" # same as above via symlink
"""
import sys
def main() -> None:
args = sys.argv[1:]
# No arguments - launch the GUI
if not args:
from app import run
run()
return
# --help / -h
if args[0] in ("--help", "-h"):
from cli import print_help
print_help()
return
# --set-key KEY (save Gemini API key from terminal without opening GUI)
if args[0] == "--set-key":
if len(args) < 2:
print("Usage: python main.py --set-key YOUR_KEY_HERE")
sys.exit(1)
from cli import run_set_key
sys.exit(run_set_key(args[1]))
# --continue (extend current session with fresh tracks, same vibe)
if args[0] == "--continue":
from cli import run_cli
sys.exit(run_cli("", is_continue=True))
# Any other argument is treated as a music request for CLI mode
request = " ".join(args)
from cli import run_cli
sys.exit(run_cli(request))
if __name__ == "__main__":
main()