-
Notifications
You must be signed in to change notification settings - Fork 21
/
romonitor.php
36 lines (31 loc) · 1002 Bytes
/
romonitor.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
<?php
const IS_ROMONITOR = true;
require_once ("includes/vars.php");
require_once ("includes/functions.php");
$opts = [
'currenthost' => null
];
$params = getopt('', ['currenthost:']);
$params = array_map('rawurldecode', $params);
$opts = array_merge($opts, $params);
prefs::set_pref(['currenthost' => $opts['currenthost']]);
logger::mark("ROMONITOR", "Using Player ".prefs::currenthost());
// Probe the player type
while (prefs::get_pref('player_backend') == null) {
logger::info('ROMONITOR', 'Probing Player type for player',prefs::currenthost());
$player = new base_mpd_player();
if (prefs::get_pref('player_backend') == null) {
logger::warn('ROMONITOR', 'Could not connect to player',prefs::currenthost(),'sleeping for 5 minutes');
sleep(300);
}
}
$player->close_mpd_connection();
$player = new player();
register_shutdown_function('close_mpd');
$player->set_consume_state();
$player->idle_system_loop();
function close_mpd() {
global $player;
$player->close_mpd_connection();
}
?>