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
#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


Messages In This Thread
RE: moOde 9.0.5: Adding radio station to playlist does not work - by Tim Curtis - 08-04-2024, 07:07 PM

Forum Jump: