hotstar-hound.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:hotstar-hound 作者: baddymaster 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号