def do_GET(s): """Respond to a GET request.""" s.send_response(200) #s.send_header("Server", "Enigma2 Livestreamer") #s.send_header("Content-type", "text/html") s.end_headers() if KodiPlayer: url = resolver.resolveUrl(unquote(s.path[6:]).replace('&', '?', 1)) listitem = xbmcgui.ListItem(path=url) listitem.setInfo(type="Video", infoLabels={ "mediatype": "movie", "title": "LiveTV" }) xbmc.Player().play(url, listitem) return quality = "best" try: url, quality = player.GetStreamUrl(unquote(s.path[1:])) except Exception as ex: url = None xbmc.log("{0}".format(ex), 3) return try: Streamer(s.wfile, url, quality) except Exception as ex: xbmc.log("{0}".format(ex), 3) pass
def do_GET(s): """Respond to a GET request.""" s.send_response(200) s.send_header("Server", "Enigma2 Livestreamer") s.send_header("Content-type", "text/html") s.end_headers() quality = "best" try: import player url, quality = player.GetStreamUrl(unquote(s.path[1:])) except: url = None Stream(s.wfile, url, quality)
def serveFile(self, fURL, sendData): if (sendData): fURL, quality = player.GetStreamUrl(unquote(fURL)) session = Livestreamer() if '|' in fURL: sp = fURL.split('|') fURL = sp[0] headers = dict(urlparse.parse_qsl(sp[1])) session.set_option("http-headers", headers) session.set_option("http-ssl-verify", False) session.set_option("hls-segment-threads", 3) session.set_option("stream-segment-threads", 3) try: #streams = session.streams(fURL) channel = session.resolve_url(fURL) streams = channel.get_streams() except Exception as ex: traceback.print_exc(file=sys.stdout) self.send_response(403) self.send_response(200) #print "XBMCLocalProxy: Sending headers..." self.end_headers() #print "XBMCLocalProxy: Sending data..." fileout = self.wfile try: stream = streams[quality] try: response = stream.open() buf = 'INIT' while (buf != None and len(buf) > 0): buf = response.read(200 * 1024) fileout.write(buf) fileout.flush() response.close() fileout.close() #print time.asctime(), "Closing connection" except socket.error, e: #print time.asctime(), "Client Closed the connection." try: response.close() fileout.close() except Exception, e: return except Exception, e: traceback.print_exc(file=sys.stdout) response.close() fileout.close()
def do_GET(s): """Respond to a GET request.""" s.send_response(200) #s.send_header("Server", "Enigma2 Livestreamer") #s.send_header("Content-type", "text/html") s.end_headers() quality = "best" try: url, quality = player.GetStreamUrl(unquote(s.path[1:])) except: url = None try: Streamer(s.wfile, url, quality) except Exception as ex: xbmc.log("{0}".format(ex), 3) pass