02-03-2024, 02:29 PM
(02-03-2024, 02:20 PM)Tim Curtis Wrote:(02-03-2024, 01:14 PM)Nutul Wrote:(02-03-2024, 12:20 PM)Tim Curtis Wrote: ETA: The OP reported this error message
Code:"json.parse unexpected character at line 1 column 1 of the json data"
IIRC there is a legit back-end scenario in the genLibrary() routine where the presence of non-UTF8 characters in the song file metadata can result in json parse failing and an empty libcache_.json file.
Since I see no such message template anywhere, it looks like the response of the json.parse method directly from JQuery. This actually denotes an error in the data.
Yes it's prolly empty JSON data being returned by MPD to the front end thats causing the error to be thrown by the JSON parse function. See below.
Code:// MPD metadata engine
function engineMpd() {
$.ajax({
type: 'GET',
url: 'engine-mpd.php?state=' + MPD.json['state'],
async: true,
cache: false,
success: function(data) {
debugLog('engineMpd(): success branch: data=(' + data + ')');
// Always have valid json
try {
MPD.json = JSON.parse(data);
//console.log(MPD.json);
}
catch (e) {
MPD.json['error'] = e;
}
Why is it empty? Thats what needs to be reproducible in order to possibly improve the error handling and messages.
This...
Code:
engine-mpd.php?state=' + MPD.json['state']
together with this...?
Code:
// Check for Worker startup complete
if ($result[0]['value'] == '0') {
exit; // Worker startup is not finished yet');
}