-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecommendation.html
More file actions
86 lines (84 loc) · 4.86 KB
/
recommendation.html
File metadata and controls
86 lines (84 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<header class="header">
<div class="nav">
<h3>Dashboard></h3>
</div>
<div class="options-container">
<button class="options" onclick="opennav()"><img src="https://cdn-icons-png.freepik.com/256/552/552848.png"></button>
</div>
</header>
<script>
function executePythonScript() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost:8000/execute_script.php", true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
// Optionally, do something with the response
console.log(xhr.responseText);
}
};
xhr.send();
}
</script>
<body>
<div class="body">
<div class="main-container">
<div id="sidePanel" class="side-panel">
<button class="profile-buttons"><img class="icon-buttons"src="https://static-00.iconduck.com/assets.00/dashboard-icon-2048x2048-smbjyr2w.png"></button>
<a href="playlists.html"><button class="profile-buttons"><img class="icon-buttons" src="https://cdn1.iconfinder.com/data/icons/ios-11-glyphs/30/music_library-512.png"></button></a>
<button class="profile-buttons" onclick="executePythonScript()"><img class="icon-buttons" src="https://cdn-icons-png.freepik.com/256/1023/1023656.png"></button>
<a href="recommendation.html"><button class="profile-buttons"><img class="icon-buttons" src="https://cdn-icons-png.flaticon.com/512/3580/3580329.png"></button></a>
</div>
<div class="recommendation">
<div class="emotiondetected">
<h3 id="emotionText">sad</h3>
<button style="height:35px;width:100px;background-color:dimgrey;border:1px solid black;" onclick="generatePlaylist()">Generate</button>
</div>
<center>
<div class="showplaylist">
<iframe class="playlistFrame" id="playlist1" style="border-radius:12px; display:none" src="https://open.spotify.com/embed/playlist/7rGWH3tMJCIhyzde9s5MmF?utm_source=generator" height="450px" width="750px" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<iframe class="playlistFrame" id="playlist2" style="border-radius:12px; display:none" src="https://open.spotify.com/embed/playlist/5uxnFmvdTtKSwzRlrvwR3h?utm_source=generator" height="450px" width="750px" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<iframe class="playlistFrame" id="playlist3" style="border-radius:12px; display:none" src="https://open.spotify.com/embed/playlist/3CDqrZDcgn0phmqpcGaWyZ?utm_source=generator" height="450px" width="750px" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<iframe class="playlistFrame" id="playlist4" style="border-radius:12px; display:none" src="https://open.spotify.com/embed/playlist/2gLZE3J1FkyKzTB8tWF8QC?utm_source=generator" height="450px" width="750px" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
</div>
</center>
</div>
</div>
</div>
<script>
function generatePlaylist() {
var emotion = document.getElementById("emotionText").innerText.trim().toLowerCase();
// Determine which playlist to show based on the emotion
var selectedPlaylist;
switch (emotion) {
case 'happy':
selectedPlaylist = document.getElementById('playlist1');
break;
case 'sad':
selectedPlaylist = document.getElementById('playlist2');
break;
case 'anxious':
selectedPlaylist = document.getElementById('playlist3');
break;
default:
selectedPlaylist = document.getElementById('playlist4');
}
// Hide all playlists and show the selected playlist
var playlists = document.querySelectorAll('.playlistFrame');
playlists.forEach(function(playlist) {
playlist.style.display = 'none';
});
if (selectedPlaylist) {
selectedPlaylist.style.display = 'block';
}
}
</script>
</body>
</html>