-
Notifications
You must be signed in to change notification settings - Fork 0
/
screamer.php
65 lines (45 loc) · 955 Bytes
/
screamer.php
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
<?php
error_reporting(E_ERROR);
ini_set('display_errors', true);
require "sonos.controller.php";
if (isset($_POST['action'])) {
$IP_sonos = $_POST['IP'];
switch ($_POST['action']) {
case 'play' :
play($IP_sonos);
break;
case 'stop' :
stop($IP_sonos);
break;
case 'pause' :
pause($IP_sonos);
break;
case 'current' :
getCurrent($IP_sonos);
break;
}
}
function play($IP_sonos) {
$sonos = new SonosController($IP_sonos);
$sonos -> Play();
}
function stop($IP_sonos) {
$sonos = new SonosController($IP_sonos);
$sonos -> Stop();
}
function pause($IP_sonos) {
$sonos = new SonosController($IP_sonos);
$sonos -> Pause();
}
function getCurrent($IP_sonos) {
$sonos = new SonosController($IP_sonos);
$result = $sonos -> GetPositionInfo();
$titleArtist = $result["TitleArtist"];
$title = $result["Title"];
if ($title != '') {
echo $titleArtist, " / ", $title;
} else {
echo "";
}
}
?>