RadioParadise plugin Flac, works only for a while.

Hi Daniel,
I was already working on a download-solution in order to fix the dropout issues (which I still don’t have personally by the way but obviously some others). The problem is that I didn’t get the metadata in sync while playing audio so I stopped this approach.

Did you see what Bill wrote the other day?

Hello Marco, since last night I am trying it, it seems to work well, at night I can have a preliminary conclusion.
What is soothing is that the problem exists and it is not in our hands to remedy it.
I think you should stop all the probable developments, you have to wait for Bill.
An option to obtain the metadata would be for RP to implement something similar to what it is using now, that with each topic upload a file with the metadata, hence you already know how to read them. Does it seem to suggest this to Bill?
Regarding downloading the pack and then playing it, in my little program what I do is read the time of each one and present the data during that time. It is very rudimentary, but generally works well.
regard

Yes, the Radio Paradise official forum is full of reports regarding problems with the flac stream (both the former dynamic one and the newly created static stream). Even the normal 320 kbps AAC streams have had outages the last days.

I listened for a few hours yesterday and for the first time I had problems with it - after some time, the stream had lots of continous hiccups during playback. It was not completely interrupted but of course it’s not possible to enjoy listening anymore. Restarting the stream solved the issue for a while.

Maybe they finally manage to fix these problems. Otherwise the only stable solution would be to pre-download the files and play them locally. This would require a lot of refactoring for the plugin, basically a restart from scratch.

Here with the static stream is cut when the server goes down, there are no cuts while it is up. And it’s usually down for hours. I guess it’s in the testing phase.
I pass the python code that I used to download the blocks. DO NOT LAUGH.
https://pastebin.com/tuaCq1b2

Bill changed the static stream URL again, the old one soon won’t work anymore.

icy-8.radioparadise.com/flac

The code doesn’t look so bad, no worries.

I’m currently working on a bigger change. What already works is downloading the first flac file, local playback of the downloaded file and showing the correct metadata of all songs. The problem is that the first download might take lots of time. A single file may contain up to 8 songs and downloading it requires up to a minute or even more depending on the internet connection and also on the server side of Radio Paradise which obviously isn’t the fastest at the moment. During that time there is silence and it seems that the GUI is stuck (which it isn’t). So I need a workaround for that time. Maybe starting to play the Jeopardy main theme during the download. :smiley:

I noticed that in the morning hours it is slower, then in the day the download normalizes.
In the mellow channel, there is no (never) 4 songs, the Main does, up to 8.
Maybe you can start the download of the next block first, while still playing the current block. In this case we would only have to wait for the first time.
Now, if Bill changes the system, I do not know if it’s worth the effort.
Here we do not see Jeopardy …

Sure, that’s how I implemented it. The question is just what to do/play when the stream is started the first time.

Maybe something from the previous block …

:arrow_right: Here is a first version of the Radio Paradise Volumio Plugin that downloads the songs before playback. This should avoid interruptions or cuts during a song while listening! Please be aware that this is an early version of the plugin that might have issues. Don’t use this version if you don’t want to have the download feature.

Installation Instructions:
If you want to give it a try, please install it manually. Before doing so, please open the Volumio UI in your web browser, navigate to Settings > Plugins > Installed Plugins and both deactivate and uninstall Radio Paradise. Afterwards open a command shell (e.g. Terminal in macOS), ssh into your volumio machine and execute the following commands (one by one):

  • wget https://www.dropbox.com/s/0saehm5ewtm0r2f/radio-paradise-downloader.zip?dl=1 -O radio-paradise-downloader.zip
  • mkdir ./radio-paradise-downloader
  • miniunzip radio-paradise-downloader.zip -d ./radio-paradise-downloader
  • rm radio-paradise-downloader.zip
  • cd ./radio-paradise-downloader
  • rm -Rf /data/plugins/music_service/radio_paradise
  • volumio plugin install
  • cd ..
  • rm -Rf radio-paradise-downloader

In the browser, navigate to Settings > Plugins > Installed Plugins and activate Radio Paradise. Now you can start the plugin and choose one of the FLAC streams.

How it works:
When starting a flac stream for the first time, the plugin will always play “Everybody wants to rule the world” by Tears for Fears as the first song. It comes bundled with the plugin. This is to avoid silence at the beginning because the download of the first real event might take quite some time depending on the speed of the radio paradise servers and the amount of songs inside this event (up to 8). The next songs will always be download in the background and should start automatically. All flac files are downloaded to the folder /home/volumio/rp-flac. The plugin makes sure that only the two most recent flac files will be kept (current and next one) while older files will be deleted automatically in the background to avoid running out of disk space over time.

Issues:
The download of the next event starts as soon as the last song of the previous event has started playing. Depending on the length of the last song, the size of the next event and last not least the speed of the Radio Paradise servers, this timeframe might not be long enough. If this happens, the playback would start before the new file has been completely downloaded and the result would be silence when the event starts playing. Please report if this happens (and how often).

Changes:
I removed the Rock and Groovy Mixes because they are not working at the moment and always would play the same few songs (according to Bill from Radio Paradise). :exclamation: I included the brand new static flac stream as a third option. It behaves like a classic web radio but unfortunately there is no metadata. Maybe it’s worth to give it a try anyway.

Wonderful!! it works perfectly.
I’m still trying.
Thanks again! you are a genious! and very patient …

Maybe a shorter song at the beginning?
Maybe silence and a message in the place of the cover: … downloading block …
Even this message can go between the blocks if it is necessary to wait.

Hello Marco, here is a bug.
I see 3 * .flac in the folder /home/volumio/rp-flac
It is being played in this case on 202615-20218, it ends and the next one does not start.
I look and the playlist is loaded but it does not play.
The metadata is synchronized as the playback started, but it did not start.
I make “mpc play” and start playing. The metadata is desynchronized of course.
Goes Putty capture.flacrp.JPG

And this is exactly the problem I described. There was not enough time to download the next flac file when the last song of the previous started, in your case id 20218. The logs would help a lot but basically this is the only reason why it might fail.

The download speed of the Radio Paradise servers varies extremely. Sometimes it loads with up to 4 MB/sec, sometimes it doesn’t get faster than 200 KB/sec. From what I’ve seen it seems to run smooth late at night and in the morning and not it gets slow in the afternoon and evening.

I have to think about a way to get more time. I could start the download of the next file as soon as the first song of a file starts (not the last one). Give me some time…

:arrow_right: Update: 22.05.2019 23:16 (CEST)

I updated the plugin again. The first song is now “Universal Traveler” by Air. It will only be played as long as the download of the first flac file takes. After the download finished, the playback will automatically switch. This is the best tradeoff I could think of.

The download of the following flac file now already starts as soon as the first song of the previous flac file starts playing. This way there should be more than enough time for the download even if the server is slow.

Please install the plugin from scratch again exactly like described here.
The first wget command will automatically download the updated plugin version (since it’s Dropbox and its versioning system!). The file size has been reduzed to 26,2 MB.

Testing, everything seems to be fine.
Question: how do you know which is the link to the next block flac?

I described how the API works on my github page.

In short:
You call the API for the first time with the base url

https://api.radioparadise.com/api/get_block?bitrate=4&chan=0&info=true

and it returns a json result containing all information about the first flac file to play.

{ "event": "1682118", "end_event": "1682123", "length": "1027.719", "url": "https://apps.radioparadise.com/blocks/chan/0/4/1682118-1682123.flac", "expiration": 1523016067, ...
It also includes an „end_event“ id (1682123 in this example) and you need exactly this id to query the API for the next block to play. See the last url parameter at the end (&event=1682123):

https://api.radioparadise.com/api/get_block?bitrate=4&chan=0&info=true&event=1682123

This call returns all information about the following block and again an „end_event“ id for the one after that. It‘s basically a loop.

Aaaaaah, that I did not know! In fact, with my program I entered the API, but I could never understand the “event”. I had read it in Bill’s original email but I did not understand it.
Thank you! You always learn something.
Last night it worked for two hours without problems.

Yes, I’ve been listening for hours now without problems. Basically the only problem that could happen now is exactly at the beginning, if the first Flac file can’t be downloaded within 4 minutes (which is the length of the Air song that comes pre-bundled). If it get’s past this point, there should not be a problem anymore because now there is plenty of time to pre-download the following file.

I think about integrating the download feature as an option in the plugin settings so that the user can choose whether she/he wants to pre-download the files or not.

If you notice anything strange, keep me informed.

The download time in my case is between 30 sec. and a minute and a half. It is not annoying at all.
Regarding the possible modifications of the type to choose which method to use, it seems to me that you must wait for Bill to define what he is going to do.
The direct download link works very well, if you simultaneously add a file with the metadata, it would be fully functional. (It’s rare that metadata can not be added to flac.)
It may be convenient to do the installer for the plugin, I suppose there are users who do not know how to do it by hand. In this way there will be more users testing.

Over time there is a desynchronization of metadata, it does not affect reproduction.
I thought that changing the block would “reset” but not, it remains out of sync.
I keep trying …