mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-12 10:20:34 +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:
parent
d97646fa86
commit
c83fa60e20
@ -5,7 +5,7 @@ ympd
|
|||||||
Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
|
Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
|
||||||
|
|
||||||
This fork supports display of coverimages.
|
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
|
http://www.ympd.org
|
||||||
|
|
||||||
|
@ -150,3 +150,15 @@ button {
|
|||||||
text-align:left;
|
text-align:left;
|
||||||
width:2.8em;
|
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;
|
||||||
|
}
|
@ -99,6 +99,7 @@
|
|||||||
<div class="panel-heading"><b id="panel-heading">Queue</b>
|
<div class="panel-heading"><b id="panel-heading">Queue</b>
|
||||||
<b id="panel-heading-info" class="text pull-right"></b></div>
|
<b id="panel-heading-info" class="text pull-right"></b></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<div id="album-cover"></div>
|
||||||
<h1>
|
<h1>
|
||||||
<span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span>
|
<span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span>
|
||||||
<span id="currenttrack"></span>
|
<span id="currenttrack"></span>
|
||||||
|
@ -1,19 +1,3 @@
|
|||||||
var div=document.createElement('div');
|
//Remove some buttons
|
||||||
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]);
|
|
||||||
|
|
||||||
document.getElementById('btnlove').parentNode.style.display='none';
|
document.getElementById('btnlove').parentNode.style.display='none';
|
||||||
document.getElementById('player').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='';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -87,6 +87,7 @@ var app = $.sammy(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#panel-heading').text("Browse database: "+browsepath);
|
$('#panel-heading').text("Browse database: "+browsepath);
|
||||||
|
$('#panel-heading-info').empty();
|
||||||
var path_array = browsepath.split('/');
|
var path_array = browsepath.split('/');
|
||||||
var full_path = "";
|
var full_path = "";
|
||||||
$.each(path_array, function(index, chunk) {
|
$.each(path_array, function(index, chunk) {
|
||||||
@ -623,18 +624,18 @@ function webSocketConnect() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "song_change":
|
case "song_change":
|
||||||
|
var coverImg='/library/'+obj.data.uri.replace(/\/[^\/]+$/,'\/folder.jpg');
|
||||||
changeCover(obj);
|
document.getElementById('album-cover').style.backgroundImage='url("'+coverImg+'")';
|
||||||
|
|
||||||
$('#album').text("");
|
$('#album').text("");
|
||||||
$('#artist').text("");
|
$('#artist').text("");
|
||||||
|
|
||||||
$('#btnlove').removeClass("active");
|
$('#btnlove').removeClass("active");
|
||||||
|
|
||||||
$('#currenttrack').text(" " + obj.data.title);
|
$('#currenttrack').text(" " + obj.data.title);
|
||||||
var notification = "<strong><h4>" + obj.data.title + "</h4></strong>";
|
var notification = "<strong><h4>" + obj.data.title + "</h4></strong>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(obj.data.album) {
|
if(obj.data.album) {
|
||||||
$('#album').text(obj.data.album);
|
$('#album').text(obj.data.album);
|
||||||
notification += obj.data.album + "<br />";
|
notification += obj.data.album + "<br />";
|
||||||
|
@ -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_int(cur, end - cur, mpd_song_get_pos(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song));
|
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_raw_str(cur, end - cur, ",\"album_artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
|
// 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_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
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, "}}");
|
cur += json_emit_raw_str(cur, end - cur, "}}");
|
||||||
mpd_song_free(song);
|
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_int(cur, end - cur, mpd_song_get_duration(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
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_raw_str(cur, end - cur, ",\"album_artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
|
// 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_raw_str(cur, end - cur, ",\"album\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
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_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
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_raw_str(cur, end - cur, ",\"album_artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
|
// 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_raw_str(cur, end - cur, ",\"duration\":");
|
||||||
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
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_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
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_raw_str(cur, end - cur, ",\"album_artist\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album_artist(song));
|
// 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_raw_str(cur, end - cur, ",\"duration\":");
|
||||||
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
||||||
|
Loading…
Reference in New Issue
Block a user