stream.py 文件源码

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

项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码
def run(self):
        global httpd, ui_player
        print('starting server...')
        server_address = ('', self.port)
        server_start = False
        try:
            httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
            if self.https_allow and self.cert_file:
                if os.path.exists(self.cert_file):
                    httpd.socket = ssl.wrap_socket(
                        httpd.socket, certfile=self.cert_file, 
                        ssl_version=ssl.PROTOCOL_TLSv1_2)
            server_start = True
        except:
            txt = 'Your local IP changed..or port is blocked\n..Trying to find new IP'
            send_notification(txt)
            self.ip = get_ip()
            txt = 'Your New Address is '+self.ip + '\n Please restart the player'
            send_notification(txt)
            change_config_file(self.ip, self.port)
            server_address = (self.ip, self.port)
            self.ui.local_ip = self.ip
            #httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
        if server_start:
            print('running server...at..'+self.ip+':'+str(self.port))
            httpd.serve_forever()
        else:
            print('server..not..started..')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号