def openStream(stream_url):
global quality, stream_url_hls, streams
print(
'''
----------------- Menu -----------------
1. Open stream in default Browser
2. Open stream in default Media Player
3. Copy link to clipboard
4. Display link on console
5. Exit
''')
choice = raw_input('Enter choice : ')
try:
choice = int(choice)
except ValueError:
print('Please enter an integer. Exiting.\n')
sys.exit(0)
if choice == 1:
try:
browser = wb.get('safari')
except wb.Error:
try:
browser = wb.get('chrome')
except wb.Error:
try:
browser = wb.get('google-chrome')
except wb.Error:
browser = wb.get()
browser.open_new_tab(stream_url)
elif choice == 2:
os.system("livestreamer '" + stream_url_hls + "' '" + quality + "'")
#os.system("vlc " + stream_url)
elif choice == 3:
pyperclip.copy(stream_url)
print('Streaming link copied to clipboard.\n')
elif choice == 4:
print('Stream link : %s\n' % stream_url)
elif choice == 5:
print('Exiting.\n')
sys.exit(0)
else:
print('Incorrect choice. Exiting.\n')
sys.exit(0)
评论列表
文章目录