mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Audition
This commit is contained in:
@@ -369,6 +369,37 @@ def add_request():
|
||||
)
|
||||
return return_data
|
||||
|
||||
@app.route("/create_priority_playlist", methods=["POST"])
|
||||
def create_priority_playlist():
|
||||
"""
|
||||
The function `create_priority_playlist` receives a POST request with a JSON payload, logs the received
|
||||
item, adds it to a music file list, and returns a success message along with the updated record.
|
||||
|
||||
:return: A tuple containing a JSON response and a status code.
|
||||
The JSON response includes keys `isError`,
|
||||
`message`, `statusCode`, and `data`, with values
|
||||
indicating the success of the operation and the
|
||||
data that was received and added to the `music_file_list`.
|
||||
The status code returned is 200,indicating a successful response.
|
||||
"""
|
||||
record = json.loads(request.data)
|
||||
app.logger.info(record)
|
||||
app.logger.info(record["lista_slow"])
|
||||
app.logger.info(record["UUID"])
|
||||
app.logger.info(record["dlugosc_plejlisty"])
|
||||
return_data = wyszukaj(
|
||||
record["lista_slow"], record["dlugosc_plejlisty"], app.logger, False
|
||||
)
|
||||
with open(
|
||||
"/home/pi/Conjurer/request.playlist", "a", encoding="utf-8"
|
||||
) as s_file:
|
||||
for item in return_data:
|
||||
s_file.write(item[1] + "\n")
|
||||
return_data = (
|
||||
jsonify(isError=False, message="Success", statusCode=200, data={"status": "OK"}),
|
||||
200,
|
||||
)
|
||||
return return_data
|
||||
|
||||
|
||||
@app.route("/add_to_priority", methods=["POST"])
|
||||
|
||||
Reference in New Issue
Block a user