Posts: 1,869
Threads: 43
Joined: Mar 2020
Reputation:
85
(08-04-2024, 11:56 AM)kurt1970 Wrote: (08-04-2024, 11:19 AM)the_bertrum Wrote: (08-04-2024, 08:03 AM)kurt1970 Wrote: @TheOldPresbyope , @Tim Curtis , @Nutul I just sent you via PM a movie where I explain how to reproduce the issue, but also how you can workaround it.
As mentioned earlier, I bet on a playlist file locking issue, caused by MPD locking the file when scanning the PL folder.
The reproducer scenario works consistent on my 3 PIs.
Just so I'm sure I've got the case straight in my head, you get this error when:
A stored playlist is loaded into the queue, you start to play that playlist, then you try to re-add to the playlist a station that is already on the playlist?
Or
A stored playlist is loaded into the queue, you start to play that playlist, then you try to add a new station to the playlist?
And you get the error when using the three dot on a station and selecting "add to playlist" but not when adding a station to the queue then saving the queue as a playlist?
Hi Robert,
It's just about adding radio stations to whatever playlist. This causes an issue when
In this video you can see what happens and how to reproduce the issue. Turn on the volume, as I explain the steps.
Well the video is very clear, but even sticking to the radio stations you are using in your test I can't repro either. There must be something very specific in your system that's tripping this up. Do you have any packet inspection or such like going on in your LAN?
----------------
Robert
Posts: 13,403
Threads: 304
Joined: Mar 2018
Reputation:
543
08-04-2024, 07:07 PM
(This post was last modified: 08-04-2024, 07:08 PM by Tim Curtis.)
(08-04-2024, 05:36 PM)kurt1970 Wrote: Hi @Tim Curtis ,
I added some more logging in playlist.php. Now it looks like this:
Code: case 'upd_playlist':
$plName = html_entity_decode($_POST['path']['name']);
// Get metadata (may not exist so defaults will be returned)
$plMeta = getPlaylistMetadata($plName);
$updPlMeta = array('genre' => $_POST['path']['genre'], 'cover' => $plMeta['cover']);
$plItems = $_POST['path']['items'];
// Write metadata tags, contents and cover image
putPlaylistContents($plName, $updPlMeta, $plItems);
putPlaylistCover($plName);
break;
case 'add_to_playlist':
$plName = html_entity_decode($_POST['path']['playlist']);
workerLog('here0');
// Get metadata (may not exist so defaults will be returned)
$plMeta = getPlaylistMetadata($plName);
workerLog('here1');
// Replace with URL if radio station
if (count($_POST['path']['items']) == 1 && substr($_POST['path']['items'][0], -4) == '.pls') {
workerLog('here1.1');
$stName = substr($_POST['path']['items'][0], 6, -4); // Trim RADIO/ and .pls
workerLog('here1.2');
$result = sqlQuery("SELECT station FROM cfg_radio WHERE name='" . SQLite3::escapeString($stName) . "'", sqlConnect());
workerLog('here1.3');
$_POST['path']['items'][0] = $result[0]['station']; // URL
}
workerLog('here2');
// Write metadata tags, contents and cover image
putPlaylistMetadata($plName, array('#EXTGENRE:' . $plMeta['genre'], '#EXTIMG:' . $plMeta['cover']));
putPlaylistContents($plName, $plMeta, $_POST['path']['items'], FILE_APPEND);
putPlaylistCover($plName);
workerLog('here3');
break;
Test 1: A radio station is playing, and I try to add a radio station to a PL. Test failed. Following info in the log:
20240804 193502 here0
20240804 193502 here1
Test 2: No radio station is playing, and I try to add a radio station to a PL. Test passed. Following info in the log:
20240804 193533 here0
20240804 193533 here1
20240804 193533 here1.1
20240804 193533 here1.2
20240804 193533 here1.3
20240804 193533 here2
20240804 193536 here3
Ok, good.
Right after the workerLog('here1'); line place the the new workerLog() line shown below and then post the results from the moode log for a failure case. It should be a breakdown of the contents of the $_POST array. This might provide a clue.
Code: workerLog(print_r($_POST, true));
Posts: 179
Threads: 8
Joined: Sep 2023
Reputation:
0
08-04-2024, 07:21 PM
(This post was last modified: 08-04-2024, 07:23 PM by kurt1970.)
Hi @ Tim Curtis ,
Here you go:
20240804 211949 here0
20240804 211949 here1
20240804 211949 Array
(
[path] => Array
(
[playlist] => test
[items] => 1
)
)
And when it works, I see this:
20240804 212152 here0
20240804 212152 here1
20240804 212152 Array
(
[path] => Array
(
[playlist] => test
[items] => Array
(
[0] => RADIO/KEXP 90.3 FM Seattle.pls
)
)
)
Posts: 13,403
Threads: 304
Joined: Mar 2018
Reputation:
543
(08-04-2024, 07:21 PM)kurt1970 Wrote: Hi @Tim Curtis ,
Here you go:
20240804 211949 here0
20240804 211949 here1
20240804 211949 Array
(
[path] => Array
(
[playlist] => test
[items] => 1
)
)
And when it works, I see this:
20240804 212152 here0
20240804 212152 here1
20240804 212152 Array
(
[path] => Array
(
[playlist] => test
[items] => Array
(
[0] => RADIO/KEXP 90.3 FM Seattle.pls
)
)
)
The failure case shows that the 'items' element is empty or corrupt. I'll have to walk the client JS code to see where and how that element gets set.
Posts: 179
Threads: 8
Joined: Sep 2023
Reputation:
0
If there's anything you would like me to test, let me know.
Best,
k
Posts: 13,403
Threads: 304
Joined: Mar 2018
Reputation:
543
Ok, here's the next step in debugging.
I'm using Chrome on my Mac but other Browsers should have a similar Javascript console.
1. Open the Browser Javascript console
2. As a control, perform a success case up to the point where the list of Playlists is displayed but don't click the Add button
- In the console display the contents of the varilables UI.dbEntry[0] and UI.dbEntry[4]. They should both contain the path to the station pls file. Here's a screen shot of what that should look like.
3. Now perform a failure case up to the point where the list of Playlists is displayed but don't click the Add button.
Display the contents of the variables and post a screen shot of the console.
Posts: 179
Threads: 8
Joined: Sep 2023
Reputation:
0
08-04-2024, 09:06 PM
(This post was last modified: 08-04-2024, 09:07 PM by kurt1970.)
(08-04-2024, 08:23 PM)Tim Curtis Wrote: Ok, here's the next step in debugging.
I'm using Chrome on my Mac but other Browsers should have a similar Javascript console.
1. Open the Browser Javascript console
2. As a control, perform a success case up to the point where the list of Playlists is displayed but don't click the Add button
- In the console display the contents of the varilables UI.dbEntry[0] and UI.dbEntry[4]. They should both contain the path to the station pls file. Here's a screen shot of what that should look like.
3. Now perform a failure case up to the point where the list of Playlists is displayed but don't click the Add button.
Display the contents of the variables and post a screen shot of the console.
Hi @ Tim Curtis ,
To do your test, I used Chrome on a Win machine.
Failing case:
Successful case:
Posts: 13,403
Threads: 304
Joined: Mar 2018
Reputation:
543
Excellent. That isolates the issue to a section of the front-end JS code.
Are there any errors in console for the failure case?
Posts: 179
Threads: 8
Joined: Sep 2023
Reputation:
0
(08-04-2024, 09:24 PM)Tim Curtis Wrote: Excellent. That isolates the issue to a section of the front-end JS code.
Are there any errors in console for the failure case?
Yes. When I press the "Add" button in case of a failure, I get a HTTP 500 error message in the console.
Posts: 13,403
Threads: 304
Joined: Mar 2018
Reputation:
543
I mean before clicking the add button. The 500 error indicates the script crashed and thats been confirmed by the workerLog statements for the failure case.
|