<head> <title>mpd remote</title> <meta http-equiv="cache-control" content="must-revalidate" forua=true /> <meta http-equiv="cache-control" content="no-cache" forua=true /> <style type="text/css"> A, A:visited { color: blue; } </style> </head> <body> BLK1; require_once 'mpd-class/mpd.class.php'; $mpd = new mpd($host, $port, $password); $pl = $mpd->GetDir(); if (isset($_GET['setTo'])) { if (in_array($_GET['setTo'], $pl['playlist'])) { //test for illegit data $mpd->PLLoad($_GET['setTo']); } elseif (isset($_GET['clear'])) { $mpd->PLClear(); } elseif (isset($_GET['del'])) { //mpd.class tests for integer $mpd->PLRemove($_GET['del']); } elseif (isset($_GET['play'])) { //mpd.class tests for integer $mpd->SkipTo($_GET['play']); $mpd->Play(); } }
$refresh = ($times[1] - $times[0]) * 1000 + 500; if ($refresh < 1) { $refresh = 30500; } echo '<script type="text/javascript">setTimeout("location.reload(true);", ' . $refresh . ');</script>' . "\n"; } if (isset($_POST['toadd'])) { $object = $_POST['toadd']; $files = explode("\n", $mpd->SendCommand('lsinfo')); foreach ($files as $row) { $file = explode(':', $row); $thefiles[][$file[0]] = ltrim($file[1]); } foreach ($thefiles as $search) { if (array_search($object, $search) == 'directory') { $dir = $mpd->GetDir($object); foreach ($dir as $addRow) { $addArr[] = $addRow['file']; } $mpd->PLAddBulk($addArr); break; } else { $songs = explode(',', $object); $mpd->PLAddBulk($songs); break; } } $mpd->SendCommand('update'); header('Location: ./#current'); } switch ($_GET['a']) {