Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: moOde 9.0.5 and 9.0.7: Adding radio station to playlist does not work
#61
(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
Reply
#62
(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));
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#63
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
                )

        )

)
Reply
#64
(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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#65
If there's anything you would like me to test, let me know.
Best,
k
Reply
#66
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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#67
Photo 
(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:
[Image: fail.jpg]


Successful case:
[Image: success.jpg]
Reply
#68
Excellent. That isolates the issue to a section of the front-end JS code.

Are there any errors in console for the failure case?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#69
(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.
[Image: E500.jpg]
Reply
#70
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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: