diff options
-rwxr-xr-x | main.py | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -15,10 +15,8 @@ url = 'https://www.bilibili.com/video/' cur = sys.argv[1] while True: # First start mpv in the background - # Disable mpv keyboard input - # That took me a stupidly long time to figure out # Also enable subtitles because why not - proc = subprocess.Popen(['mpv', '--no-video', '--no-input-terminal', '--slang=zh-CN', url + cur]) + proc = subprocess.Popen(['mpv', '--no-video', '--slang=zh-CN', url + cur]) # The try finally block is to ensure that proc gets killed no matter what try: # I could use the Python requests library... @@ -42,13 +40,14 @@ while True: # Print it out the smart way! # Who needs loops smh print(*enumerate(rec), sep='\n') - # Choose a recommended video - # If you don't like any, just stop the app, burn your computer, and try again - cur = rec[int(input())][0] + proc.wait() finally: # Kill mpv with fire because sometimes it likes the music too much and refuses to stop if you ask nicely proc.kill() - # Give instant feedback so it doesn't look like the app is hanging - print(cur) - # I have more comments than code so I must be doing something right right? - # Right??? + # Choose a recommended video + # If you don't like any, just stop the app, burn your computer, and try again + cur = rec[int(input("Choose next: "))][0] + # Give instant feedback so it doesn't look like the app is hanging + print(cur) + # I have more comments than code so I must be doing something right right? + # Right??? |