serverside

This commit is contained in:
2025-05-02 19:46:42 +02:00
parent 75932ec507
commit 3ee7fcab59
+30
View File
@@ -332,6 +332,36 @@ def remove_characters(string, character):
return string.replace(character, "")
@app.route('/get_share_list', methods=['POST'])
def get_share_list():
data = request.get_json()
entries = data.get('entries')
keywords = data.get('keywords')
# Validate entries
if not isinstance(entries, int) or not (1 <= entries <= 10):
return jsonify({'error': '"entries" must be an integer between 1 and 10.'}), 400
# Validate keywords list
if not isinstance(keywords, list) or not all(isinstance(k, str) for k in keywords):
return jsonify({'error': '"keywords" must be a list of strings.'}), 400
# Call external search
files = media_search_functions.find_matches(entries, keywords)
# Return each file path as a JSON list
return jsonify({'files': files}), 200
@app.route('/get_share_links', methods=['POST'])
def get_share_links():
data = request.get_json()
file_paths = data.get('file_paths')
# Validate file_paths list
if not isinstance(file_paths, list) or not all(isinstance(p, str) for p in file_paths):
return jsonify({'error': '"file_paths" must be a list of strings.'}), 400
# Call external publish
links = media_search_functions.publish(file_paths)
# Return list of published links
return jsonify({'links': links}), 200
@app.route("/stream", methods=["GET"])
def stream_music():
"""