diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95624dc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +temp/* \ No newline at end of file diff --git a/Gateway.py b/Gateway.py index 79a2527..7916399 100644 --- a/Gateway.py +++ b/Gateway.py @@ -59,7 +59,7 @@ class GenericGateway(object): logger.info("Register route: %s", route.path) def proxy_request(*args, **kwargs): - + print('成功代理', route.name) upstream_path = route.upstream_path for p_name in route.upstream_params: v = get_params_from_context(p_name, kwargs) @@ -79,6 +79,7 @@ class GenericGateway(object): if request.form: upstream_req_info['data'] = request.form + # print('upstream_req_info', upstream_req_info) for pipe_handler in route.inbound_pipes(): upstream_req_info, args, kwargs = pipe_handler(upstream_req_info, *args, **kwargs) @@ -88,20 +89,23 @@ class GenericGateway(object): upstream_req_info['headers'] = {k: v for k, v in upstream_req_info['headers'].items()} upstream_req_info['headers'].pop('Content-Type', None) upstream_req_info['headers'].pop('content-type', None) + + # print('upstream_req_info', upstream_req_info) resp = requests.request(**upstream_req_info) + # print(resp.headers) status = resp.status_code content = None headers = resp.headers - + print(route.outbound_pipes()) for pipe_handler in route.outbound_pipes(): resp, headers, status, content = pipe_handler(resp, headers, status, content, *args, **kwargs) content = make_response(content or resp.content) for h_name, h_value in (headers or {}).items(): + # print(h_name, h_value) content.headers[h_name] = h_value - + # print('content', headers) return content, status - # 修改函数名称:Flask route注册使用func name必须唯一 proxy_request.__name__ = route.name return proxy_request diff --git a/__pycache__/ExceptionHandler.cpython-310.pyc b/__pycache__/ExceptionHandler.cpython-310.pyc index 87cb1f0..387f478 100644 Binary files a/__pycache__/ExceptionHandler.cpython-310.pyc and b/__pycache__/ExceptionHandler.cpython-310.pyc differ diff --git a/__pycache__/Gateway.cpython-310.pyc b/__pycache__/Gateway.cpython-310.pyc index 17968a3..4c86102 100644 Binary files a/__pycache__/Gateway.cpython-310.pyc and b/__pycache__/Gateway.cpython-310.pyc differ diff --git a/__pycache__/Route.cpython-310.pyc b/__pycache__/Route.cpython-310.pyc index b493bd3..dca16db 100644 Binary files a/__pycache__/Route.cpython-310.pyc and b/__pycache__/Route.cpython-310.pyc differ diff --git a/__pycache__/utils.cpython-310.pyc b/__pycache__/utils.cpython-310.pyc index 29a9d53..f69da4e 100644 Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ diff --git a/app.py b/app.py index 340fc8a..c11c4b4 100644 --- a/app.py +++ b/app.py @@ -63,4 +63,4 @@ class GatewayServer(): gateway_server = GatewayServer() app = gateway_server.app -app.run(port=5000, debug=True) \ No newline at end of file +app.run(port=15000, host="192.168.124.12", debug=True) \ No newline at end of file diff --git a/plugin/MusicHandler.py b/plugin/MusicHandler.py index e2662d9..c0a32ba 100644 --- a/plugin/MusicHandler.py +++ b/plugin/MusicHandler.py @@ -8,8 +8,9 @@ class MusicHandler(OutboundHandler): :return: (request, args, kwargs) """ # raise NotImplementedError - print("222") - print(status) + print('music handler started') if status == 200: navidromePlaylistSync.start() + + headers['Transfer-Encoding'] = 'gzip' return [response, headers, status, content] \ No newline at end of file diff --git a/plugin/NavidromePlaylistSync/__pycache__/__init__.cpython-310.pyc b/plugin/NavidromePlaylistSync/__pycache__/__init__.cpython-310.pyc index e37f39b..b60cb19 100644 Binary files a/plugin/NavidromePlaylistSync/__pycache__/__init__.cpython-310.pyc and b/plugin/NavidromePlaylistSync/__pycache__/__init__.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/__pycache__/app.cpython-310.pyc b/plugin/NavidromePlaylistSync/__pycache__/app.cpython-310.pyc index bfae285..c383a44 100644 Binary files a/plugin/NavidromePlaylistSync/__pycache__/app.cpython-310.pyc and b/plugin/NavidromePlaylistSync/__pycache__/app.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/__pycache__/resetDir.cpython-310.pyc b/plugin/NavidromePlaylistSync/__pycache__/resetDir.cpython-310.pyc index b4a6edb..9dc2051 100644 Binary files a/plugin/NavidromePlaylistSync/__pycache__/resetDir.cpython-310.pyc and b/plugin/NavidromePlaylistSync/__pycache__/resetDir.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/__pycache__/saveFile.cpython-310.pyc b/plugin/NavidromePlaylistSync/__pycache__/saveFile.cpython-310.pyc index 160ec5d..7567773 100644 Binary files a/plugin/NavidromePlaylistSync/__pycache__/saveFile.cpython-310.pyc and b/plugin/NavidromePlaylistSync/__pycache__/saveFile.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/__pycache__/sync.cpython-310.pyc b/plugin/NavidromePlaylistSync/__pycache__/sync.cpython-310.pyc index b0b1ec6..0e7b77f 100644 Binary files a/plugin/NavidromePlaylistSync/__pycache__/sync.cpython-310.pyc and b/plugin/NavidromePlaylistSync/__pycache__/sync.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/api/__pycache__/__init__.cpython-310.pyc b/plugin/NavidromePlaylistSync/api/__pycache__/__init__.cpython-310.pyc index ca8fbc2..993e968 100644 Binary files a/plugin/NavidromePlaylistSync/api/__pycache__/__init__.cpython-310.pyc and b/plugin/NavidromePlaylistSync/api/__pycache__/__init__.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/api/__pycache__/playlist.cpython-310.pyc b/plugin/NavidromePlaylistSync/api/__pycache__/playlist.cpython-310.pyc index c2640a0..682e2cf 100644 Binary files a/plugin/NavidromePlaylistSync/api/__pycache__/playlist.cpython-310.pyc and b/plugin/NavidromePlaylistSync/api/__pycache__/playlist.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/api/__pycache__/token.cpython-310.pyc b/plugin/NavidromePlaylistSync/api/__pycache__/token.cpython-310.pyc index fe69326..6dd9f8a 100644 Binary files a/plugin/NavidromePlaylistSync/api/__pycache__/token.cpython-310.pyc and b/plugin/NavidromePlaylistSync/api/__pycache__/token.cpython-310.pyc differ diff --git a/plugin/NavidromePlaylistSync/app.py b/plugin/NavidromePlaylistSync/app.py index d42c50f..69694b4 100644 --- a/plugin/NavidromePlaylistSync/app.py +++ b/plugin/NavidromePlaylistSync/app.py @@ -25,9 +25,9 @@ def start(): sync() - if len(delPlaylistIds) > 0: - for delId in delPlaylistIds: - delPlaylist(delId, token) + # if len(delPlaylistIds) > 0: + # for delId in delPlaylistIds: + # delPlaylist(delId, token) if __name__ == 'main': start() diff --git a/plugin/NavidromePlaylistSync/temp/测试.m3u b/plugin/NavidromePlaylistSync/temp/测试.m3u deleted file mode 100644 index b8c4beb..0000000 --- a/plugin/NavidromePlaylistSync/temp/测试.m3u +++ /dev/null @@ -1,3 +0,0 @@ -#EXTM3U -#EXTINF:317,浮森かや子 - お隣はだあれ -/music/浮森かや子/お隣はだあれ.mp3 diff --git a/plugin/NavidromePlaylistSync/temp/测试2.m3u b/plugin/NavidromePlaylistSync/temp/测试2.m3u deleted file mode 100644 index fcd7187..0000000 --- a/plugin/NavidromePlaylistSync/temp/测试2.m3u +++ /dev/null @@ -1 +0,0 @@ -#EXTM3U diff --git a/plugin/__pycache__/MusicHandler.cpython-310.pyc b/plugin/__pycache__/MusicHandler.cpython-310.pyc index 72f2f98..f6162f2 100644 Binary files a/plugin/__pycache__/MusicHandler.cpython-310.pyc and b/plugin/__pycache__/MusicHandler.cpython-310.pyc differ diff --git a/plugin/__pycache__/__init__.cpython-310.pyc b/plugin/__pycache__/__init__.cpython-310.pyc index 73d447c..9b8cb48 100644 Binary files a/plugin/__pycache__/__init__.cpython-310.pyc and b/plugin/__pycache__/__init__.cpython-310.pyc differ diff --git a/test2.py b/test2.py deleted file mode 100644 index 4690cf3..0000000 --- a/test2.py +++ /dev/null @@ -1,24 +0,0 @@ -from flask import Flask - -app = Flask(__name__) - -@app.route("/api/tracks") -def hello_tracks(): - return "

Hello, tracks!

" - -@app.route("/api/playlist//tracks") -def hello_playlist(): - return "

Hello, playlist!

" - -app.run( - host = '127.0.0.1', - port = 7777, - debug = True -) - -if __name__== '__main__': - app.run( - host = '127.0.0.1', - port = 7777, - debug = True - ) \ No newline at end of file