mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-22 13:07:16 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
63be6f0de0
@ -12,18 +12,17 @@
|
|||||||
|
|
||||||
name="ympd"
|
name="ympd"
|
||||||
rcvar="${name}_enable"
|
rcvar="${name}_enable"
|
||||||
command="/usr/local/bin/ympd"
|
command="/usr/local/bin/${name}"
|
||||||
pidfile="/var/run/${name}.pid"
|
pidfile="/var/run/${name}.pid"
|
||||||
start_cmd="ympd_start"
|
start_cmd="ympd_start"
|
||||||
|
|
||||||
load_rc_config "$name"
|
load_rc_config "${name}"
|
||||||
: ${ympd_enable:="NO"}
|
: ${ympd_enable:="NO"}
|
||||||
: ${ympd_user:="nobody"}
|
|
||||||
|
|
||||||
ympd_start()
|
ympd_start()
|
||||||
{
|
{
|
||||||
check_startmsgs && echo "Starting ${name}."
|
check_startmsgs && echo "Starting ${name}."
|
||||||
/usr/sbin/daemon -f -p "${pidfile}" -t "${name}" -u "${ympd_user}" "${command}"
|
/usr/sbin/daemon -f -p "${pidfile}" "${command}" "${rc_flags}"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_rc_command "$1"
|
run_rc_command "$1"
|
||||||
|
@ -28,10 +28,10 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#counter {
|
#counter {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
margin-top: -6px;
|
margin-top: -6px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search {
|
#search {
|
||||||
@ -39,7 +39,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-group-hover {
|
.btn-group-hover {
|
||||||
opacity: 20%;
|
opacity: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:active,
|
.btn:active,
|
||||||
@ -61,10 +61,15 @@ button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#salamisandwich td:nth-child(3), th:nth-child(3) {
|
#salamisandwich td:nth-last-child(2), th:nth-last-child(2) {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#salamisandwich td:nth-child(2) span {
|
||||||
|
font-style:italic;
|
||||||
|
font-size:90%;
|
||||||
|
}
|
||||||
|
|
||||||
tbody {
|
tbody {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -94,3 +99,9 @@ td:last-child, td:first-child {
|
|||||||
button {
|
button {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#trashmode span:last-child {
|
||||||
|
display:inline-block;
|
||||||
|
text-align:left;
|
||||||
|
width:2.8em;
|
||||||
|
}
|
||||||
|
@ -166,7 +166,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.col-md-10 -->
|
</div><!-- /.col-md-10 -->
|
||||||
|
|
||||||
<div class="col-md-2 col-xs-12" >
|
<div class="col-md-2 col-xs-12">
|
||||||
<div class="btn-toolbar">
|
<div class="btn-toolbar">
|
||||||
<div class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons">
|
<div class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons">
|
||||||
<button id="btnrandom" type="button" class="btn btn-default">
|
<button id="btnrandom" type="button" class="btn btn-default">
|
||||||
@ -191,32 +191,27 @@
|
|||||||
<div id="trashmode" class="btn-group-vertical btn-block btn-group-lg" data-toggle="radio">
|
<div id="trashmode" class="btn-group-vertical btn-block btn-group-lg" data-toggle="radio">
|
||||||
<button id="btntrashmodeup" type="button" class="btn btn-default">
|
<button id="btntrashmodeup" type="button" class="btn btn-default">
|
||||||
<span class="glyphicon glyphicon-chevron-up"></span>
|
<span class="glyphicon glyphicon-chevron-up"></span>
|
||||||
<span class="glyphicon glyphicon-trash"></span> up
|
<span class="glyphicon glyphicon-trash"></span> <span>Up</span>
|
||||||
</button>
|
</button>
|
||||||
<button id="btntrashmodesingle" type="button" class="btn btn-default active">
|
<button id="btntrashmodesingle" type="button" class="btn btn-default active">
|
||||||
<span class="glyphicon glyphicon-star-empty"></span>
|
<span class="glyphicon glyphicon-star-empty"></span>
|
||||||
<span class="glyphicon glyphicon-trash"></span> single
|
<span class="glyphicon glyphicon-trash"></span> <span>Single</span>
|
||||||
</button>
|
</button>
|
||||||
<button id="btntrashmodedown" type="button" class="btn btn-default">
|
<button id="btntrashmodedown" type="button" class="btn btn-default">
|
||||||
<span class="glyphicon glyphicon-chevron-down"></span>
|
<span class="glyphicon glyphicon-chevron-down"></span>
|
||||||
<span class="glyphicon glyphicon-trash"></span> down
|
<span class="glyphicon glyphicon-trash"></span> <span>Down</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg">
|
<div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg">
|
||||||
<button type="button" class="btn btn-default" onclick="socket.send('MPD_API_RM_ALL');">
|
<button type="button" class="btn btn-default" onclick="socket.send('MPD_API_RM_ALL');">
|
||||||
<span class="glyphicon glyphicon-trash"></span> Clear queue
|
<span class="glyphicon glyphicon-trash"></span> Clear Queue
|
||||||
</button>
|
</button>
|
||||||
<a href="#" data-toggle="modal" data-target="#savequeue" class="btn btn-default">
|
<a href="#" data-toggle="modal" data-target="#savequeue" class="btn btn-default">
|
||||||
<span class="glyphicon glyphicon-save"></span> Save queue
|
<span class="glyphicon glyphicon-save"></span> Save Queue
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons">
|
|
||||||
<button type="button" class="btn btn-default" id="btnnotify">
|
|
||||||
<span class="glyphicon glyphicon-comment"></span> Notifications
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.col-md-2 -->
|
</div><!-- /.col-md-2 -->
|
||||||
</div><!-- /.row -->
|
</div><!-- /.row -->
|
||||||
@ -237,6 +232,19 @@
|
|||||||
<h5>ympd uses following excellent software:</h5>
|
<h5>ympd uses following excellent software:</h5>
|
||||||
<h6><a href="http://cesanta.com/docs.html">Mongoose</a> <small>GPLv2</small></h6>
|
<h6><a href="http://cesanta.com/docs.html">Mongoose</a> <small>GPLv2</small></h6>
|
||||||
<h6><a href="http://www.musicpd.org/libs/libmpdclient/">libMPDClient</a> <small>BSD License</small></h6>
|
<h6><a href="http://www.musicpd.org/libs/libmpdclient/">libMPDClient</a> <small>BSD License</small></h6>
|
||||||
|
<hr />
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<button type="button" class="btn btn-default btn-block" onclick="updateDB();">
|
||||||
|
<span class="glyphicon glyphicon-refresh"></span> Update Database
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6" data-toggle="buttons">
|
||||||
|
<button type="button" class="btn btn-default btn-block" id="btnnotify">
|
||||||
|
<span class="glyphicon glyphicon-comment"></span> Enable Notifications
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<form role="form">
|
<form role="form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -256,7 +264,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label class="control-label" for="mpd_pw_con">MPD Password (Confirmation)</label>
|
<label class="control-label" for="mpd_pw_con">MPD Password (Confirmation)</label>
|
||||||
<input type="password" class="form-control" id="mpd_pw_con" placeholder="Password confirmation"
|
<input type="password" class="form-control" id="mpd_pw_con" placeholder="Confirmation"
|
||||||
data-placement="right" data-toggle="popover" data-content="Password does not match!"
|
data-placement="right" data-toggle="popover" data-content="Password does not match!"
|
||||||
data-trigger="manual" />
|
data-trigger="manual" />
|
||||||
</div>
|
</div>
|
||||||
@ -301,7 +309,7 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form role="form">
|
<form role="form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-9">
|
<div class="form-group col-md-12">
|
||||||
<label class="control-label" for="streamurl">Stream URL</label>
|
<label class="control-label" for="streamurl">Stream URL</label>
|
||||||
<input type="text" class="form-control" id="streamurl" />
|
<input type="text" class="form-control" id="streamurl" />
|
||||||
</div>
|
</div>
|
||||||
|
107
htdocs/js/mpd.js
107
htdocs/js/mpd.js
@ -112,7 +112,6 @@ var app = $.sammy(function() {
|
|||||||
$('#panel-heading').text("Search: "+searchstr);
|
$('#panel-heading').text("Search: "+searchstr);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() {
|
this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() {
|
||||||
|
|
||||||
if (TOKEN === "") context.redirect("#/0");
|
if (TOKEN === "") context.redirect("#/0");
|
||||||
@ -139,14 +138,9 @@ var app = $.sammy(function() {
|
|||||||
|
|
||||||
dirble_stations = true;
|
dirble_stations = true;
|
||||||
|
|
||||||
if(dirble_api_token) {
|
if (dirble_api_token) { dirble_load_stations(); }
|
||||||
dirble_load_stations();
|
|
||||||
} else {
|
|
||||||
getDirbleApiToken();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.get(/\#\/dirble\//, function() {
|
this.get(/\#\/dirble\//, function() {
|
||||||
|
|
||||||
if (TOKEN === "") context.redirect("#/0");
|
if (TOKEN === "") context.redirect("#/0");
|
||||||
@ -165,11 +159,7 @@ var app = $.sammy(function() {
|
|||||||
|
|
||||||
dirble_stations = false;
|
dirble_stations = false;
|
||||||
|
|
||||||
if(dirble_api_token) {
|
if (dirble_api_token) { dirble_load_categories(); }
|
||||||
dirble_load_categories();
|
|
||||||
} else {
|
|
||||||
getDirbleApiToken();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get("/", function(context) {
|
this.get("/", function(context) {
|
||||||
@ -268,7 +258,6 @@ $(document).ready(function(){
|
|||||||
if (TOKEN === "") $('#dirble').addClass('hide');
|
if (TOKEN === "") $('#dirble').addClass('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function webSocketConnect() {
|
function webSocketConnect() {
|
||||||
if (typeof MozWebSocket != "undefined") {
|
if (typeof MozWebSocket != "undefined") {
|
||||||
socket = new MozWebSocket(get_appropriate_ws_url());
|
socket = new MozWebSocket(get_appropriate_ws_url());
|
||||||
@ -286,7 +275,9 @@ function webSocketConnect() {
|
|||||||
|
|
||||||
app.run();
|
app.run();
|
||||||
/* emit initial request for output names */
|
/* emit initial request for output names */
|
||||||
socket.send("MPD_API_GET_OUTPUTS");
|
socket.send('MPD_API_GET_OUTPUTS');
|
||||||
|
/* emit initial request for dirble api token */
|
||||||
|
socket.send('MPD_API_GET_DIRBLEAPITOKEN');
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.onmessage = function got_packet(msg) {
|
socket.onmessage = function got_packet(msg) {
|
||||||
@ -297,7 +288,7 @@ function webSocketConnect() {
|
|||||||
|
|
||||||
|
|
||||||
switch (obj.type) {
|
switch (obj.type) {
|
||||||
case "queue":
|
case 'queue':
|
||||||
if(current_app !== 'queue')
|
if(current_app !== 'queue')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -371,14 +362,14 @@ function webSocketConnect() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Make queue table sortable
|
//Make queue table sortable
|
||||||
$("#salamisandwich > tbody").sortable({
|
$('#salamisandwich > tbody').sortable({
|
||||||
helper: fixHelperModified,
|
helper: fixHelperModified,
|
||||||
stop: function(event,ui) {renumber_table('#salamisandwich',ui.item)}
|
stop: function(event,ui) {renumber_table('#salamisandwich',ui.item)}
|
||||||
}).disableSelection();
|
}).disableSelection();
|
||||||
break;
|
break;
|
||||||
case "search":
|
case 'search':
|
||||||
$('#wait').modal('hide');
|
$('#wait').modal('hide');
|
||||||
case "browse":
|
case 'browse':
|
||||||
if(current_app !== 'browse' && current_app !== 'search')
|
if(current_app !== 'browse' && current_app !== 'search')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -391,7 +382,7 @@ function webSocketConnect() {
|
|||||||
}
|
}
|
||||||
for (var item in obj.data) {
|
for (var item in obj.data) {
|
||||||
switch(obj.data[item].type) {
|
switch(obj.data[item].type) {
|
||||||
case "directory":
|
case 'directory':
|
||||||
var clazz = 'dir';
|
var clazz = 'dir';
|
||||||
if (filter !== undefined) {
|
if (filter !== undefined) {
|
||||||
var first = obj.data[item].dir[0];
|
var first = obj.data[item].dir[0];
|
||||||
@ -406,12 +397,11 @@ function webSocketConnect() {
|
|||||||
$('#salamisandwich > tbody').append(
|
$('#salamisandwich > tbody').append(
|
||||||
"<tr uri=\"" + encodeURI(obj.data[item].dir) + "\" class=\"" + clazz + "\">" +
|
"<tr uri=\"" + encodeURI(obj.data[item].dir) + "\" class=\"" + clazz + "\">" +
|
||||||
"<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" +
|
"<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" +
|
||||||
"<td><a>" + basename(obj.data[item].dir) + "</a></td>" +
|
"<td colspan=\"3\"><a>" + basename(obj.data[item].dir) + "</a></td>" +
|
||||||
"<td></td><td></td>" +
|
|
||||||
"<td></td><td></td></tr>"
|
"<td></td><td></td></tr>"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "playlist":
|
case 'playlist':
|
||||||
var clazz = 'plist';
|
var clazz = 'plist';
|
||||||
if (filter !== "||") {
|
if (filter !== "||") {
|
||||||
clazz += ' hide';
|
clazz += ' hide';
|
||||||
@ -419,16 +409,21 @@ function webSocketConnect() {
|
|||||||
$('#salamisandwich > tbody').append(
|
$('#salamisandwich > tbody').append(
|
||||||
"<tr uri=\"" + encodeURI(obj.data[item].plist) + "\" class=\"" + clazz + "\">" +
|
"<tr uri=\"" + encodeURI(obj.data[item].plist) + "\" class=\"" + clazz + "\">" +
|
||||||
"<td><span class=\"glyphicon glyphicon-list\"></span></td>" +
|
"<td><span class=\"glyphicon glyphicon-list\"></span></td>" +
|
||||||
"<td><a>" + basename(obj.data[item].plist) + "</a></td>" +
|
"<td colspan=\"3\"><a>" + basename(obj.data[item].plist) + "</a></td>" +
|
||||||
"<td></td><td></td>" +
|
|
||||||
"<td></td><td></td></tr>"
|
"<td></td><td></td></tr>"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "song":
|
case 'song':
|
||||||
var minutes = Math.floor(obj.data[item].duration / 60);
|
var minutes = Math.floor(obj.data[item].duration / 60);
|
||||||
var seconds = obj.data[item].duration - minutes * 60;
|
var seconds = obj.data[item].duration - minutes * 60;
|
||||||
|
|
||||||
$('#salamisandwich > tbody').append(
|
if (typeof obj.data[item].artist === 'undefined') {
|
||||||
|
var details = "<td colspan=\"2\">" + obj.data[item].title + "</td>";
|
||||||
|
} else {
|
||||||
|
var details = "<td>" + obj.data[item].artist + "<br /><span>" + obj.data[item].album + "</span></td><td>" + obj.data[item].title + "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#salamisandwich > tbody').append(
|
||||||
"<tr uri=\"" + encodeURI(obj.data[item].uri) + "\" class=\"song\">" +
|
"<tr uri=\"" + encodeURI(obj.data[item].uri) + "\" class=\"song\">" +
|
||||||
"<td><span class=\"glyphicon glyphicon-music\"></span></td>" +
|
"<td><span class=\"glyphicon glyphicon-music\"></span></td>" +
|
||||||
"<td>" + obj.data[item].title + "</td>" +
|
"<td>" + obj.data[item].title + "</td>" +
|
||||||
@ -438,14 +433,13 @@ function webSocketConnect() {
|
|||||||
"</td><td></td></tr>"
|
"</td><td></td></tr>"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "wrap":
|
case 'wrap':
|
||||||
if(current_app == 'browse') {
|
if(current_app == 'browse') {
|
||||||
$('#next').removeClass('hide');
|
$('#next').removeClass('hide');
|
||||||
} else {
|
} else {
|
||||||
$('#salamisandwich > tbody').append(
|
$('#salamisandwich > tbody').append(
|
||||||
"<tr><td><span class=\"glyphicon glyphicon-remove\"></span></td>" +
|
"<tr><td><span class=\"glyphicon glyphicon-remove\"></span></td>" +
|
||||||
"<td>Too many results, please refine your search!</td>" +
|
"<td colspan=\"3\">Too many results, please refine your search!</td>" +
|
||||||
"<td></td><td></td>" +
|
|
||||||
"<td></td><td></td></tr>"
|
"<td></td><td></td></tr>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -466,7 +460,7 @@ function webSocketConnect() {
|
|||||||
socket.send(onClickAction + "," + decodeURI($(this).parents("tr").attr("uri")));
|
socket.send(onClickAction + "," + decodeURI($(this).parents("tr").attr("uri")));
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
message:{
|
message:{
|
||||||
text: $('td:nth-child(2)', $(this).parents("tr")).text() + " added"
|
text: "\"" + $('td:nth-last-child(3)', $(this).parents("tr")).text() + "\" added"
|
||||||
} }).show();
|
} }).show();
|
||||||
}).fadeTo('fast',1);
|
}).fadeTo('fast',1);
|
||||||
}
|
}
|
||||||
@ -500,7 +494,7 @@ function webSocketConnect() {
|
|||||||
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
message:{
|
message:{
|
||||||
text: $('td:nth-child(2)', this).text() + " added"
|
text: "\"" + $('td:nth-last-child(3)', this).text() + "\" added"
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
break;
|
break;
|
||||||
@ -508,7 +502,7 @@ function webSocketConnect() {
|
|||||||
socket.send("MPD_API_ADD_PLAYLIST," + decodeURI($(this).attr("uri")));
|
socket.send("MPD_API_ADD_PLAYLIST," + decodeURI($(this).attr("uri")));
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
message:{
|
message:{
|
||||||
text: "Playlist " + $('td:nth-child(2)', this).text() + " added"
|
text: "\"" + $('td:nth-last-child(3)', this).text() + "\" added"
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
break;
|
break;
|
||||||
@ -517,7 +511,7 @@ function webSocketConnect() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "state":
|
case 'state':
|
||||||
updatePlayIcon(obj.data.state);
|
updatePlayIcon(obj.data.state);
|
||||||
updateVolumeIcon(obj.data.volume);
|
updateVolumeIcon(obj.data.volume);
|
||||||
|
|
||||||
@ -571,16 +565,20 @@ function webSocketConnect() {
|
|||||||
|
|
||||||
last_state = obj;
|
last_state = obj;
|
||||||
break;
|
break;
|
||||||
case "outputnames":
|
case 'outputnames':
|
||||||
$('#btn-outputs-block button').remove();
|
$('#btn-outputs-block button').remove();
|
||||||
$.each(obj.data, function(id, name){
|
if (obj.data.length > 1) {
|
||||||
var btn = $('<button id="btnoutput'+id+'" class="btn btn-default" onclick="toggleoutput(this, '+id+')"><span class="glyphicon glyphicon-volume-up"></span> '+name+'</button>');
|
$.each(obj.data, function(id, name){
|
||||||
btn.appendTo($('#btn-outputs-block'));
|
var btn = $('<button id="btnoutput'+id+'" class="btn btn-default" onclick="toggleoutput(this, '+id+')"><span class="glyphicon glyphicon-volume-up"></span> '+name+'</button>');
|
||||||
});
|
btn.appendTo($('#btn-outputs-block'));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#btn-outputs-block').addClass('hide');
|
||||||
|
}
|
||||||
/* remove cache, since the buttons have been recreated */
|
/* remove cache, since the buttons have been recreated */
|
||||||
last_outputs = '';
|
last_outputs = '';
|
||||||
break;
|
break;
|
||||||
case "outputs":
|
case 'outputs':
|
||||||
if(JSON.stringify(obj) === JSON.stringify(last_outputs))
|
if(JSON.stringify(obj) === JSON.stringify(last_outputs))
|
||||||
break;
|
break;
|
||||||
$.each(obj.data, function(id, enabled){
|
$.each(obj.data, function(id, enabled){
|
||||||
@ -591,7 +589,7 @@ function webSocketConnect() {
|
|||||||
});
|
});
|
||||||
last_outputs = obj;
|
last_outputs = obj;
|
||||||
break;
|
break;
|
||||||
case "disconnected":
|
case 'disconnected':
|
||||||
if($('.top-right').has('div').length == 0)
|
if($('.top-right').has('div').length == 0)
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
message:{text:"ympd lost connection to MPD "},
|
message:{text:"ympd lost connection to MPD "},
|
||||||
@ -599,11 +597,11 @@ function webSocketConnect() {
|
|||||||
fadeOut: { enabled: true, delay: 1000 },
|
fadeOut: { enabled: true, delay: 1000 },
|
||||||
}).show();
|
}).show();
|
||||||
break;
|
break;
|
||||||
case "update_queue":
|
case 'update_queue':
|
||||||
if(current_app === 'queue')
|
if(current_app === 'queue')
|
||||||
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
||||||
break;
|
break;
|
||||||
case "song_change":
|
case 'song_change':
|
||||||
|
|
||||||
$('#album').text("");
|
$('#album').text("");
|
||||||
$('#artist').text("");
|
$('#artist').text("");
|
||||||
@ -631,23 +629,27 @@ function webSocketConnect() {
|
|||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "mpdhost":
|
case 'mpdhost':
|
||||||
$('#mpdhost').val(obj.data.host);
|
$('#mpdhost').val(obj.data.host);
|
||||||
setLocalStream(obj.data.host);
|
setLocalStream(obj.data.host);
|
||||||
$('#mpdport').val(obj.data.port);
|
$('#mpdport').val(obj.data.port);
|
||||||
if(obj.data.passwort_set)
|
if(obj.data.passwort_set)
|
||||||
$('#mpd_password_set').removeClass('hide');
|
$('#mpd_password_set').removeClass('hide');
|
||||||
break;
|
break;
|
||||||
case "dirbleapitoken":
|
case 'dirbleapitoken':
|
||||||
dirble_api_token = obj.data;
|
dirble_api_token = obj.data;
|
||||||
|
|
||||||
if(dirble_stations) {
|
if (dirble_api_token) {
|
||||||
dirble_load_stations();
|
$('#dirble').removeClass('hide');
|
||||||
|
|
||||||
|
if (dirble_stations) { dirble_load_stations(); }
|
||||||
|
else { dirble_load_categories(); }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dirble_load_categories();
|
$('#dirble').addClass('hide');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "error":
|
case 'error':
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
message:{text: obj.data},
|
message:{text: obj.data},
|
||||||
type: "danger",
|
type: "danger",
|
||||||
@ -655,9 +657,8 @@ function webSocketConnect() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.onclose = function(){
|
socket.onclose = function(){
|
||||||
console.log("disconnected");
|
console.log("disconnected");
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
@ -898,10 +899,6 @@ function getHost() {
|
|||||||
$('#mpd_pw_con').keypress(onEnter);
|
$('#mpd_pw_con').keypress(onEnter);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDirbleApiToken() {
|
|
||||||
socket.send('MPD_API_GET_DIRBLEAPITOKEN');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#search').submit(function () {
|
$('#search').submit(function () {
|
||||||
app.setLocation("#/search/"+$('#search > div > input').val());
|
app.setLocation("#/search/"+$('#search > div > input').val());
|
||||||
$('#wait').modal('show');
|
$('#wait').modal('show');
|
||||||
|
@ -595,18 +595,10 @@ 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, ",\"artist\":");
|
||||||
if(mpd_song_get_tag(song, MPD_TAG_ARTIST, 0) != NULL)
|
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, ",\"artist\":");
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_tag(song, MPD_TAG_ARTIST, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mpd_song_get_tag(song, MPD_TAG_ALBUM, 0) != NULL)
|
|
||||||
{
|
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_tag(song, MPD_TAG_ALBUM, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
cur += json_emit_raw_str(cur, end - cur, "}}");
|
cur += json_emit_raw_str(cur, end - cur, "}}");
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
@ -644,6 +636,10 @@ int mpd_put_queue(char *buffer, 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, ",\"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, ",\"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, "},");
|
cur += json_emit_raw_str(cur, end - cur, "},");
|
||||||
}
|
}
|
||||||
mpd_entity_free(entity);
|
mpd_entity_free(entity);
|
||||||
@ -766,6 +762,10 @@ int mpd_search(char *buffer, char *searchstr)
|
|||||||
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\":");
|
||||||
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, ",\"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, "},");
|
cur += json_emit_raw_str(cur, end - cur, "},");
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
|
|
||||||
|
@ -95,8 +95,6 @@ int main(int argc, char **argv)
|
|||||||
mpd.gpass = NULL;
|
mpd.gpass = NULL;
|
||||||
strcpy(mpd.host, "127.0.0.1");
|
strcpy(mpd.host, "127.0.0.1");
|
||||||
|
|
||||||
strcpy(dirble_api_token, "2e223c9909593b94fc6577361a");
|
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"digest", required_argument, 0, 'D'},
|
{"digest", required_argument, 0, 'D'},
|
||||||
{"host", required_argument, 0, 'h'},
|
{"host", required_argument, 0, 'h'},
|
||||||
|
Loading…
Reference in New Issue
Block a user