Author Topic: Cannot get Dynamic Playlists to work  (Read 538 times)

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Cannot get Dynamic Playlists to work
« on: May 03, 2019, 07:34:29 PM »
Hello,


I am running FPP v2.6 and trying to use the "Dynamic" playlist type with "URL" for the Source Type.  The URL that I am using is "http://itwinkle.org/control-lights2/test-nomedia.json".  You can go to this link in your browser.  The JSON file contents is this:


{                                                                                                                                                 
    "name": "test-nomedia",                                                                                                                       
    "repeat": 0,                                                                                                                                 
    "loopCount": 0,                                                                                                                               
    "mainPlaylist": [                                                                                                                             
        {                                                                                                                                         
            "type": "sequence",                                                                                                                   
            "enabled": 1,                                                                                                                         
            "playOnce": 0,                                                                                                                       
            "sequenceName": "test-r-windows-1.fseq"                                                                                               
        }                                                                                                                                         
    ],                                                                                                                                           
    "playlistInfo": {                                                                                                                             
        "total_duration": 30,                                                                                                                     
        "total_items": 1                                                                                                                         
    }                                                                                                                                             
}   


When I try to run this playlist from the Status Page, nothing happens.  No sequence is shown, there is no sequence countdown timer. 


My FPP has 8.8.8.8 in the DNS and I can ping outside websites from the shell, so I know that FPP can see the outside world.  I also tried copying the above JSON file to /opt/fpp/www and created a playlist Dynamic URL to point to the local IP address of the RPi (http://169.101.200.200/test-nomedia.json), but that doesn't work, either.


Can someone tell me what I am doing wrong?  I really need the Dynamic URL playlist feature to work.  I tried searching this forum for references to dynamic playlists but couldn't find any advice.


Thanks for your help,
Tom


Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: Cannot get Dynamic Playlists to work
« Reply #1 on: May 03, 2019, 10:40:21 PM »
I am running FPP v2.6 and trying to use the "Dynamic" playlist type with "URL" for the Source Type.  The URL that I am using is "http://itwinkle.org/control-lights2/test-nomedia.json".  You can go to this link in your browser.  The JSON file contents is this:

Congratulations, you're the first person to use this code other than me. :)  I need to document the JSON format in the help page for the playlist editor, but I wanted to make sure everything was working as expected with the plugin I am working on.

The JSON returned should look like this:

Code: [Select]
{
    "playlistEntries": [
        {
            "type": "sequence",
            "sequenceName": "test-r-windows-1.fseq"
        }
    ]
}

It isn't an actual playlist that is returned, but just an array of playlist entries.  If there is more than one entry, they each will be run once, in order.
-
Chris

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #2 on: May 04, 2019, 02:58:46 PM »
Thanks for the advice!  Did I win an award for the first user of the Dynamic playlist feature?  :)  My show depends on this feature; I am glad that it's there.

I'll try it out when I get home Sunday evening.  You made my day!
Tom

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: Cannot get Dynamic Playlists to work
« Reply #3 on: May 04, 2019, 03:34:24 PM »
Thanks for the advice!  Did I win an award for the first user of the Dynamic playlist feature?  :)  My show depends on this feature; I am glad that it's there.

Yes, you did win an award.  During the month of May, we are giving away one free year of FPP updates.  Enjoy!

Offline mac50

  • Supporting Member
  • ******
  • Join Date: Sep 2014
  • Location: Cumberland County, Illinois
  • Posts: 58
  • Kudos: 2
Re: Cannot get Dynamic Playlists to work
« Reply #4 on: May 04, 2019, 08:40:40 PM »
  During the month of May, we are giving away one free year of FPP updates.  Enjoy!
WOW, what a great prize ;D   Are you sure you won't go broke doing that?
All kidding aside, thanks  Chris, Dan and the other developers for your efforts.

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #5 on: May 05, 2019, 09:20:32 PM »
I tried the abbreviated JSON format and it works perfectly!  So cool that the Dynamic type can read a list of playlist entries from a outside URL.  I'm excited!


Thanks again for your help.
Tom


Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #6 on: May 05, 2019, 09:21:07 PM »
One month of free FPP updates!  Woo hoo!  :)  Just in time for 2.7...

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #7 on: May 24, 2019, 06:22:41 PM »
Hi Chris,


May you help me with another Dynamic Playlist problem? 


To play a sequence only via the Dynamic - URL playlist type, the following file format works fine:



{
"playlistEntries": [
{
"type": "sequence",
"sequenceName": "jingleBells.fseq"
}
]
}


But when I want to play a Media and Sequence via Dynamic URL, the following file format does not work:




{
"playlistEntries": [
{
"type": "both",
"sequenceName": "jingleBells.fseq"
"mediaName": "jingleBells.mp3"
}
]
}


I can create a normal Media and Sequence playlist and run it, so I know that FSEQ and MP3 files are uploaded and working.


Do you know what I am doing wrong?


Thanks,
Tom


Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: Cannot get Dynamic Playlists to work
« Reply #8 on: May 24, 2019, 08:18:48 PM »
Code: [Select]
{
  "playlistEntries": [
    {
      "type": "both",
      "sequenceName": "jingleBells.fseq"
      "mediaName": "jingleBells.mp3"
  ]
}

If that was an actual cut-and-paste then there are two issues.  The first is that you are missing a comma on the end of the sequenceName line.  The second is that you don't have an ending } on the playlist entry in the playlistEntries array.  It should look like this:

Code: [Select]
{
  "playlistEntries": [
    {
      "type": "both",
      "sequenceName": "jingleBells.fseq",
      "mediaName": "jingleBells.mp3"
    }
  ]
}

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #9 on: May 25, 2019, 05:19:06 AM »
Hi Chris,


The missing "}" was a cut & paste problem into this forum.  The missing comma is my fault.  :) 


Great!  Thanks for catching that.  I do know how to program and how sensitive code is to typos. 


I really appreciate it, as the Dynamic feature is an critical part of my show.


Have a fun holiday weekend,
Tom


Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #10 on: May 26, 2019, 03:27:44 PM »
Hi Chris,

I noticed a problem with the The Dynamic > URL playlist type, could you offer some advice?  It doesn't seem to work correctly when "Repeat" is active for the playlist via Status/Control. 

When I manually run a playlist with a Dynamic > URL entry, it reads my json file from a webpage then plays the sequence associated with it.  When the playlist stops and I manually play it again, it reads the json file fresh again.  That is what I expect.

But if I turn on "repeat" then start the playlist, it does not read and process the json file fresh each time is passes through the loop.  Instead, it keeps using the sequence that is cached in memory when the playlist was -first- started.

My json file is hosted on a webpage that changes from time to time, so I am hoping that the dynamic > URL feature will read a fresh json file each time that dynamic playlist entry is processed in Repeat mode.  Is that possible? 

Thanks for your help,
Tom


Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: Cannot get Dynamic Playlists to work
« Reply #11 on: May 28, 2019, 02:24:15 PM »
I noticed a problem with the The Dynamic > URL playlist type, could you offer some advice?  It doesn't seem to work correctly when "Repeat" is active for the playlist via Status/Control. 

Can you set your Log Level to Debug and set the 'Playlists' Log Mask checkbox.  The code should be fetching the URL every time through the loop.  If you set your logging as indicated, you should see log entries starting with "ReadFromURL:" with the URL followed by "ReadFromString:" lines with the actual JSON returned from fetching the URL.  You should see those log entries every time the playlist entry is 'played'.

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #12 on: May 29, 2019, 05:29:38 PM »
Hi Chris,


Thanks for helping with this.  Attached is the log file.  Also attached is the json file of my playlist.  Both are zipped.


My playlist does this:


1. Run a PHP file on my website via the URL playlist type
2. Read and play dynamic.json on my website via the Dynamic playlist type
3. Run a different PHP file on my website
4. Pause for 5 seconds
5. Repeat back to the top


As shown in the log, the first pass through the playlist works fine.  But on the second pass, the PHP files are not run (see the errors on lines 277 and 366). 


During the first pass, I set dynamic.json on my website to jinglebells.fseq as shown in line 116.  This is correct.  While the sequence is playing, I manually changed the contents of dynamic.json on my website to a different sequence, such as silentnight.fseq.  When the second pass of the repeat begins, the log shows that dynamic.json was read, but it incorrectly shows the old json file contents (jinglebells.fseq), as if the file was read from cache and not freshly from the website.


If I don't use repeat and manually "play" the playlist multiple times, it executes my PHP files fine and the sequence name in dynamic.json file reads fresh every time, too.  But when I use Repeat, it cannot execute PHP files on the second and higher passes and it does not freshly read dynamic.json from my website.

Thanks again for helping, Chris!
Tom

Offline tomhammond

  • Jr. Member
  • **
  • Join Date: May 2016
  • Location:
  • Posts: 54
  • Kudos: 0
Re: Cannot get Dynamic Playlists to work
« Reply #13 on: June 11, 2019, 07:26:56 AM »
Hi Chris,


Do you have time to fix the Repeat bug with Dynamic playlists?  I am giving a presentation at the Christmas Expo in July and part of it will cover this feature.


Thanks and please let me know,
Tom


Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: Cannot get Dynamic Playlists to work
« Reply #14 on: June 12, 2019, 07:07:14 AM »
I looked at the log file and it looks like every time your dynamic.json is called, it returns the same jingleBells.fseq/jingleBells.mp3 playlist entry.  Is that supposed to change every time the URL is hit or is one of the pre/postPlayActions.php scripts supposed to trigger dynamic.json to return different data?

Code: [Select]
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:129:PlaylistEntryDynamic::StartPlaying()
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:478:PlaylistEntryDynamic::Prep()
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:308:ReadFromURL: http://blahblah/blehbleh/dynamic.json
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:530:ProcessData( 0x7d9bfd, 1, 114)
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:534:m_response length: 114
2019-05-29 19:02:52 (1222) playlist/PlaylistEntryDynamic.cpp:344:ReadFromString(): String:
{
  "playlistEntries": [
    {
      "type": "both",
      "sequenceName": "jingleBells.fseq",
      "mediaName": "jingleBells.mp3"
    }
  ]
}

Then again later in the next loop:

2019-05-29 19:03:28 (1222) playlist/PlaylistEntryDynamic.cpp:308:ReadFromURL: http://blahblah/blehbleh/dynamic.json
2019-05-29 19:03:28 (1222) playlist/PlaylistEntryDynamic.cpp:530:ProcessData( 0x7d9bfd, 1, 114)
2019-05-29 19:03:28 (1222) playlist/PlaylistEntryDynamic.cpp:534:m_response length: 114
2019-05-29 19:03:28 (1222) playlist/PlaylistEntryDynamic.cpp:344:ReadFromString(): String:
{
  "playlistEntries": [
    {
      "type": "both",
      "sequenceName": "jingleBells.fseq",
      "mediaName": "jingleBells.mp3"
    }
  ]
}

 

Back to top