Fabio De Simone 1 год назад
Родитель
Сommit
16d8c5e04d
2 измененных файлов с 9 добавлено и 5 удалено
  1. 1 5
      dune_weaver_flask/app.py
  2. 8 0
      dune_weaver_flask/modules/core/pattern_manager.py

+ 1 - 5
dune_weaver_flask/app.py

@@ -52,11 +52,7 @@ def restart():
 
 
 @app.route('/list_theta_rho_files', methods=['GET'])
 @app.route('/list_theta_rho_files', methods=['GET'])
 def list_theta_rho_files():
 def list_theta_rho_files():
-    files = []
-    for root, _, filenames in os.walk(pattern_manager.THETA_RHO_DIR):
-        for file in filenames:
-            relative_path = os.path.relpath(os.path.join(root, file), pattern_manager.THETA_RHO_DIR)
-            files.append(relative_path)
+    files = pattern_manager.list_theta_rho_files()
     return jsonify(sorted(files))
     return jsonify(sorted(files))
 
 
 @app.route('/upload_theta_rho', methods=['POST'])
 @app.route('/upload_theta_rho', methods=['POST'])

+ 8 - 0
dune_weaver_flask/modules/core/pattern_manager.py

@@ -25,6 +25,14 @@ current_playing_index = None
 current_playlist = None
 current_playlist = None
 is_clearing = False
 is_clearing = False
 
 
+def list_theta_rho_files():
+    files = []
+    for root, _, filenames in os.walk(THETA_RHO_DIR):
+        for file in filenames:
+            relative_path = os.path.relpath(os.path.join(root, file), THETA_RHO_DIR)
+            files.append(relative_path)
+    return files
+
 def parse_theta_rho_file(file_path):
 def parse_theta_rho_file(file_path):
     """Parse a theta-rho file and return a list of (theta, rho) pairs."""
     """Parse a theta-rho file and return a list of (theta, rho) pairs."""
     coordinates = []
     coordinates = []