1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-01-27 01:14:53 +00:00

Configurable coverimage filename

This commit is contained in:
jcorporation 2018-05-27 15:14:56 +01:00
parent 14ef6648c6
commit 98e87926f6

View File

@ -36,6 +36,7 @@ var filter = "";
var playstate = ""; var playstate = "";
var progressBar; var progressBar;
var volumeBar; var volumeBar;
var coverImageFile = "";
var app = $.sammy(function() { var app = $.sammy(function() {
@ -185,10 +186,11 @@ function webSocketConnect() {
showNotification('Connected to myMPD','','','success'); showNotification('Connected to myMPD','','','success');
$('#modalConnectionError').modal('hide'); $('#modalConnectionError').modal('hide');
app.run(); app.run();
/* emit initial request for output names */
socket.send('MPD_API_GET_OUTPUTS');
/* emit request for mympd options */ /* emit request for mympd options */
socket.send('MPD_API_GET_OPTIONS'); socket.send('MPD_API_GET_OPTIONS');
/* emit initial request for output names */
socket.send('MPD_API_GET_OUTPUTS');
} }
socket.onmessage = function got_packet(msg) { socket.onmessage = function got_packet(msg) {
@ -560,6 +562,7 @@ function webSocketConnect() {
break; break;
case 'mpdoptions': case 'mpdoptions':
setLocalStream(obj.data.mpdhost,obj.data.streamport); setLocalStream(obj.data.mpdhost,obj.data.streamport);
coverImageFile=obj.data.coverimage;
break; break;
case 'error': case 'error':
showNotification(obj.data,'','','danger'); showNotification(obj.data,'','','danger');
@ -850,7 +853,7 @@ function songChange(title, artist, album, uri) {
if (uri.indexOf('http://') == 0) { if (uri.indexOf('http://') == 0) {
coverImg='/assets/httpstream.png'; coverImg='/assets/httpstream.png';
} else { } else {
coverImg='/library/'+uri.replace(/\/[^\/]+$/,'\/folder.jpg'); coverImg='/library/'+uri.replace(/\/[^\/]+$/,'\/'+coverImageFile);
} }
$('#album-cover').css('backgroundImage','url("'+coverImg+'")'); $('#album-cover').css('backgroundImage','url("'+coverImg+'")');
} }