-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
84 lines (73 loc) · 2.15 KB
/
Copy pathindex.html
File metadata and controls
84 lines (73 loc) · 2.15 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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</head>
<body>
Enter Command: <input type="text" id="command" />
<br>
<button id="send" >Send</button><span class="message"></span>
<BR>
B3 = STOP
<BR>
B4 = START
<BR>
See <a href="https://github.com/donundeen/seeburgjukebox/blob/master/arduinolistener.rpi.node.js">https://github.com/donundeen/seeburgjukebox/blob/master/arduinolistener.rpi.node.js</a>
For a full list of codes and playlists.
<BR>
Or, make a spotify playlist and share with with donundeen on spotify, and send the url to dhu3@georgetown.edu, and we'll set it up on the jukebox.
Enjoy!
<script>
var group = "jukebox";
var feedname= "jukebox_command";
var key = false; // put AIO key here
function set_aio_key(){
google.script.run
.withFailureHandler(function(error){console.log(error);})
.withSuccessHandler(function(data){
key = data;
console.log("got key " + key);
}).get_aio_key();
}
function send_jukebox(value){
$(".message").text("sending command " + value + " ...");
var sendurl = "https://io.adafruit.com/api/groups/jukebox/send.json?x-aio-key="+key+"&"+feedname+"="+value;
$.ajax({
url : sendurl,
success: function(data){
console.log("send success");
$(".message").text("Command "+ value + " sent!");
console.log(data);
},
error: function (error){
console.log("recieve error");
$(".message").text("Hm, something went wrong... "+ error );
console.log(error);
}
});
}
$(document).ready(function(){
console.log("ready");
set_aio_key();
$("#send").click(function(){
var command = $("#command").val();
console.log("command " + command);
send_jukebox(command);
});
$("#command").on("keydown", function(e){
$(".message").text("");
if(e.keyCode == 13)
{
var command = $("#command").val();
console.log("command " + command);
send_jukebox(command);
}
});
});
</script>
</body>
</html>