by danielfelix » Sun Aug 18 2019 23:15
by jcyr » Tue Aug 20 2019 17:35
marco79cgn wrote:As I already mentioned in the plugin thread, it's running for hours here without a problem (Pi Zero W with HiFi Berry DAC and the latest Volumio 2.522).
The RP API and the plugin basically work like this:
You get one flac file which contains up to 7 or 8 songs, so the result of the api is one flac url and the additional metadata for all the songs inside this one flac file (=name of each song, artist, length, etc.). Here's an example:
As you can already see looking at the url, this one flac file contains seven songs (1798613-1798619). Actually in this exact case there are six songs and a spoken part at the end with id 1798619. You can play this whole flac file manually e.g. using VLC or even on your Pi. Be aware that it won't work without the "?src=alexa" url parameter at the end though.
So all that my plugin does is extracting the metadata, start playing the flac file (=first song) and then it's setting a simple timer with the length of the first song in order to switch the song metadata when the second song starts - still inside this same one flac file. Then there will be a new timer with the length of the second song and so on... While a timer is running, the plugin does nothing but sleeping. Now as soon as the last song of the first flac file starts, the plugin asks the RP API for the next flac file (incl. its metadata). Then it will start from the beginning and so on.
What this means:
In the meantime the plugin is doing nothing but sleeping until the next song starts. After each sleep it's refreshing the song metadata in the ui with the already pre-cached songs but Volumio/MPD just keeps playing this same flac file (!). Think of this as two independent processes: on the one hand volumio that just plays one file all the time and while this is happening a completely independent task updates the metadata in the ui during this playback. There is absolutely no communication with Radio Paradise except of course for this flac stream that is currently running. So if your playback stops in the middle of a song then the only possible reasons are either:
Be aware that Volumio/MPD just streams the flac file, it is not downloaded completely beforehand so a stable internet connection is needed during the whole listening process. If the connection breaks, the stream will stop after a certain cache limit is reached (probably some seconds of playback).
- the connection to the stream is somehow lost/broken
- a bug in volumio/mpd
If you look inside the log files of volumio (ssh and then "sudo journalctl -f") you can see how many songs there are inside one api event. You can see an output like this one:
- Code: Select all
[RadioParadise] received new event with id 1798613 containing 6 songs.
- Code: Select all
[RadioParadise] set to consume mode, adding url: https://audio-3.radioparadise.com/blocks/chan/0/4/1798613-1798619.flac?src=alexa
For Volumio/MPD it looks like this is one single file/song/playlist item even though there are 6 songs inside!
I just submitted a pull request for a bugfix update but this update won't fix the situation you described if the stream is interrupted in the middle of a song. Because I don't have this problem and can't reproduce it.
by marco79cgn » Thu Aug 22 2019 13:17
by danielfelix » Mon May 11 2020 23:23