1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-10-25 02:47:41 +00:00

Filename for album covers are now based on song_uri, replacing filename with folder.jpg

Merged css/js files
This commit is contained in:
jcorporation
2018-05-07 20:11:49 +01:00
parent d97646fa86
commit c83fa60e20
6 changed files with 30 additions and 30 deletions

View File

@@ -1,19 +1,3 @@
var div=document.createElement('div');
div.id='album-cover';
div.style='background-size:cover;border:1px solid black;border-radius:5px;overflow:hidden;float:left;margin-right:20px;width:120px;height:120px;background-color:#eee;';
var pb=document.querySelector('.panel-body');
pb.insertBefore(div,pb.childNodes[0]);
//Remove some buttons
document.getElementById('btnlove').parentNode.style.display='none';
document.getElementById('player').parentNode.style.display='none';
function changeCover(obj) {
if (obj.data.artist && obj.data.album) {
var coverImg=obj.data.album_artist.replace(/\s+/g,'_')+'-'+obj.data.album.replace(/\s+/g,'_')+'.jpg';
document.getElementById('album-cover').style.backgroundImage='url("/covers/'+coverImg+'")';
}
else {
document.getElementById('album-cover').style.backgroundImage='';
}
}

View File

@@ -87,6 +87,7 @@ var app = $.sammy(function() {
}
$('#panel-heading').text("Browse database: "+browsepath);
$('#panel-heading-info').empty();
var path_array = browsepath.split('/');
var full_path = "";
$.each(path_array, function(index, chunk) {
@@ -623,18 +624,18 @@ function webSocketConnect() {
break;
case "song_change":
changeCover(obj);
var coverImg='/library/'+obj.data.uri.replace(/\/[^\/]+$/,'\/folder.jpg');
document.getElementById('album-cover').style.backgroundImage='url("'+coverImg+'")';
$('#album').text("");
$('#artist').text("");
$('#btnlove').removeClass("active");
$('#btnlove').removeClass("active");
$('#currenttrack').text(" " + obj.data.title);
var notification = "<strong><h4>" + obj.data.title + "</h4></strong>";
if(obj.data.album) {
$('#album').text(obj.data.album);
notification += obj.data.album + "<br />";