socket.send('MPD_API_GET_QUEUE,'+pagination);
break;
case 'song_change':
-
+ updatePageTitle(obj.data);
$('#album').text("");
$('#artist').text("");
$('.top-right').notify({
message:{html: notification},
type: "info",
- }).show();
-
+ }).show();
break;
case 'mpdhost':
$('#mpdhost').val(obj.data.host);
}
}
+var updatePageTitle = function(songInfo) {
+ if(!songInfo || (!songInfo.artist && !songInfo.title)) {
+ document.title = 'ympd';
+ return;
+ }
+ if(songInfo.artist) {
+ if(songInfo.title) {
+ document.title = songInfo.artist + ' - ' + songInfo.title;
+ }
+ } else {
+ document.title = songInfo.title;
+ }
+}
+
function updateDB() {
socket.send('MPD_API_UPDATE_DB');
$('.top-right').notify({