Skip to content

Commit

Permalink
fix server
Browse files Browse the repository at this point in the history
  • Loading branch information
matthuisman committed Jul 5, 2022
1 parent 7141701 commit ac28348
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def Addon_init(self, id=None):

self._settings_defaults = {
'live_play_type': '1', #From live
'default_quality': '1', #Best
'default_quality': '1', #Best (requires proxy to be running)
'persist_cache': 'false',
'use_ia_hls_live': 'false',
'use_ia_hls_vod': 'false',
Expand Down
16 changes: 8 additions & 8 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

import proxy

proxy.SETTINGS['proxy_type'] = proxy.HTTP
proxy.SETTINGS['proxy_type'] = proxy.HTTP
proxy.SETTINGS['interactive'] = False

class MainHandler(BaseHTTPRequestHandler):
Expand All @@ -16,7 +16,7 @@ def do_GET(self):
def output_http(listitem):
self._redirected = True
self.send_response(302)
self.send_header('Location', listitem.getPath())
self.send_header('Location', listitem.getPath().split('|')[0])
self.end_headers()

def _print(text):
Expand All @@ -32,19 +32,19 @@ def _print(text):
self.send_response(500)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write("<html><body>{}</body></html>".format(e))
self.wfile.write("<html><body>{}</body></html>".format(e).encode('utf8'))
else:
if not self._redirected:
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write("<html><body>{}</body></html>".format('\n'.join(self._lines)))
self.wfile.write("<html><body>{}</body></html>".format('\n'.join(self._lines)).encode('utf8'))
else:
self.send_response(404)

def run(port=80):
server_address = ('', port)
httpd = HTTPServer(server_address, MainHandler)
httpd = ThreadingHTTPServer(server_address, MainHandler)
httpd.serve_forever()

if __name__ == "__main__":
Expand All @@ -53,4 +53,4 @@ def run(port=80):
if len(argv) == 2:
run(port=int(argv[1]))
else:
run()
run()

0 comments on commit ac28348

Please sign in to comment.