Procházet zdrojové kódy

Merge remote-tracking branch 'origin/kylin' into kylin

dukuisong před 10 hodinami
rodič
revize
374737023e
1 změnil soubory, kde provedl 13 přidání a 3 odebrání
  1. 13 3
      api/api_app.py

+ 13 - 3
api/api_app.py

@@ -10,6 +10,7 @@ from flask import Flask, jsonify, request, current_app, send_from_directory, Res
 from flask_cors import CORS
 from requests_toolbelt import MultipartEncoder
 
+import config
 from config import file_type_map, TARGET_URL
 from tools.file_manager import get_file_md5
 from tools.logger_handle import logger
@@ -69,7 +70,7 @@ def proxy(path):
                 for key, value in request.form.items():
                     fields[key] = value
 
-            # 添加文件字段
+                # 添加文件字段
                 for key, file in request.files.items():
                     fields[key] = (file.filename, file.stream, file.mimetype)
 
@@ -216,7 +217,8 @@ def update_local_file():
     file_name = request.get_json()['file_name']
 
     try:
-        metadata = current_app.config['serve_client'].load_metadata(os.path.join(current_app.config['work_path'], file_name))
+        metadata = current_app.config['serve_client'].load_metadata(
+            os.path.join(current_app.config['work_path'], file_name))
 
         os.remove(os.path.join(current_app.config['work_path'], file_name))
         os.remove(os.path.join(current_app.config['work_path'], file_name + '.metadata'))
@@ -251,7 +253,8 @@ def file_state_list():
         if not os.path.exists(os.path.join(current_app.config['work_path'], file_name + '.metadata')):
             continue
 
-        metadata = current_app.config['serve_client'].load_metadata(os.path.join(current_app.config['work_path'], file_name))
+        metadata = current_app.config['serve_client'].load_metadata(
+            os.path.join(current_app.config['work_path'], file_name))
         file_info = {
             'file_name': file_name,
             'show_name': metadata['file_name'],
@@ -354,6 +357,13 @@ def refresh_token():
     return jsonify(app.config['serve_client'].login_reply)
 
 
+@logger.catch()
+@app.route('/get_yozo_path', methods=['POST'])
+def get_yozo_path():
+    yozo_path = os.path.basename(os.path.basename(config.yozoc))
+    return jsonify({'code': 1000, 'msg': '操作成功', 'data': yozo_path})
+
+
 @logger.catch()
 @app.route('/download_cloud_file', methods=['POST'])
 def download_cloud_file():