mirror of
https://github.com/SuperBFG7/ympd
synced 2025-06-18 14:24:09 +00:00
Save states of cards, tabs and views
This commit is contained in:
parent
de36d91ca9
commit
4805ae4f1f
@ -15,7 +15,6 @@ UI Components
|
|||||||
- Bootstrap Notify: http://bootstrap-notify.remabledesigns.com/
|
- Bootstrap Notify: http://bootstrap-notify.remabledesigns.com/
|
||||||
- Bootstrap Slider: https://github.com/seiyria/bootstrap-slider
|
- Bootstrap Slider: https://github.com/seiyria/bootstrap-slider
|
||||||
- Material Design Icons: https://material.io/tools/icons/?style=baseline
|
- Material Design Icons: https://material.io/tools/icons/?style=baseline
|
||||||
- Sammy.js: http://sammyjs.org/
|
|
||||||
- jQuery: https://jquery.com/
|
- jQuery: https://jquery.com/
|
||||||
- js-cookie: https://github.com/js-cookie/js-cookie
|
- js-cookie: https://github.com/js-cookie/js-cookie
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ tbody {
|
|||||||
src: url(/assets/MaterialIcons-Regular.eot); /* For IE6-8 */
|
src: url(/assets/MaterialIcons-Regular.eot); /* For IE6-8 */
|
||||||
src: local('Material Icons'),
|
src: local('Material Icons'),
|
||||||
local('MaterialIcons-Regular'),
|
local('MaterialIcons-Regular'),
|
||||||
url(/assets/MaterialIcons-Regular.woff2) format('woff2'),
|
url(/assets/MaterialIcons-Regular.woff2) format('woff2');
|
||||||
url(/assets/MaterialIcons-Regular.woff) format('woff'),
|
src: url(/assets/MaterialIcons-Regular.woff) format('woff'),
|
||||||
url(/assets/MaterialIcons-Regular.ttf) format('truetype');
|
url(/assets/MaterialIcons-Regular.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive-md">
|
<div class="table-responsive-md">
|
||||||
<table id="browseDatabaseList" class="table table-hover table-sm">
|
<table id="browseDatabaseArtistList" class="table table-hover table-sm">
|
||||||
<col class="tblnum"/>
|
<col class="tblnum"/>
|
||||||
<col class="tbltitle"/>
|
<col class="tbltitle"/>
|
||||||
<col class="tblaction"/>
|
<col class="tblaction"/>
|
||||||
@ -307,7 +307,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="browseDatabaseCards" class="row"></div>
|
<div id="browseDatabaseAlbumCards" class="row"></div>
|
||||||
|
|
||||||
<div class="btn-toolbar" id="browseDatabaseButtonsBottom" role="toolbar">
|
<div class="btn-toolbar" id="browseDatabaseButtonsBottom" role="toolbar">
|
||||||
<div class="btn-group mr-2">
|
<div class="btn-group mr-2">
|
||||||
|
268
htdocs/js/mpd.js
268
htdocs/js/mpd.js
@ -42,14 +42,22 @@ var app = {};
|
|||||||
|
|
||||||
app.apps = {"playback": { "state": "" },
|
app.apps = {"playback": { "state": "" },
|
||||||
"queue": { "state": "0/Any Tag/" },
|
"queue": { "state": "0/Any Tag/" },
|
||||||
"browsePlaylists": { "state": "0/!/" },
|
"browse": { "active": "browseFilesystem",
|
||||||
"browseDatabase": { "state": "0/!/" },
|
"tabs": { "Filesystem": {"state": "0/!/"},
|
||||||
"browseDatabaseArtist": { "state": "0/!/" },
|
"Playlists": {"state": "0/!/" },
|
||||||
"browseFilesystem": { "state": "0/!/" },
|
"Database": { "active":"Artist",
|
||||||
|
"views": {"Artist": {"state": "0/!/" },
|
||||||
|
"Album": {"state": "0/!/" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"search": { "state": "0/Any Tag/" }
|
"search": { "state": "0/Any Tag/" }
|
||||||
};
|
};
|
||||||
|
|
||||||
app.currentApp='';
|
app.currentApp='';
|
||||||
|
app.currentTab='';
|
||||||
|
app.currentView='';
|
||||||
|
|
||||||
app.prepare=function() {
|
app.prepare=function() {
|
||||||
$('#navbar-bottom > div').removeClass('active');
|
$('#navbar-bottom > div').removeClass('active');
|
||||||
@ -66,29 +74,39 @@ app.prepare=function() {
|
|||||||
$('#cardBrowseNavFilesystem').removeClass('active');
|
$('#cardBrowseNavFilesystem').removeClass('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
app.goto=function(a,p) {
|
app.goto=function(a,t,v,s) {
|
||||||
//use saved state if p is undefined
|
if (app.apps[a].tabs) {
|
||||||
location.hash = '/'+a+'/'+ encodeURI(p == undefined ? app.apps[a].state : p);
|
if (t == undefined) t = app.apps[a].active;
|
||||||
|
if (app.apps[a].tabs[t].views) {
|
||||||
|
if (v == undefined) v = app.apps[a].tabs[t].active;
|
||||||
|
location.hash = '/'+a+t+v+'/'+ (s == undefined ? app.apps[a].tabs[t].views[v].state : s);
|
||||||
|
} else {
|
||||||
|
location.hash = '/'+a+t+'/'+ (s == undefined ? app.apps[a].tabs[t].state : s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
location.hash = '/'+a+'/'+ (s == undefined ? app.apps[a].state : s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.route=function() {
|
app.route=function() {
|
||||||
var hash=decodeURI(location.hash);
|
var hash=decodeURI(location.hash);
|
||||||
if (params=hash.match(/^\#\/(\w+)\/(.*)$/)) {
|
|
||||||
app.currentApp=params[1];
|
|
||||||
app.apps[app.currentApp].state=params[2];
|
|
||||||
} else {
|
|
||||||
app.currentApp='';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params=hash.match(/^\#\/(playback)\//)) {
|
if (params=hash.match(/^\#\/(playback)\//)) {
|
||||||
app.prepare();
|
app.prepare();
|
||||||
|
app.currentApp=params[1];
|
||||||
|
app.currentTab='';
|
||||||
|
app.currentView='';
|
||||||
$('#cardPlayback').removeClass('hide');
|
$('#cardPlayback').removeClass('hide');
|
||||||
$('#navPlayback').addClass('active');
|
$('#navPlayback').addClass('active');
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(queue)\/(\d+)\/([^\/]+)\/(.*)$/)) {
|
else if (params=hash.match(/^\#\/(queue)\/((\d+)\/([^\/]+)\/(.*))$/)) {
|
||||||
pagination = parseInt(params[2]);
|
app.currentApp=params[1];
|
||||||
var mpdtag = params[3];
|
app.currentTab='';
|
||||||
var searchstr = params[4];
|
app.currentView='';
|
||||||
|
app.apps[app.currentApp].state=params[2];
|
||||||
|
pagination = parseInt(params[3]);
|
||||||
|
var mpdtag = params[4];
|
||||||
|
var searchstr = params[5];
|
||||||
|
|
||||||
if ($('#cardQueue').hasClass('hide')) {
|
if ($('#cardQueue').hasClass('hide')) {
|
||||||
app.prepare();
|
app.prepare();
|
||||||
@ -111,9 +129,14 @@ app.route=function() {
|
|||||||
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(browsePlaylists)\/(\d+)\/(\w|\!)\/$/)) {
|
else if (params=hash.match(/^\#\/(browse)(Playlists)\/((\d+)\/(\w|\!)\/)$/)) {
|
||||||
pagination = parseInt(params[2]);
|
app.currentApp=params[1];
|
||||||
filterLetter = params[3];
|
app.currentTab=params[2];
|
||||||
|
app.currentView='';
|
||||||
|
app.apps[app.currentApp].active=params[2];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].state=params[3];
|
||||||
|
pagination = parseInt(params[4]);
|
||||||
|
filterLetter = params[5];
|
||||||
app.prepare();
|
app.prepare();
|
||||||
$('#navBrowse').addClass('active');
|
$('#navBrowse').addClass('active');
|
||||||
$('#cardBrowse').removeClass('hide');
|
$('#cardBrowse').removeClass('hide');
|
||||||
@ -122,10 +145,16 @@ app.route=function() {
|
|||||||
socket.send('MPD_API_GET_PLAYLISTS,'+pagination+','+filterLetter);
|
socket.send('MPD_API_GET_PLAYLISTS,'+pagination+','+filterLetter);
|
||||||
doSetFilterLetter('#browsePlaylistsFilter');
|
doSetFilterLetter('#browsePlaylistsFilter');
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(browseDatabase)\/(\d+)\/(\w|\!)\/$/)) {
|
else if (params=hash.match(/^\#\/(browse)(Database)(Artist)\/((\d+)\/(\w|\!)\/)$/)) {
|
||||||
|
app.currentApp=params[1];
|
||||||
|
app.currentTab=params[2];
|
||||||
|
app.currentView=params[3];
|
||||||
|
app.apps[app.currentApp].active=params[2];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].active=params[3];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].views[params[3]].state=params[4];
|
||||||
app.prepare();
|
app.prepare();
|
||||||
pagination = parseInt(params[2]);
|
pagination = parseInt(params[5]);
|
||||||
filterLetter = params[3];
|
filterLetter = params[6];
|
||||||
$('#navBrowse').addClass('active');
|
$('#navBrowse').addClass('active');
|
||||||
$('#cardBrowse').removeClass('hide');
|
$('#cardBrowse').removeClass('hide');
|
||||||
$('#cardBrowseDatabase').removeClass('hide');
|
$('#cardBrowseDatabase').removeClass('hide');
|
||||||
@ -133,11 +162,17 @@ app.route=function() {
|
|||||||
socket.send('MPD_API_GET_ARTISTS,' + pagination + ',' + filterLetter);
|
socket.send('MPD_API_GET_ARTISTS,' + pagination + ',' + filterLetter);
|
||||||
doSetFilterLetter('#browseDatabaseFilter');
|
doSetFilterLetter('#browseDatabaseFilter');
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(browseDatabaseArtist)\/(\d+)\/(\w|\!)\/(.*)$/)) {
|
else if (params=hash.match(/^\#\/(browse)(Database)(Album)\/((\d+)\/(\w|\!)\/(.*))$/)) {
|
||||||
|
app.currentApp=params[1];
|
||||||
|
app.currentTab=params[2];
|
||||||
|
app.currentView=params[3];
|
||||||
|
app.apps[app.currentApp].active=params[2];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].active=params[3];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].views[params[3]].state=params[4];
|
||||||
app.prepare();
|
app.prepare();
|
||||||
pagination = parseInt(params[2]);
|
pagination = parseInt(params[5]);
|
||||||
filterLetter = params[3];
|
filterLetter = params[6];
|
||||||
artist = params[4];
|
artist = params[7];
|
||||||
$('#navBrowse').addClass('active');
|
$('#navBrowse').addClass('active');
|
||||||
$('#cardBrowse').removeClass('hide');
|
$('#cardBrowse').removeClass('hide');
|
||||||
$('#cardBrowseDatabase').removeClass('hide');
|
$('#cardBrowseDatabase').removeClass('hide');
|
||||||
@ -145,11 +180,16 @@ app.route=function() {
|
|||||||
socket.send('MPD_API_GET_ARTISTALBUMS,' + pagination+',' + filterLetter + ',' + decodeURI(artist));
|
socket.send('MPD_API_GET_ARTISTALBUMS,' + pagination+',' + filterLetter + ',' + decodeURI(artist));
|
||||||
doSetFilterLetter('#browseDatabaseFilter');
|
doSetFilterLetter('#browseDatabaseFilter');
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(browseFilesystem)\/(\d+)\/(\w|\!)\/(.*)$/)) {
|
else if (params=hash.match(/^\#\/(browse)(Filesystem)\/((\d+)\/(\w|\!)\/(.*))$/)) {
|
||||||
app.prepare();
|
app.prepare();
|
||||||
pagination = parseInt(params[2]);
|
app.currentApp=params[1];
|
||||||
filterLetter = params[3];
|
app.currentTab=params[2];
|
||||||
browsepath = params[4];
|
app.currentView='';
|
||||||
|
app.apps[app.currentApp].active=params[2];
|
||||||
|
app.apps[app.currentApp].tabs[params[2]].state=params[3];
|
||||||
|
pagination = parseInt(params[4]);
|
||||||
|
filterLetter = params[5];
|
||||||
|
browsepath = params[6];
|
||||||
$('#navBrowse').addClass('active');
|
$('#navBrowse').addClass('active');
|
||||||
$('#cardBrowse').removeClass('hide');
|
$('#cardBrowse').removeClass('hide');
|
||||||
$('#cardBrowseFilesystem').removeClass('hide');
|
$('#cardBrowseFilesystem').removeClass('hide');
|
||||||
@ -182,10 +222,14 @@ app.route=function() {
|
|||||||
full_path += "/";
|
full_path += "/";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (params=hash.match(/^\#\/(search)\/(\d+)\/([^\/]+)\/(.*)$/)) {
|
else if (params=hash.match(/^\#\/(search)\/((\d+)\/([^\/]+)\/(.*))$/)) {
|
||||||
pagination = parseInt(params[2]);
|
app.currentApp=params[1];
|
||||||
var mpdtag = params[3];
|
app.apps[app.currentApp].state=params[2];
|
||||||
var searchstr = params[4];
|
app.currentTab='';
|
||||||
|
app.currentView='';
|
||||||
|
pagination = parseInt(params[3]);
|
||||||
|
var mpdtag = params[4];
|
||||||
|
var searchstr = params[5];
|
||||||
|
|
||||||
if ($('#cardSearch').hasClass('hide')) {
|
if ($('#cardSearch').hasClass('hide')) {
|
||||||
app.prepare();
|
app.prepare();
|
||||||
@ -390,10 +434,10 @@ function webSocketConnect() {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'playlists':
|
case 'playlists':
|
||||||
if(app.currentApp !== 'browsePlaylists')
|
if(app.currentApp !== 'browse' && app.currentTab !== 'Playlists')
|
||||||
break;
|
break;
|
||||||
var nrItems=0;
|
var nrItems=0;
|
||||||
var tr=document.getElementById(app.currentApp+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
var tr=document.getElementById(app.currentApp+app.currentTab+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
||||||
for (var item in obj.data) {
|
for (var item in obj.data) {
|
||||||
nrItems++;
|
nrItems++;
|
||||||
var d = new Date(obj.data[item].last_modified * 1000);
|
var d = new Date(obj.data[item].last_modified * 1000);
|
||||||
@ -402,19 +446,19 @@ function webSocketConnect() {
|
|||||||
'<td><a>' + basename(obj.data[item].plist) + '</a></td>' +
|
'<td><a>' + basename(obj.data[item].plist) + '</a></td>' +
|
||||||
'<td>'+d.toUTCString()+'</td><td></td></tr>';
|
'<td>'+d.toUTCString()+'</td><td></td></tr>';
|
||||||
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
||||||
else { $('#'+app.currentApp+'List > tbody').append(row); }
|
else { $('#'+app.currentApp+app.currentTab+'List > tbody').append(row); }
|
||||||
}
|
}
|
||||||
for (var i=tr.length;i>nrItems;i--) {
|
for (var i=tr.length;i>nrItems;i--) {
|
||||||
$(tr[tr.length-1]).remove();
|
$(tr[tr.length-1]).remove();
|
||||||
}
|
}
|
||||||
setPagination(obj.totalEntities);
|
setPagination(obj.totalEntities);
|
||||||
if ( isTouch ) {
|
if ( isTouch ) {
|
||||||
$('#'+app.currentApp+'List > tbody > tr > td:last-child').append(
|
$('#'+app.currentApp+app.currentTab+'List > tbody > tr > td:last-child').append(
|
||||||
'<a class="pull-right btn-group-hover color-darkgrey" href="#/browse/playlists/' + pagination + '" '+
|
'<a class="pull-right btn-group-hover color-darkgrey" href="#/browse/playlists/' + pagination + '" '+
|
||||||
'onclick="delPlaylist($(this).parents(\'tr\'));">' +
|
'onclick="delPlaylist($(this).parents(\'tr\'));">' +
|
||||||
'<span class="material-icons">delete</span></a>');
|
'<span class="material-icons">delete</span></a>');
|
||||||
} else {
|
} else {
|
||||||
$('#'+app.currentApp+'List > tbody > tr').on({
|
$('#'+app.currentApp+app.currentTab+'List > tbody > tr').on({
|
||||||
mouseover: function(){
|
mouseover: function(){
|
||||||
if($(this).children().last().has('a').length == 0)
|
if($(this).children().last().has('a').length == 0)
|
||||||
$(this).children().last().append(
|
$(this).children().last().append(
|
||||||
@ -428,14 +472,14 @@ function webSocketConnect() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$('#'+app.currentApp+'List > tbody > tr').on({
|
$('#'+app.currentApp+app.currentTab+'List > tbody > tr').on({
|
||||||
click: function() {
|
click: function() {
|
||||||
socket.send('MPD_API_ADD_PLAYLIST,' + decodeURI($(this).attr('uri')));
|
socket.send('MPD_API_ADD_PLAYLIST,' + decodeURI($(this).attr('uri')));
|
||||||
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (nrItems == 0) {
|
if (nrItems == 0) {
|
||||||
$('#'+app.currentApp+'List > tbody').append(
|
$('#'+app.currentApp+app.currentTab+'List > tbody').append(
|
||||||
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
||||||
'<td colspan="3">No playlists found.</td>' +
|
'<td colspan="3">No playlists found.</td>' +
|
||||||
'<td></td><td></td></tr>'
|
'<td></td><td></td></tr>'
|
||||||
@ -444,43 +488,43 @@ function webSocketConnect() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'listDBtags':
|
case 'listDBtags':
|
||||||
if(app.currentApp !== 'browseDatabase' && app.currentApp !== 'browseDatabaseArtist')
|
if(app.currentApp !== 'browse' && app.currentTab !== 'Database')
|
||||||
break;
|
break;
|
||||||
if (obj.tagtype == 'AlbumArtist') {
|
if (obj.tagtype == 'AlbumArtist') {
|
||||||
$('#browseDatabaseCards').addClass('hide');
|
$('#browseDatabaseAlbumCards').addClass('hide');
|
||||||
$('#browseDatabaseList').removeClass('hide');
|
$('#browseDatabaseArtistList').removeClass('hide');
|
||||||
$('#btnBrowseDatabaseArtist').addClass('hide');
|
$('#btnBrowseDatabaseArtist').addClass('hide');
|
||||||
var nrItems=0;
|
var nrItems=0;
|
||||||
var tr=document.getElementById(app.currentApp+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
var tr=document.getElementById(app.currentApp+app.currentTab+app.currentView+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
||||||
for (var item in obj.data) {
|
for (var item in obj.data) {
|
||||||
nrItems++;
|
nrItems++;
|
||||||
var row='<tr uri="' + encodeURI(obj.data[item].value) + '">' +
|
var row='<tr uri="' + encodeURI(obj.data[item].value) + '">' +
|
||||||
'<td><span class="material-icons">album</span></td>' +
|
'<td><span class="material-icons">album</span></td>' +
|
||||||
'<td><a>' + obj.data[item].value + '</a></td></tr>';
|
'<td><a>' + obj.data[item].value + '</a></td></tr>';
|
||||||
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
||||||
else { $('#'+app.currentApp+'List > tbody').append(row); }
|
else { $('#'+app.currentApp+app.currentTab+app.currentView+'List > tbody').append(row); }
|
||||||
|
|
||||||
}
|
}
|
||||||
for (var i=tr.length;i>nrItems;i--) {
|
for (var i=tr.length;i>nrItems;i--) {
|
||||||
$(tr[tr.length-1]).remove();
|
$(tr[tr.length-1]).remove();
|
||||||
}
|
}
|
||||||
setPagination(obj.totalEntities);
|
setPagination(obj.totalEntities);
|
||||||
$('#'+app.currentApp+'List > tbody > tr').on({
|
$('#'+app.currentApp+app.currentTab+app.currentView+'List > tbody > tr').on({
|
||||||
click: function() {
|
click: function() {
|
||||||
app.goto('browseDatabaseArtist','0/!/'+$(this).attr('uri'));
|
app.goto('browse','Database','Album','0/!/'+$(this).attr('uri'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (nrItems == 0) {
|
if (nrItems == 0) {
|
||||||
$('#'+app.currentApp+'List > tbody').append(
|
$('#'+app.currentApp+app.currentTab+app.currentView+'List > tbody').append(
|
||||||
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
||||||
'<td colspan="3">No entries found.</td>' +
|
'<td colspan="3">No entries found.</td>' +
|
||||||
'<td></td><td></td></tr>'
|
'<td></td><td></td></tr>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (obj.tagtype == 'Album') {
|
} else if (obj.tagtype == 'Album') {
|
||||||
$('#browseDatabaseList').addClass('hide');
|
$('#browseDatabaseArtistList').addClass('hide');
|
||||||
$('#browseDatabaseCards').empty();
|
$('#browseDatabaseAlbumCards').empty();
|
||||||
$('#browseDatabaseCards').removeClass('hide');
|
$('#browseDatabaseAlbumCards').removeClass('hide');
|
||||||
$('#btnBrowseDatabaseArtist').removeClass('hide');
|
$('#btnBrowseDatabaseArtist').removeClass('hide');
|
||||||
var nrItems=0;
|
var nrItems=0;
|
||||||
for (var item in obj.data) {
|
for (var item in obj.data) {
|
||||||
@ -492,7 +536,7 @@ function webSocketConnect() {
|
|||||||
' <table class="table table-sm table-hover" id="tbl'+genId(obj.data[item].value)+'"><tbody></tbody></table'+
|
' <table class="table table-sm table-hover" id="tbl'+genId(obj.data[item].value)+'"><tbody></tbody></table'+
|
||||||
' </div>'+
|
' </div>'+
|
||||||
'</div></div>';
|
'</div></div>';
|
||||||
$('#browseDatabaseCards').append(card);
|
$('#browseDatabaseAlbumCards').append(card);
|
||||||
socket.send('MPD_API_GET_ARTISTALBUMTITLES,' + obj.searchstr + ','+obj.data[item].value);
|
socket.send('MPD_API_GET_ARTISTALBUMTITLES,' + obj.searchstr + ','+obj.data[item].value);
|
||||||
}
|
}
|
||||||
setPagination(obj.totalEntities);
|
setPagination(obj.totalEntities);
|
||||||
@ -532,7 +576,7 @@ function webSocketConnect() {
|
|||||||
$('#searchAddAllSongs').attr('disabled','disabled').addClass('disabled');
|
$('#searchAddAllSongs').attr('disabled','disabled').addClass('disabled');
|
||||||
}
|
}
|
||||||
case 'browse':
|
case 'browse':
|
||||||
if(app.currentApp !== 'browseFilesystem' && app.currentApp !== 'search')
|
if(app.currentApp !== 'browse' && app.currentTab !== 'Filesystem' && app.currentApp !== 'search')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The use of encodeURI() below might seem useless, but it's not. It prevents
|
/* The use of encodeURI() below might seem useless, but it's not. It prevents
|
||||||
@ -540,7 +584,7 @@ function webSocketConnect() {
|
|||||||
* URI from NFD to NFC, breaking our link with MPD.
|
* URI from NFD to NFC, breaking our link with MPD.
|
||||||
*/
|
*/
|
||||||
var nrItems=0;
|
var nrItems=0;
|
||||||
var tr=document.getElementById(app.currentApp+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
var tr=document.getElementById(app.currentApp+app.currentTab+'List').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
||||||
for (var item in obj.data) {
|
for (var item in obj.data) {
|
||||||
nrItems++;
|
nrItems++;
|
||||||
var row='';
|
var row='';
|
||||||
@ -570,7 +614,7 @@ function webSocketConnect() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
||||||
else { $('#'+app.currentApp+'List > tbody').append(row); }
|
else { $('#'+app.currentApp+app.currentTab+'List > tbody').append(row); }
|
||||||
}
|
}
|
||||||
for (var i=tr.length;i>nrItems;i--) {
|
for (var i=tr.length;i>nrItems;i--) {
|
||||||
$(tr[tr.length-1]).remove();
|
$(tr[tr.length-1]).remove();
|
||||||
@ -578,7 +622,7 @@ function webSocketConnect() {
|
|||||||
setPagination(obj.totalEntities);
|
setPagination(obj.totalEntities);
|
||||||
|
|
||||||
if (nrItems == 0) {
|
if (nrItems == 0) {
|
||||||
$('#'+app.currentApp+'List > tbody').append(
|
$('#'+app.currentApp+app.currentTab+'List > tbody').append(
|
||||||
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
||||||
'<td colspan="3">No results</td>' +
|
'<td colspan="3">No results</td>' +
|
||||||
'<td></td><td></td></tr>');
|
'<td></td><td></td></tr>');
|
||||||
@ -596,8 +640,8 @@ function webSocketConnect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isTouch ) {
|
if ( isTouch ) {
|
||||||
appendClickableIcon($('#'+app.currentApp+'List > tbody > tr.dir > td:last-child'), 'MPD_API_ADD_TRACK', 'playlist_add');
|
appendClickableIcon($('#'+app.currentApp+app.currentTab+'List > tbody > tr.dir > td:last-child'), 'MPD_API_ADD_TRACK', 'playlist_add');
|
||||||
appendClickableIcon($('#'+app.currentApp+'List > tbody > tr.song > td:last-child'), 'MPD_API_ADD_TRACK', 'playlist_add');
|
appendClickableIcon($('#'+app.currentApp+app.currentTab+'List > tbody > tr.song > td:last-child'), 'MPD_API_ADD_TRACK', 'playlist_add');
|
||||||
} else {
|
} else {
|
||||||
$('#'+app.currentApp+'List > tbody > tr').on({
|
$('#'+app.currentApp+'List > tbody > tr').on({
|
||||||
mouseenter: function() {
|
mouseenter: function() {
|
||||||
@ -611,14 +655,14 @@ function webSocketConnect() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$('#'+app.currentApp+'List > tbody > tr').on({
|
$('#'+app.currentApp+app.currentTab+'List > tbody > tr').on({
|
||||||
click: function() {
|
click: function() {
|
||||||
switch($(this).attr('class')) {
|
switch($(this).attr('class')) {
|
||||||
case 'dir':
|
case 'dir':
|
||||||
pagination = 0;
|
pagination = 0;
|
||||||
browsepath = $(this).attr("uri");
|
browsepath = $(this).attr("uri");
|
||||||
//$("#browseFilesystemList > a").attr("href", '#/browse/filesystem/'+pagination+'/'+filterLetter+'/'+browsepath);
|
$("#browseFilesystemList > a").attr("href", '#/browseFilesystem/'+pagination+'/'+filterLetter+'/'+browsepath);
|
||||||
app.goto('browseFilesystem',pagination+'/'+filterLetter+'/'+browsepath);
|
app.goto('browse','Filesystem',undefined,pagination+'/'+filterLetter+'/'+browsepath);
|
||||||
break;
|
break;
|
||||||
case 'song':
|
case 'song':
|
||||||
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
||||||
@ -636,8 +680,8 @@ function webSocketConnect() {
|
|||||||
click: function() {
|
click: function() {
|
||||||
pagination = 0;
|
pagination = 0;
|
||||||
browsepath = $(this).attr("uri");
|
browsepath = $(this).attr("uri");
|
||||||
//$("#browseFilesystemList > a").attr("href", '#/browse/filesystem/'+pagination+'/'+filterLetter+'/'+browsepath);
|
$("#browseFilesystemList > a").attr("href", '#/browseFilesystem/'+pagination+'/'+filterLetter+'/'+browsepath);
|
||||||
app.goto('browseFilesystem',pagination+'/'+filterLetter+'/'+browsepath);
|
app.goto('browse','Filesystem',undefined,pagination+'/'+filterLetter+'/'+browsepath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -827,38 +871,38 @@ function get_appropriate_ws_url()
|
|||||||
function setPagination(number) {
|
function setPagination(number) {
|
||||||
var totalPages=Math.ceil(number / MAX_ELEMENTS_PER_PAGE);
|
var totalPages=Math.ceil(number / MAX_ELEMENTS_PER_PAGE);
|
||||||
if (totalPages==0) { totalPages=1; }
|
if (totalPages==0) { totalPages=1; }
|
||||||
$('#'+app.currentApp+'PaginationTopPage').text('Page '+(pagination / MAX_ELEMENTS_PER_PAGE + 1)+' / '+totalPages);
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPage').text('Page '+(pagination / MAX_ELEMENTS_PER_PAGE + 1)+' / '+totalPages);
|
||||||
$('#'+app.currentApp+'PaginationBottomPage').text('Page '+(pagination / MAX_ELEMENTS_PER_PAGE + 1)+' / '+totalPages);
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPage').text('Page '+(pagination / MAX_ELEMENTS_PER_PAGE + 1)+' / '+totalPages);
|
||||||
if (totalPages > 1) {
|
if (totalPages > 1) {
|
||||||
$('#'+app.currentApp+'PaginationTopPage').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPage').removeClass('disabled').removeAttr('disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomPage').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPage').removeClass('disabled').removeAttr('disabled');
|
||||||
$('#'+app.currentApp+'PaginationTopPages').empty();
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPages').empty();
|
||||||
$('#'+app.currentApp+'PaginationBottomPages').empty();
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPages').empty();
|
||||||
for (var i=0;i<totalPages;i++) {
|
for (var i=0;i<totalPages;i++) {
|
||||||
$('#'+app.currentApp+'PaginationTopPages').append('<button onclick="gotoPage('+(i * MAX_ELEMENTS_PER_PAGE)+',this,event)" type="button" class="mr-1 mb-1 btn-sm btn btn-secondary">'+(i+1)+'</button>');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPages').append('<button onclick="gotoPage('+(i * MAX_ELEMENTS_PER_PAGE)+',this,event)" type="button" class="mr-1 mb-1 btn-sm btn btn-secondary">'+(i+1)+'</button>');
|
||||||
$('#'+app.currentApp+'PaginationBottomPages').append('<button onclick="gotoPage('+(i * MAX_ELEMENTS_PER_PAGE)+',this,event)" type="button" class="mr-1 mb-1 btn-sm btn btn-secondary">'+(i+1)+'</button>');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPages').append('<button onclick="gotoPage('+(i * MAX_ELEMENTS_PER_PAGE)+',this,event)" type="button" class="mr-1 mb-1 btn-sm btn btn-secondary">'+(i+1)+'</button>');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#'+app.currentApp+'PaginationTopPage').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPage').addClass('disabled').attr('disabled','disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomPage').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPage').addClass('disabled').attr('disabled','disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(number > pagination + MAX_ELEMENTS_PER_PAGE) {
|
if(number > pagination + MAX_ELEMENTS_PER_PAGE) {
|
||||||
$('#'+app.currentApp+'PaginationTopNext').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopNext').removeClass('disabled').removeAttr('disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomNext').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomNext').removeClass('disabled').removeAttr('disabled');
|
||||||
$('#'+app.currentApp+'ButtonsBottom').removeClass('hide');
|
$('#'+app.currentApp+app.currentTab+'ButtonsBottom').removeClass('hide');
|
||||||
} else {
|
} else {
|
||||||
$('#'+app.currentApp+'PaginationTopNext').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopNext').addClass('disabled').attr('disabled','disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomNext').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomNext').addClass('disabled').attr('disabled','disabled');
|
||||||
$('#'+app.currentApp+'ButtonsBottom').addClass('hide');
|
$('#'+app.currentApp+app.currentTab+'ButtonsBottom').addClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pagination > 0) {
|
if(pagination > 0) {
|
||||||
$('#'+app.currentApp+'PaginationTopPrev').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPrev').removeClass('disabled').removeAttr('disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomPrev').removeClass('disabled').removeAttr('disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPrev').removeClass('disabled').removeAttr('disabled');
|
||||||
} else {
|
} else {
|
||||||
$('#'+app.currentApp+'PaginationTopPrev').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationTopPrev').addClass('disabled').attr('disabled','disabled');
|
||||||
$('#'+app.currentApp+'PaginationBottomPrev').addClass('disabled').attr('disabled','disabled');
|
$('#'+app.currentApp+app.currentTab+'PaginationBottomPrev').addClass('disabled').attr('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,27 +1024,27 @@ $('#btnrepeat').on('click', function (e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#cardBrowseNavFilesystem').on('click', function (e) {
|
$('#cardBrowseNavFilesystem').on('click', function (e) {
|
||||||
app.goto('browseFilesystem');
|
app.goto('browse','Filesystem');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cardBrowseNavDatabase').on('click', function (e) {
|
$('#cardBrowseNavDatabase').on('click', function (e) {
|
||||||
app.goto('browseDatabase');
|
app.goto('browse','Database');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btnBrowseDatabaseArtist').on('click', function (e) {
|
$('#btnBrowseDatabaseArtist').on('click', function (e) {
|
||||||
app.goto('browseDatabase');
|
app.goto('browse','Database','Artist');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cardBrowseNavPlaylists').on('click', function (e) {
|
$('#cardBrowseNavPlaylists').on('click', function (e) {
|
||||||
app.goto('browsePlaylists');
|
app.goto('browse','Playlists');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cardBrowseNavFilesystem').on('click', function (e) {
|
$('#cardBrowseNavFilesystem').on('click', function (e) {
|
||||||
app.goto('browseFilesystem');
|
app.goto('browse','Filesystem');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1015,7 +1059,7 @@ $('#navQueue').on('click', function (e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#navBrowse').on('click', function (e) {
|
$('#navBrowse').on('click', function (e) {
|
||||||
app.goto('browseFilesystem');
|
app.goto('browse');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1120,7 +1164,7 @@ $('#search > input').keypress(function (event) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#search').submit(function () {
|
$('#search').submit(function () {
|
||||||
app.goto('search',pagination + '/Any Tag/' + $('#search > input').val());
|
app.goto('search',undefined,undefined,pagination + '/Any Tag/' + $('#search > input').val());
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1129,7 +1173,7 @@ function doSearch(searchstr) {
|
|||||||
$('#searchtags2 > button').each(function() {
|
$('#searchtags2 > button').each(function() {
|
||||||
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
||||||
});
|
});
|
||||||
app.goto('search',pagination + '/' + mpdtag + '/' + searchstr);
|
app.goto('search',undefined,undefined,pagination + '/' + mpdtag + '/' + searchstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#search2').submit(function () {
|
$('#search2').submit(function () {
|
||||||
@ -1179,7 +1223,7 @@ function doQueueSearch() {
|
|||||||
$('#searchqueuetag > button').each(function() {
|
$('#searchqueuetag > button').each(function() {
|
||||||
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
||||||
});
|
});
|
||||||
app.goto('queue', pagination + '/' + mpdtag + '/' + searchstr);
|
app.goto('queue',undefined,undefined,pagination + '/' + mpdtag + '/' + searchstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#searchqueue').submit(function () {
|
$('#searchqueue').submit(function () {
|
||||||
@ -1218,20 +1262,19 @@ function gotoPage(x,element,event) {
|
|||||||
$('#searchqueuetag > button').each(function() {
|
$('#searchqueuetag > button').each(function() {
|
||||||
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
|
||||||
});
|
});
|
||||||
app.goto('queue', pagination+'/'+mpdtag+'/');
|
app.goto('queue',undefined,undefined, pagination+'/'+mpdtag+'/');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "search":
|
case "search":
|
||||||
doSearch($('#searchstr2').val());
|
doSearch($('#searchstr2').val());
|
||||||
break;
|
break;
|
||||||
case "browseFilesystem":
|
case "browse":
|
||||||
app.goto('browseFilesystem', pagination+'/'+filterLetter+'/'+browsepath);
|
if (app.currentTab == 'Filesystem') app.goto('browse','Filesystem',undefined, pagination+'/'+filterLetter+'/'+browsepath)
|
||||||
break;
|
else if (app.currentTab == 'Playlists') app.goto('browse','Playlists',undefined, pagination+'/'+filterLetter)
|
||||||
case "browsePlaylists":
|
else if (app.currentTab == 'Database') {
|
||||||
app.goto('browsePlaylists', pagination+'/'+filterLetter);
|
if (app.currentView == 'Artist') app.goto('browse','Database','Artist', pagination+'/'+filterLetter+'/')
|
||||||
break;
|
else if (app.currentView == 'Album') app.goto('browse','Database','Album', pagination+'/'+filterLetter+'/'+artist)
|
||||||
case "browseDatabase":
|
}
|
||||||
app.goto('browseDatabase', pagination+'/'+filterLetter+'/'+artist);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -1340,18 +1383,21 @@ $(document).keydown(function(e){
|
|||||||
});
|
});
|
||||||
|
|
||||||
function setFilterLetter(filter) {
|
function setFilterLetter(filter) {
|
||||||
pagination = 0;
|
pagination = 0;
|
||||||
switch(app.currentApp) {
|
if (app.currentApp == 'browse') {
|
||||||
case 'browseFilesystem':
|
switch(app.currentTab) {
|
||||||
app.goto('browseFilesystem', pagination+'/'+filter+'/'+browsepath);
|
case 'Filesystem':
|
||||||
|
app.goto('browse','Filesystem',undefined, pagination+'/'+filter+'/'+browsepath);
|
||||||
break;
|
break;
|
||||||
case 'browseDatabase':
|
case 'Database':
|
||||||
app.goto('browseDatabase', pagination+'/'+filter+'/'+artist);
|
if (app.currentView == 'Artist') app.goto('browse','Database','Artist', pagination+'/'+filter+'/');
|
||||||
|
else if (app.currentView == 'Album') app.goto('browse','Database','Album', pagination+'/'+filter+'/'+artist);
|
||||||
break;
|
break;
|
||||||
case 'browsePlaylists':
|
case 'Playlists':
|
||||||
app.goto('browsePlaylists', pagination+'/'+filter+'/'+artist);
|
app.goto('browse','Playlists',undefined, pagination+'/'+filter+'/');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSetFilterLetter(x) {
|
function doSetFilterLetter(x) {
|
||||||
|
@ -516,6 +516,13 @@ static int mpd_notify_callback(struct mg_connection *c, enum mg_event ev) {
|
|||||||
{
|
{
|
||||||
mg_websocket_write(c, 1, mpd.buf, mpd.buf_size);
|
mg_websocket_write(c, 1, mpd.buf, mpd.buf_size);
|
||||||
|
|
||||||
|
if(s->queue_version != mpd.queue_version)
|
||||||
|
{
|
||||||
|
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"update_queue\"}");
|
||||||
|
mg_websocket_write(c, 1, mpd.buf, n);
|
||||||
|
s->queue_version = mpd.queue_version;
|
||||||
|
}
|
||||||
|
|
||||||
if(s->song_id != mpd.song_id || s->queue_version != mpd.queue_version)
|
if(s->song_id != mpd.song_id || s->queue_version != mpd.queue_version)
|
||||||
{
|
{
|
||||||
n = mpd_put_current_song(mpd.buf);
|
n = mpd_put_current_song(mpd.buf);
|
||||||
@ -523,12 +530,7 @@ static int mpd_notify_callback(struct mg_connection *c, enum mg_event ev) {
|
|||||||
s->song_id = mpd.song_id;
|
s->song_id = mpd.song_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s->queue_version != mpd.queue_version)
|
|
||||||
{
|
|
||||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"update_queue\"}");
|
|
||||||
mg_websocket_write(c, 1, mpd.buf, n);
|
|
||||||
s->queue_version = mpd.queue_version;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MG_TRUE;
|
return MG_TRUE;
|
||||||
@ -704,7 +706,7 @@ int mpd_put_state(char *buffer, int *current_song_id, int *next_song_id, unsign
|
|||||||
"\"state\":%d, \"volume\":%d, \"songpos\": %d, \"elapsedTime\": %d, "
|
"\"state\":%d, \"volume\":%d, \"songpos\": %d, \"elapsedTime\": %d, "
|
||||||
"\"totalTime\":%d, \"currentsongid\": %d, \"kbitrate\": %d, "
|
"\"totalTime\":%d, \"currentsongid\": %d, \"kbitrate\": %d, "
|
||||||
"\"audioformat\": { \"sample_rate\": %d, \"bits\": %d, \"channels\": %d}, "
|
"\"audioformat\": { \"sample_rate\": %d, \"bits\": %d, \"channels\": %d}, "
|
||||||
"\"queue_length\": %d, \"nextsongpos\": %d"
|
"\"queue_length\": %d, \"nextsongpos\": %d, \"nextsongid\": %d"
|
||||||
"}}",
|
"}}",
|
||||||
mpd_status_get_state(status),
|
mpd_status_get_state(status),
|
||||||
mpd_status_get_volume(status),
|
mpd_status_get_volume(status),
|
||||||
@ -717,7 +719,8 @@ int mpd_put_state(char *buffer, int *current_song_id, int *next_song_id, unsign
|
|||||||
audioformat ? audioformat->bits : 0,
|
audioformat ? audioformat->bits : 0,
|
||||||
audioformat ? audioformat->channels : 0,
|
audioformat ? audioformat->channels : 0,
|
||||||
mpd_status_get_queue_length(status),
|
mpd_status_get_queue_length(status),
|
||||||
mpd_status_get_next_song_pos(status)
|
mpd_status_get_next_song_pos(status),
|
||||||
|
mpd_status_get_next_song_id(status)
|
||||||
);
|
);
|
||||||
|
|
||||||
*current_song_id = mpd_status_get_song_id(status);
|
*current_song_id = mpd_status_get_song_id(status);
|
||||||
@ -825,7 +828,7 @@ int mpd_put_current_song(char *buffer)
|
|||||||
cur += json_emit_raw_str(cur, end - cur, ",\"uri\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"uri\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, "}}");
|
cur += json_emit_raw_str(cur, end - cur, "}}");
|
||||||
|
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
mpd_response_finish(mpd.conn);
|
mpd_response_finish(mpd.conn);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user