$mpd = new mpd($mpdServer, $mpdPort, $mpdPassword); define('CURRENTARTIST', $mpd->playlist[$mpd->current_track_id]['Artist']); define('CURRENTTRACK', $mpd->playlist[$mpd->current_track_id]['Title']); define('CURRENTID', $mpd->playlist[$mpd->current_track_id]['Id']); include 'tpl/header.tpl.php'; if ($mpd->connected == FALSE) { echo "Error: " . $mpd->errStr; } else { $statusrow = explode("\n", $mpd->SendCommand('status')); foreach ($statusrow as $row) { $get = explode(': ', $row); $status[$get[0]] = $get[1]; } $times = explode(':', $status['time']); $CURRENTLENGTH = convertSecs($times[1]); $CURRENTTIME = convertSecs($times[0]); // f*****g dirty if ($mpd->state != 'stop') { $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]); }
} ?> )</p> <?php } ?> <div class="playlist"> <?php foreach ($mpd->playlist as $song) { ?> <?php if ($song['Artist'] != NULL && $song['Title'] != NULL) { ?> <?php $sngtm = convertSecs($song['Time']); $songtime = ($sngtm[0] ? $sngtm[0] . ':' : '') . $sngtm[1] . ':' . $sngtm[2]; ?> <?php if (CURRENTID - 5 == $song['Id']) { ?> <p> <a href="?a=remove&id=<?php echo $song['Id']; ?> " title="Remove this song" class="removeid">x</a> <a href="?a=start&id=<?php echo $song['Pos']; ?>