Skip to content

Commit

Permalink
Update Texts
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Nov 6, 2023
1 parent 9016139 commit 8f76416
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 159 deletions.
131 changes: 68 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,107 +1,112 @@
# Radio-API

> Frontier-Silicon Internet Radio alternative API
> Silicon Frontier, Frontier Silicone, or Frontier Nuvola (Smart) Internet Radio alternative API
see https://github.com/kimbtech/WiFi-RadioAPI for informations about the Frontier-Silicon API
see https://github.com/kimbtech/WiFi-RadioAPI for information about the API used by the radios
see https://hub.docker.com/r/kimbtechnologies/radio_api for the Docker Image

## About
This is an alternative API for Frontier Nuvola (Frontier Silicone) internet radios, it can be placed on a server and will host the list of internet radio stations, podcasts etc. which then can be found in the radio's menu.

This is an alternative API for Frontier-Silicon internet Radios, it can be placed on a server
and will host the list of internet radio stations, podcasts etc. which then can be found in the
radios menu.
The main idea is to redirect the HTTP request of the radio to another server, where own stations and podcasts can be added.
This redirect is possible by manipulating the DNS queries.

The main idea is to redirect the http request of the radio to another server, where own stations and podcasts
can be added. This redirect is possible by manipulating the DNS queries.
> This *Radio-API* does not come with a predefined list of stations.
> Instead is allows each user to define their own list of radio stations, podcasts and audio streams from Nextcloud shares.
## Usage
- After setting up the Docker Image and changing the DNS resolver, start the radio and open `Internet Radio`.
- There should be a list providing:
- First [set up](#setup) the Docker Container of this *Radio-API* and change the DNS resolver of the radio (e.g. as described in set up, too).
- Afterwards start the radio and open "Internet Radio".
- The *Radio-API* should provide a list of:
- **Radio**
- This is a list of internet radio stations.
- The list of stations can be changed using the GUI.
- A radio station should be URL to some stream like MP3, M3U etc.
- The list of stations can be changed in the GUI.
- A radio station should be an URL to some stream like MP3, M3U etc.
- **Podcasts**
- This is a list of podcasts.
- The list of podcasts can be changed using the GUI.
- The list of episodes for each podcast is cached for `CONF_CACHE_EXPIRE` seconds.
- The URL of a podcast can be an Atom RSS link or a link to a NextCloud fileshare.
- NextCloud fileshare:
- The system can fetch and stream audiofiles from nextcloud fileshares.
- The URL of a podcast can be an Atom RSS link or a link to a Nextcloud share.
- Nextcloud share:
- The system can fetch and stream audiofiles from Nextcloud shares.
- The link of the share needs a to look like `<mycloud.expample.com>/s/<token>/`.
- All files in the shared folder will be show in the radio as epoisode.
- It is only possible to share a folder filled with files.
- All files in the shared folder will be shown in the radio as episode.
- The share must not have a password.
- There is no support for subfolders in shares.
- There is no support for sub folders in shares, only the files in the share are shown.
- Episodes get a `*` in front of their name if they have not yet been listened to.
- **Stream**
- This is a list of custom streams.
- The list is fetched from a custom url, provided in the Docker Image setup.
- The list is fetched from a custom url, provided in the Docker Container setup.
- The list is cached for `CONF_CACHE_EXPIRE` seconds.
- The radio streams each item like a radio station.
- The Streams are all the same on one system.

## Notice
- This is a private project and has no connections to Frontier-Silicon.
- There is a limit of 1000 items per list; 1000 Radio stations, 1000 Streams, 1000 Podcasts.
- The GUI at `radio.example.com/gui/` provides a preview of the radios menu.
- Nobody should host a pubic DNS resolver resolving wrong IPs, some type of access control is useful.
- The radio streams each item as a radio station.
- The Streams are shared across all radios using the same *Radio-API* setup.
- **GUI-Code**
- This code is like a password to access the GUI for this radio and edit the radio stations and streams.
- Gui:
- The gui can be opened via a webbrowser at `radio.expample.com/gui/`.
- The gui provides the editable lists of radio stations and podcasts.
- A preview of the items shown by the radio is provided by the gui, too.
- The preview is also shown when opening `radio.example.com` in an browser and this browser has already logged into the GUI.
- The `*` to mark new episodes can be toggled by the &check;/ &cross; in the preview.
- Additional information texts describe the options chooseable for radio stations and podcasts.

### Notes
- This is a private project and has no connections to Frontier Nuvola/ Frontier Silicone.
- There is a limit of 1000 items per list: 1000 radio stations, 1000 streams, 1000 podcasts.
- Nobody should host a pubic DNS resolver resolving wrong IPs. Some type of access control is recommended.

## Setup

The entire API is bundled in a [Docker Image](https://hub.docker.com/r/kimbtechnologies/radio_api).

1. Redirect the HTTP request of the radio to your server.
1. Redirect the HTTP request of the radio to your server (the *Radio-API*).
- This is done by altering the DNS queries.
- There is a [Docker Container](https://hub.docker.com/r/kimbtechnologies/radio_dns)
which provides a DNS Server altering all requests to `*.wifiradiofrontier.com`.
- There is a [Docker Image](https://hub.docker.com/r/kimbtechnologies/radio_dns) which provides a DNS server altering all requests to `*.wifiradiofrontier.com`.
- It has a feature to define an `ALLOWED_DOMAIN`, only requests from the corresponding IP address will be answered.
- Use a DynDNS hostname as your `ALLOWED_DOMAIN`.
- If hosted in the local network `ALLOWED_DOMAIN` can be `all`.
- *Not everybody has to setup a own DNS resolver, some routers provide such features.
The radio just has to send its http request to the server where this repositories
Docker Image is running.*
The radio just has to send its HTTP request to the server where *Radio-API* (this repositories Docker Container) is running.*
- **Change the DNS server in the configuration of your radio to the IP of your DNS resolver.**
2. Run the Docker Image.
(This may be done via the web interface of the radio, accessible at the local IP address of the radio.)
2. Run the Docker Container of *Radio-API*.
- See [docker-compose.yml](https://github.com/KIMB-technologies/Radio-API/blob/master/docker-compose.yml)
for Docker configuration and [nginx.conf](#nginx-load-balancer) for reverse proxy setup.
for Docker configuration and [below](#nginx-load-balancer) for reverse proxy setup.
- It is recommended to save the folder `/php-code/data/` als volume, because all stations and podcasts
are stored there.
- Configure the image
- `CONF_DOMAIN` The domain where the system is hosted (will be reached via HTTP).
- `CONF_ALLOWED_DOMAIN` Like `ALLOWED_DOMAIN` in the DNS Image, only requests from the corresponding
IP address will be answered. Use DynDNS. You may give a list of multiple allowed
hostnames, divided by `,`. *The API would be public useable, if `CONF_ALLOWED_DOMAIN`
is set to `all`. If hosted in a local network using `all` is recommended.*
- `CONF_CACHE_EXPIRE` Time in seconds for cache of ips, podcasts to expire.
- `CONF_REDIS_HOST` The API needs Redis to cache station lists, give the redis hostname here.
- *`CONF_REDIS_PORT` (optional)* Change the redis port to a none default one.
- *`CONF_REDIS_PASS`(optional)* Activate Redis Authentication by giving password.
- `CONF_OWN_STREAM` Fetch a list of own streams `true/ false`.
- `CONF_OWN_STREAM_JSON` URL where the list of own stream can be fetched.
JSON like `{ "key" : { name : "Test 1" }, ... }`
- `CONF_OWN_STREAM_URL` URL where each audiofile can be accessed, the `key` will be appended
- `CONF_PROXY_OWN_STREAM` Use the builtin HTTP proxy for own streams `true/ false`.
- `CONF_SETUPAPP_IDENT` Sets the setupapp ident string (seems to vary per manufacturer. Example: When the setupapp URI is `/setupapp/hama/asp/BrowseXML/loginXML.asp` you have to set `hama` here).
- There are to ways to store, which episodes of a podcasts were already played (new ones are marked by `*`)
- Use the Redis-Data-Volume (Redis will load its dump files on container startup)
- Create a CronJob to `/cron.php` (this will dump the already played episodes to a JSON-File and load the file on container startup)
- `CONF_DOMAIN` The domain where the system is hosted (will be reached via HTTP).
- `CONF_ALLOWED_DOMAIN` Like `ALLOWED_DOMAIN` in the DNS image, only requests from the corresponding IP address will be answered.
Use, e.g., the dynamic DNS host name of you local home router.
You may give a list of multiple allowed host names, divided by `,`.
*The API would be public useable, if `CONF_ALLOWED_DOMAIN` is set to `all`.*
*If hosted in a local network using `all` is recommended.*
- `CONF_OWN_STREAM` Fetch a list of own streams `true/ false`.
- `CONF_OWN_STREAM_JSON` URL where the list of own stream can be fetched.
Should return JSON like `{ "key1" : { name : "Test 1" }, "key2" : { name : "Test 2" }, ... }`.
- `CONF_OWN_STREAM_URL` URL where each audio file can be accessed, the `key` will be appended, i.e, `CONF_OWN_STREAM_URL+"key1"` for `Test 1`.
- `CONF_PROXY_OWN_STREAM` Use the builtin HTTP proxy for own streams `true/ false`.
- There are two ways to store which episodes of podcasts have already been listened to (new ones are marked by `*`)
- Use the data volume of Redis. (Redis will (re-)load its dump files on container startup.)
- Create a cron job to `/cron.php` (this will dump the already played episodes to a JSON file and *Radio-API* will load the file on container startup.)
4. Done
- Start the radio and open `Internet Radio`
- There should be a list with three points `Radio, Podcasts, (Streams)` and a GUI-Code.
- The GUI to define the list of stations and podcasts can be found at `CONF_DOMAIN/gui`.
- You will need the Code shown in the menu to log into the gui.
- Each connected radio has is own list of radio stations and podcasts, the own streams are global.

- There should be a list with three items `Radio, Podcasts, (Streams)` and a GUI-Code.
- Use the gui to define the list of stations and podcasts. It can be accessed with a browser at `CONF_DOMAIN/gui`.
- You will need the Code shown by the radio to log into the gui.
- Each connected radio has is own list of radio stations and podcasts, the *own streams* are global.

> The API can be placed outside of the local network as well as inside.
### Non AMD64 hosts
Currently the [Docker Image](https://hub.docker.com/r/kimbtechnologies/radio_api) of *Radio-API* is only build for `linux/amd64`.
There is an open issue to build multi platform images [#13](https://github.com/KIMB-technologies/Radio-API/issues/13), e.g., for Raspberry Pis.

### Nginx Load Balancer
In the mean time, one might build the image on its own, e.g., see issue [#10](https://github.com/KIMB-technologies/Radio-API/issues/10#issuecomment-1792708498) and comments.

An example file to use the image with an nginx load balancer.
### Nginx Load Balancer
An example file to use *Radio-API* behind a nginx load balancer as reverse proxy.

```nginx
server {
server_name radio.example.com .wifiradiofrontier.com;
Expand All @@ -111,8 +116,8 @@ server {
return 301 https://radio.example.com$request_uri;
}
proxy_pass http://127.0.0.1:8080/;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8080/; # the port of the running Docker Container with *Radio-API*
proxy_set_header X-Real-IP $remote_addr; # needed to detect allowed domains
proxy_http_version 1.1;
proxy_read_timeout 3m;
proxy_send_timeout 3m;
Expand All @@ -128,4 +133,4 @@ server {
# more ssl setup ....
}
```
```
59 changes: 23 additions & 36 deletions php/classes/templates/list_de.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,22 @@ <h3>Radiosender</h3>
</form>

<div class="note">
Der Name eines Radiosenders wird in der GUI des Radios angezeigt,
als URL wird ein streamfähiger Link benötigt (MP3 etc.).
Der Name eines Radiosenders wird im Display des Radios angezeigt, als URL wird ein streamfähiger Link benötigt (MP3, M3U, etc.).
Der Link muss ohne SSL (also <code>http://</code>) erreichbar sein!
<br />
Mit dem Proxy können Links, die nur per SSL erreichbar sind,
hinzugefügt werden. Achtung, der Proxy kann keine M3U Dateien
streamen!
Mit dem Proxy können Links, die nur per SSL erreichbar sind, hinzugefügt werden.
Achtung, der Proxy kann keine M3U Dateien streamen!
<br />
Bei Nextcloud Streams werden alle Musikdateien in einem freigegebenen
Ordner nacheinander vom Radio abgespielt. Anders als bei Podcasts werden alle
Dateien nacheinander Ordner abgespielt und sind nicht einzeln wählbar.
(Die Nextcloud Freigabe muss die Form <code>&lt;url&gt;/s/&lt;token&gt;</code>
haben.) Sollte Nextcloud nur per SSL erreichbar sein, muss der Proxy genutzt werden!
Ist die zufällige Reihenfolge im System aktiviert, so werden die Dateien im Ordner in einer
zufälligen Reihenfolge abgespielt.
Bei Nextcloud Streams werden alle Musikdateien in einem freigegebenen Ordner vom Radio abgespielt.
Anders als bei Podcasts werden alle Dateien im Ordner nacheinander abgespielt und sind nicht einzeln wählbar.
(Die Nextcloud Freigabe muss die Form <code>&lt;url&gt;/s/&lt;token&gt;</code> und kein Passwort haben.)
Sollte die Nextcloud nur per SSL erreichbar sein, muss der Proxy genutzt werden!
Ist die zufällige Reihenfolge im System (Radio-API Installation) aktiviert, so werden die Dateien im Ordner in einer zufälligen Reihenfolge abgespielt.
<br/>
Über Logo kann eine URL zu einem den Sender illustrieredenen
Bild angegeben werden. Wird kein Bild angegeben, so wird
<a href="%%SERVERURL%%media/default.png" target="_blank">
<code>%%DOMAIN%%media/default.png</code></a>
im Radio angezeigt.
Über Logo kann eine URL zu einem den Sender illustrieredenen Bild angegeben werden.
Wird kein Bild angegeben, so wird <a href="%%SERVERURL%%media/default.png" target="_blank"><code>%%DOMAIN%%media/default.png</code></a> im Radio angezeigt.
<br />
Die Beschreibung ist optional und
eine weitere Beschreibung des Senders.
Die Beschreibung ist optional und eine weitere Beschreibung des Senders.
</div>

<h3>Podcasts</h3>
Expand All @@ -49,20 +41,16 @@ <h3>Podcasts</h3>
</form>

<div class="note">
Der Name eines Podcasts wird in der GUI des Radios angezeigt,
als URL kann entweder ein RSS Atom Feed angegeben werden oder
der Link zu einer Nextcloud Freigabe (Die Nextcloud Freigabe muss
die Form <code>&lt;url&gt;/s/&lt;token&gt;</code> haben.)<br/>
Sollte die Nextcloud oder die Audiofiles der
der Episoden nur per SSL erreichbar sein, so muss
der Proxy aktiviert werden! Der Proxy nutzt automatisch EndURL.
Der Name eines Podcasts wird in im Display des Radios angezeigt, als URL kann entweder ein RSS-Atom-Feed angegeben werden oder der Link zu einer Nextcloud Freigabe.
Anders als bei Radiosendern werden alle Dateien im Ordner als Episoden angezeigt und sind einzeln abspielbar.
(Die Nextcloud Freigabe muss die Form <code>&lt;url&gt;/s/&lt;token&gt;</code> und kein Passwort haben.)
<br/>
Sollte die Nextcloud oder die Audiodateien der Episoden nur per SSL erreichbar sein, so muss der Proxy aktiviert werden!
Der Proxy nutzt automatisch EndURL.
<br />
Einige Anbieter wie Soundcloud leiten in den Links zu den
Episoden auf SSL um, die eigentliche URL zur Audiodatei ist jedoch
auch ohne SSL erreichbar. Mit EndURL wird der direkte Link zur
Audiodatei an das Radio geschickt.
EndURL ist dem Proxy vorzuziehen, da es den Server weniger belastet und
schneller ist.
Einige Anbieter, z.B. podigee oder Soundcloud, leiten in den Links zu den Episoden auf SSL um, die eigentliche URL zur Audiodatei ist jedoch auch ohne SSL erreichbar.
Mit EndURL wird der direkte Link zur Audiodatei an das Radio geschickt.
EndURL ist dem Proxy vorzuziehen, da es den Server weniger belastet und schneller ist.
</div>

<script>
Expand All @@ -81,9 +69,8 @@ <h2>Vorschau</h2>
</div>

<div class="achtung">
Achtung, die Vorschau dient in erster Linie dazu die Liste der Radios, Podcast, Episoden
und Streams anzuschauen. Das Abspielen von einigen Audioformaten klappt in
Browsern nicht, dafür aber auf dem Radio. Weiterhin kann das Radio kein SSL
ein Browser jedoch schon.
Achtung, die Vorschau dient in erster Linie dazu die Liste der Radios, Podcast, Episoden und Streams anzuschauen.
Das Abspielen von einigen Audioformaten klappt in Browsern nicht, dafür aber auf dem Radio.
Weiterhin kann das Radio kein SSL ein Browser jedoch schon.
</div>
<script> var serverurl = "%%SERVERURL%%", radiomac = "%%RADIO_MAC%%";</script>
Loading

0 comments on commit 8f76416

Please sign in to comment.