FalconChristmas / fpp-PixelRadio

FPP Plugin to provide RDS events to PixelRadio transmitter
2 stars 2 forks source link

Possible Issue with Remote Falcon Trigger and Playlist Idle Behavior #2

Open kylegrymonprez opened 10 months ago

kylegrymonprez commented 10 months ago

I have Remote Falcon setup as well (https://github.com/whitesoup12/remote-falcon-plugin). When Remote Falcon is triggered to play a requested song, Pixel Radio disables the RF Carrier (I believe per the setting Playlist Idle Behavior). Additionally, when the Remote Falcon requested song is finished, and the 'normal' playlist resumes, it doesn't seem to turn the PixelRadio back on.

I'm willing to dive into the code for the plugin as needed, but would like some guidance on where to dig into unless it's a quick fix you know about.

Thanks!

kylegrymonprez commented 10 months ago

My guess is that is has something to do with the way the plugin handles playlist start/stop actions triggered by RemoteFalcon https://github.com/FalconChristmas/fpp-PixelRadio/blob/master/src/FPPPixelRadio.cpp#L282-L285

Checking to see what RemoteFalcon triggers

kylegrymonprez commented 10 months ago

from what I can tell: https://github.com/whitesoup12/remote-falcon-plugin/blob/e7dca92f4aff416bafdfa54f8c3b9b6ba10efa18/remote_falcon_listener.php#L299 "/Insert%20Playlist%20Immediate/"

The recommendation is that the RemoteFalcon (RF) Playlist is a seperate playlist than the main show - perhaps when the main show playlist is interrupted, resume isn't handled correctly.

kylegrymonprez commented 10 months ago

Logs seem to support that:

##### Stopping RF triggered sequence
2023-11-27 10:59:00.131 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryBase.cpp:158: PlaylistEntryBase::Stop()
2023-11-27 10:59:00.131 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryBase.cpp:104: PlaylistEntryBase::FinishPlay()
2023-11-27 10:59:00.131 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryBase.cpp:158: PlaylistEntryBase::Stop()
2023-11-27 10:59:00.131 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryBase.cpp:104: PlaylistEntryBase::FinishPlay()
2023-11-27 10:59:00.131 (31447) [Plugin] src/FPPPixelRadio.cpp:240: Setting RDS Station text to "Lights At Ardmore - Happy Holidays"
2023-11-27 10:59:00.132 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 1 text to ""
2023-11-27 10:59:00.132 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 2 text to "Please be courteous to our neighbors"
2023-11-27 10:59:00.132 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 3 text to ""

#### Resuming 'main' playlist
2023-11-27 10:59:00.132 (31447) [Playlist] /opt/fpp/src/playlist/Playlist.cpp:651: Playlist::Resume called on /home/fpp/media/playlists/Christmas 2023.json
2023-11-27 10:59:00.132 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryMedia.cpp:100: PlaylistEntryMedia::PreparePlay()

#### Line is disabling carrier feed - so radio transmission is disabled
2023-11-27 10:59:00.132 (31442) [General] /opt/fpp/src/common.cpp:1056: Calling GET http://10.25.50.53:8080/cmd?rfc=off
2023-11-27 10:59:00.132 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryMedia.cpp:309: PlaylistEntryMedia::OpenMediaOutput() - Starting
2023-11-27 10:59:00.132 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryMedia.cpp:329: PlaylistEntryMedia - Starting 02 - Light Of Christmas [feat. Owl City].mp3
2023-11-27 10:59:00.132 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:64: ParseMedia(02 - Light Of Christmas [feat. Owl City].mp3)
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:124:   Title        : Light Of Christmas [feat. Owl City]
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:125:   Artist       : TobyMac & Owl City
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:126:   Album        : Light Of Christmas
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:127:   Year         : 2017
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:128:   Comment      : Amazon.com Song ID: 290192785
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:129:   Track        : 2
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:130:   Genre        : Children's Music
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:131:   Properties:
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:132:     Length     : 223
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:133:     Seconds    : 43
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:134:     Minutes    : 3
2023-11-27 10:59:00.134 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:135:     Bitrate    : 256
2023-11-27 10:59:00.135 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:136:     Sample Rate: 44100
2023-11-27 10:59:00.135 (31447) [MediaOut] /opt/fpp/src/mediadetails.cpp:137:     Channels   : 2
2023-11-27 10:59:00.135 (31447) [Plugin] src/FPPPixelRadio.cpp:240: Setting RDS Station text to "Lights At Ardmore - Happy Holidays"
2023-11-27 10:59:00.135 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 1 text to "TobyMac & Owl City - Light Of Christmas [feat. Owl City]"
2023-11-27 10:59:00.135 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 2 text to "Please be courteous to our neighbors"
2023-11-27 10:59:00.135 (31447) [Plugin] src/FPPPixelRadio.cpp:264: Setting RDS 3 text to ""
2023-11-27 10:59:00.135 (31447) [MediaOut] /opt/fpp/src/mediaoutput/MediaOutputBase.cpp:26: MediaOutputBase::MediaOutputBase()
2023-11-27 10:59:00.135 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:930: SDLOutput::SDLOutput(02 - Light Of Christmas [feat. Owl City].mp3)
2023-11-27 10:59:00.136 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:763: Using output device: 
2023-11-27 10:59:00.144 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:779: Opened Audio Device -  Rates:  44100 -> 44100     AudioFormat:  8010 -> 8010    Channels: 2 -> 2
2023-11-27 10:59:00.164 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:909: Verbose: "02 - Light Of Christmas [feat. Owl City].mp3" - [mp3 @ 0xa1b817f0] Skipping 0 bytes of junk at 44804.
2023-11-27 10:59:00.174 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:915: Verbose: "02 - Light Of Christmas [feat. Owl City].mp3" - [mp3float @ 0xa74fa820] Could not update timestamps for skipped samples.
2023-11-27 10:59:00.203 (31447) [Playlist] /opt/fpp/src/playlist/PlaylistEntryMedia.cpp:356: PlaylistEntryMedia::OpenMediaOutput() - Complete
2023-11-27 10:59:00.204 (31447) [Sync] /opt/fpp/src/MultiSync.cpp:1416: SendMediaOpenPacket('02 - Light Of Christmas [feat. Owl City].mp3')
2023-11-27 10:59:00.204 (31447) [Sync] /opt/fpp/src/MultiSync.cpp:1452: SendMediaSyncStartPacket('02 - Light Of Christmas [feat. Owl City].mp3')
2023-11-27 10:59:00.204 (31447) [MediaOut] /opt/fpp/src/mediaoutput/SDLOut.cpp:1092: SDLOutput::Start() 19FD618
2023-11-27 10:59:00.214 (31442) [General] /opt/fpp/src/common.cpp:1066: GET http://10.25.50.53:8080/cmd?rfc=off resp: <!DOCTYPE HTML>

Going to check the resume command to see if a case isn't handled correctly

kylegrymonprez commented 10 months ago

https://github.com/FalconChristmas/fpp/blob/d5c86f5e2adaecc4b8dac71b45685e02d222f9f8/src/playlist/Playlist.cpp#L662 seems like Playlist::Resume doesn't send an event to key off of. My guess is that: 1) RF triggered playlist item gets 'stop'ed 2) Main playlist gets resumed 3) PixelRadio gets and processes the 'stop' event 4) Radio is disabled and never enabled again because "Playlist::Resume" doesn't send an event to key off of.

Likely, we need FPP to send something like a 'resume' event for the playlist for PixelRadio to key off of, but in the meantime, wondering if we can key off the mediaCallback as well and check if the radio isn't on and do a 'hack' that way.......

Thoughts?

kylegrymonprez commented 10 months ago

For now - I just setup the "Platlist Idle Behavior" to "Leave Alone", and then added a command to enable the radio in the lead in of the playlist, and a disable the radio in the "lead out" of the playlist. This handles correct behavior in the show.

I think the real fix is to have a better hook to not send a 'disable' when switching playlists occurs due to the 'stop' of the second playlist.

kylegrymonprez commented 10 months ago

Cross posted a maybe related solution: https://github.com/FalconChristmas/fpp/issues/1723

But if I can clarify any use cases - please let me know!