-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlofi-music.py
26 lines (20 loc) · 905 Bytes
/
lofi-music.py
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
import argparse
import webbrowser
from random import choice
LOFI_MUSIC_URLS: list[str] = [ "https://www.youtube.com/watch?v=jfKfPfyJRdk",
"https://www.youtube.com/watch?v=GqnYz3Ty3Qc",
"https://www.youtube.com/watch?v=mxH_9dlUntU",
"https://www.youtube.com/watch?v=KJFWkgrwxJQ"]
def main():
parser = argparse.ArgumentParser(description='Play Lofi Music')
parser.add_argument('--play', action='store_true', help='Play the lofi music')
parser.add_argument('--stop', action='store_true', help='Stop the lofi music')
args = parser.parse_args()
if args.play:
webbrowser.open(choice(LOFI_MUSIC_URLS), new=1)
if args.stop:
for handle in webbrowser._tryorder:
if handle.name == 'chrome':
handle.popen.kill()
if __name__ == '__main__':
main()