1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-25 02:20:27 +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

@ -5,7 +5,7 @@ ympd
Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
This fork supports display of coverimages.
Put cover images in: ```/path/to/src/htdocs/covers/albumartis-album.jpg```
Link your mpd music directory to ```/path/to/src/htdocs/library``` and put ```folder.jpg``` files in your album directories
http://www.ympd.org

View File

@ -150,3 +150,15 @@ button {
text-align:left;
width:2.8em;
}
#album-cover {
background-size:cover;
border:1px solid black;
border-radius:5px;
overflow:hidden;
float:left;
margin-right:20px;
width:120px;
height:120px;
background-color:#eee;
}

View File

@ -99,6 +99,7 @@
<div class="panel-heading"><b id="panel-heading">Queue</b>
<b id="panel-heading-info" class="text pull-right"></b></div>
<div class="panel-body">
<div id="album-cover"></div>
<h1>
<span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span>
<span id="currenttrack"></span>

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 />";

View File

@ -607,13 +607,15 @@ int mpd_put_current_song(char *buffer)
cur += json_emit_int(cur, end - cur, mpd_song_get_pos(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
// cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
// cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
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_raw_str(cur, end - cur, "}}");
mpd_song_free(song);
@ -655,8 +657,8 @@ int mpd_put_queue(char *buffer, unsigned int offset)
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
// cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
// cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
@ -727,8 +729,8 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset)
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
// cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
// cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
@ -791,8 +793,8 @@ int mpd_search(char *buffer, char *searchstr)
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
// cur += json_emit_raw_str(cur, end - cur, ",\"album_artist\":");
// cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");