mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 13:07:03 +03:00
build command line from website form
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
var commandHeader = 'squeezelite -b 500:2000 -d all=info ';
|
||||
|
||||
// First, checks if it isn't implemented yet.
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function() {
|
||||
@@ -173,10 +175,18 @@ $(document).ready(function(){
|
||||
$( "#wifi" ).slideDown( "fast", function() {})
|
||||
});
|
||||
|
||||
$("#update-command").on("click", function() {
|
||||
$("#update-command").click(function() {
|
||||
updateAutoexec();
|
||||
});
|
||||
|
||||
$("#generate-command").click(function() {
|
||||
generateCommand();
|
||||
});
|
||||
|
||||
$('[name=audio]').click(function(){
|
||||
selectOutput(this);
|
||||
});
|
||||
|
||||
//first time the page loads: attempt get the connection status and start the wifi scan
|
||||
refreshAP();
|
||||
startCheckStatusInterval();
|
||||
@@ -184,27 +194,6 @@ $(document).ready(function(){
|
||||
getConfig();
|
||||
});
|
||||
|
||||
|
||||
function performFactory(){
|
||||
|
||||
// $( "#ok-connect" ).prop("disabled",true);
|
||||
// $( "#ssid-wait" ).text(selectedSSID);
|
||||
// $( "#connect" ).slideUp( "fast", function() {});
|
||||
// $( "#connect_manual" ).slideUp( "fast", function() {});
|
||||
// $( "#connect-wait" ).slideDown( "fast", function() {});
|
||||
// // todo: should we update the UI here?
|
||||
|
||||
$.ajax({
|
||||
url: '/factory.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function performConnect(conntype){
|
||||
|
||||
//stop the status refresh. This prevents a race condition where a status
|
||||
@@ -407,3 +396,44 @@ function updateAutoexec(){
|
||||
console.log('sent config JSON with headers:', autoexec, autoexec1);
|
||||
}
|
||||
|
||||
function performFactory(){
|
||||
// $( "#ok-connect" ).prop("disabled",true);
|
||||
// $( "#ssid-wait" ).text(selectedSSID);
|
||||
// $( "#connect" ).slideUp( "fast", function() {});
|
||||
// $( "#connect_manual" ).slideUp( "fast", function() {});
|
||||
// $( "#connect-wait" ).slideDown( "fast", function() {});
|
||||
// // todo: should we update the UI here?
|
||||
|
||||
$.ajax({
|
||||
url: '/factory.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
}
|
||||
|
||||
var output = '';
|
||||
function selectOutput(el) {
|
||||
if ($(el).attr('id') == 'bt') {
|
||||
$("#btsinkdiv").show(200);
|
||||
output = 'bt';
|
||||
} else {
|
||||
$("#btsinkdiv").hide(200);
|
||||
output = 'i2s';
|
||||
}
|
||||
}
|
||||
|
||||
function generateCommand() {
|
||||
var commandLine = commandHeader + '-n ' + $("#player").val();
|
||||
|
||||
if (output == 'bt') {
|
||||
commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -u m -Z 192000 -r "44100-44100"';
|
||||
} else {
|
||||
commandLine += ' -o I2S';
|
||||
}
|
||||
if ($("#optional").val() != '') {
|
||||
commandLine += ' ' + $("#optional").val();
|
||||
}
|
||||
$("#autoexec1").val(commandLine);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user