diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..cc4655d
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/playlistCreator.iml b/.idea/playlistCreator.iml
index 2c80e12..7317fc5 100644
--- a/.idea/playlistCreator.iml
+++ b/.idea/playlistCreator.iml
@@ -6,5 +6,6 @@
+
\ No newline at end of file
diff --git a/main.py b/main.py
index 8d71a10..c9753ec 100644
--- a/main.py
+++ b/main.py
@@ -24,17 +24,16 @@ def main_app():
@app.route('/add/', methods=['GET'])
def add_to_playlist(trackid):
if not os.getenv("n8n_webhook"):
- return 'n8n_webhook not set'
- if not trackid:
- return 'No trackid provided'
+ return render_template("add.html", response="No n8n webhook provided", comment="Please provide a n8n webhook in the .env file", type="error")
try:
data = requests.get(os.getenv("n8n_webhook") + "/" + trackid)
if data.json()['message'] == 'Workflow was started':
- return 'Track added to playlist'
+ return render_template("add.html", response="Track added to playlist successfully", comment="Enjoy the night \U0001f57a", type="success")
+
else:
- return 'Invalid response from server: {}'.format(data.text)
+ return render_template("add.html", response='Invalid response from server', comment=data.text, type="error")
except requests.exceptions.RequestException as e:
- return 'Request failed: {}'.format(e)
+ return render_template("add.html", response='Request failed', comment=e, type="error")
if __name__ == '__main__':
diff --git a/templates/add.html b/templates/add.html
index e69de29..fd6bfa0 100644
--- a/templates/add.html
+++ b/templates/add.html
@@ -0,0 +1,26 @@
+
+
+
+
+ FĂȘte de la musique
+
+ {{ bootstrap.load_css() }}
+
+
+
+
+
\ No newline at end of file