Switch from returning HTML for listsongs to JSON for currently playing song
This commit is contained in:
parent
2f7735f669
commit
b339af3103
|
@ -29,19 +29,17 @@ $sth->execute();
|
|||
$data['volume'] = getSystemVolume();
|
||||
system("HOME=" . WEBUSERHOMEDIR . " && ../scripts/homeaudio_togglemute.pl -show", $retval);
|
||||
$data['muted'] = ($retval == 0) ? false : true;
|
||||
$data['songplaying'] = "";
|
||||
$data['currentsong'] = array("art"=>"", "title"=>"", "artist"=>"", "album"=>"", "year"=>"");
|
||||
$data['songlist'] = "";
|
||||
$firstsong = true;
|
||||
while ( $row = $sth->fetch() ) {
|
||||
$song = new Song($row['songid']);
|
||||
if ( $firstsong ) {
|
||||
$data['songplaying'] .= "<div class='playing_art'><img class='playing_img' src='{$song->getArtFile(ARTURL)}'></div>\n";
|
||||
$data['songplaying'] .= "<div class='playing_details'>\n";
|
||||
$data['songplaying'] .= " <p class='nomargin'><span class='playing_label'>Title:</span> {$song->getTitle(HTMLSAFE)}</p>\n";
|
||||
$data['songplaying'] .= " <p class='nomargin'><span class='playing_label'>Artist:</span> {$song->getArtist(HTMLSAFE)}</p>\n";
|
||||
$data['songplaying'] .= " <p class='nomargin'><span class='playing_label'>Album:</span> {$song->getAlbum(HTMLSAFE)}</p>\n";
|
||||
$data['songplaying'] .= " <p class='nomargin'><span class='playing_label'>Year:</span> {$song->getYear(HTMLSAFE)}</p>\n";
|
||||
$data['songplaying'] .= "</div>\n";
|
||||
$data['currentsong']["art"] = $song->getArtFile(ARTURL);
|
||||
$data['currentsong']["title"] = $song->getTitle(HTMLSAFE);
|
||||
$data['currentsong']["artist"] = $song->getArtist(HTMLSAFE);
|
||||
$data['currentsong']["album"] = $song->getAlbum(HTMLSAFE);
|
||||
$data['currentsong']["year"] = $song->getYear(HTMLSAFE);
|
||||
$firstsong = false;
|
||||
} else {
|
||||
$data['songlist'] .= "<div class='songlist_song_container'>\n";
|
||||
|
|
11
index.php
11
index.php
|
@ -39,7 +39,15 @@ $queues = Queue::getList();
|
|||
<li><a href='#lists'>Lists</a></li>
|
||||
</ul>
|
||||
<div id='playing'>
|
||||
<div id='playing_contents' class='playing_contents'></div>
|
||||
<div id='playing_contents' class='playing_contents'>
|
||||
<div class='playing_art'><img id='playing_img' class='playing_img' src='img/no_art.jpg' /></div>
|
||||
<div class='playing_details'>
|
||||
<p class='nomargin'><span class='playing_label'>Title: </span><span id='playing_title'></span></p>
|
||||
<p class='nomargin'><span class='playing_label'>Artist: </span><span id='playing_artist'></span></p>
|
||||
<p class='nomargin'><span class='playing_label'>Albums: </span><span id='playing_album'></span></p>
|
||||
<p class='nomargin'><span class='playing_label'>Year: </span><span id='playing_year'></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='playing_buttons' class='playing_contents'>
|
||||
<p><input type='button' class='skipsong_btn' id='skipsong_playing_btn' value='Skip Song'></p>
|
||||
<p><input type='button' id='mute_playing_btn' value='Mute'></p>
|
||||
|
@ -119,3 +127,4 @@ $queues = Queue::getList();
|
|||
<script type='text/javascript' src='js/minimal.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
<!-- vim: set ai ts=2 sw=2 et: -->
|
||||
|
|
|
@ -191,7 +191,11 @@ function getSongList() {
|
|||
$('#volume_slider').slider("value", data.volume);
|
||||
}
|
||||
$('#history_contents').html(data.songlist);
|
||||
$('#playing_contents').html(data.songplaying);
|
||||
$('#playing_img').attr("src", data.currentsong.art);
|
||||
$('#playing_title').html(data.currentsong.title);
|
||||
$('#playing_artist').html(data.currentsong.artist);
|
||||
$('#playing_album').html(data.currentsong.album);
|
||||
$('#playing_year').html(data.currentsong.year);
|
||||
updateChristmasButton(data.christmas);
|
||||
updateMuteButton(data.muted);
|
||||
$('#christmas_freq').val(data.christmasfreq);
|
||||
|
@ -446,3 +450,5 @@ function getVolume () {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// vim: set ts=3 sw=3 ai et:
|
||||
|
|
Loading…
Reference in New Issue
Block a user