YTuner is a terrific program that can breathe new life into Internet radio receivers that were based on vtuner. It can be found at https://github.com/coffeegreg/YTuner. My huge thanks to its developer, coffeegreg.
I have a Denon X2300W AVR that I use to listen to Radio Swiss Jazz. It stopped working
when vtuner required a subscription, I paid up, but now it fails to work too often for my liking and I
felt the need for an alternative and independence. The two main substitutes for vtuner seem to me to be
YCast, and, the subject of this article,
YTuner.
I decided to try installing YTuner on Raspberry Pi, and it works very well for me.
I had two Raspberry PI's just lying around, a 4b, and a 3b, so I installed YTuner on both of them in desktop Raspberry Pi OS, and as headless versions. They all work with the Denon AVR. There are two small issues with the Denon X2300W AVR that I haven't had time to get deeper into, mostly because they don't bother me. First, the station logo disappears periodically; it can be refreshed by restarting the station from My Stations. Secondly, "favorites" is not working. I assume that Denon favorites is the same as bookmark. If I bookmark a station it is bookmarked but doesn't show in favorites. If I bookmark the same station it tells me that it is already bookmarked.
I have written down my recipe for the headless installation in the hope that it may help other folk with a similar issue, and so that I have a reference when I have forgotten how to do it (a couple of weeks from now).
So to begin:
Requirements are simple:
Note: The system will also run on a RPi with a desktop. Just follow the same instructions, or use the GUI to perform some of the operations if you prefer, for example, you could copy and paste from this page open in your browser to the terminal, or you could use your favorite GUI editor instead of nano. Bear in mind that some of the editing will have to be done at a privileged level (sudo equivalent).
Requirements 1 to 3 are handled by YTuner itself, the denon.vtuner.com forwarding is set up in YTuner's main configuration file, and the preferred stations are set up in the stations.ini configuration file.
Requirement 4: is set up by the Raspberry Pi hardware, if the Pi has an Ethernet port and you connect it to your network, it uses a cable connection. If you want to use WiFi you set it up in the OS image created by the Raspberry Pi Imager.
Requirement 5: YTuner is run as a service, once initialized during the installation it will run automatically each time the system is booted.
Requirements 6, 7, and 8: The system is managed from an external PC, or other terminal using SSL and a terminal emulator, PuTTY. A monitor, keyboard and mouse can be used, but they are only required if the system cannot be reached using SSL.
When the OS image is created in Raspberry Pi Imager, one of the options is to set up SSL. SSL provides the mechanism for logging in to the system using an external PC (or other terminal), and SSL terminal emulation software like PuTTY. See the developer's website at https://www.chiark.greenend.org.uk/~sgtatham/putty/
YTuner is installed under the /opt folder, it is owned and run by a ytuner user that is created for this one purpose. It is controlled by a service control file in /etc/systemd/system/
Initially YTuner is set up in the main user's home folders. It is configured
there by editing the necessary configuration files. Then the folder tree
containing YTuner is copied to /opt.
If anything goes wrong with the files in /opt the original files can be copied
from the home folders, and the system restarted. If any updates are made to
the YTuner files in /opt it would be wise to copy them to the master copy in
the home area once they have been fully tested.
The steps covered by the instructions include:
Boot the system using the prepared drive
Connect any required cables, and power up to boot the system.
If you have a monitor connected you will see the system boot a few times as
the OS is configured. Eventually you will see information about the OS, the
hostname that was entered in the imaging tool, the IP address, and a login
prompt.
At this point you can login to the system using PuTTY.
If you do not have a monitor connected, wait five minutes before trying PuTTY.
In PuTTY, enter hostname.local in the "Host Name" box in the configuration page, (where
hostname is the name entered in the imaging tool) and select SSH as the connection type.
Click Open - If the system is up and running you will get a login prompt, if not, try again later.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tree
This will take some time, and you will have to answer some prompts during the update.
Tip: To copy commands from this webpage into PuTTY, select the command with the mouse,
use Right-click-copy, or Ctrl-C, to copy the text, place the mouse cursor over the PuTTY
terminal window, and right click to drop the text into PuTTY.
sudo useradd ytuner
sudo passwd ytuner
(the system will ask for the new password and for confirmation)
wget -nv https://github.com/coffeegreg/YTuner/releases/download/1.2.6/ytuner-1.2.6-arm64-linux-rpi-3-5.zip
It will be placed in your current location /home/username
Note: The commands shown are for 64-bit Raspberry Pi versions. For other Raspberry Pi types choose the appropriate zip file and modify the commands accordingly. (Thanks Hans for your comments.)
unzip ytuner-1.2.6-arm64-linux-rpi-3-5.zip
Tip: type unzip yt, then press tab, the filename should be automatically expanded
Use the ls command to see the newly created folder name. The new folder has the same name as the zip file. To simplify the naming rename the new folder to ytuner. Use the mv command:
mv ytuner-1.2.6-arm64-linux-rpi-3-5 ytuner
Tip: as above, type mv yt, then press tab, the filename should be automatically expanded
Type the tree command in the terminal:
tree
It will show a tree of files and folders that should look like this:
cd ytuner/config
rm stations.yaml
rm avr.ini.example
Tip: nano is a text based editor, simple but not necessarily simple to use
for new users.
Move the cursor with up, down, right, and left arrow keys.
To make changes, enter and delete text at the cursor.
Save changes with ctrl-o, and enter at the prompt to confirm.
Exit with ctrl-x.
To exit and start again without saving changes use ctrl-x to exit and answer,
"N" at the prompt to save the buffer.
At the bottom of the nano editor page there is a summary of commands. Those
shown with the "^" sign, e.g. "^X" mean press control with the character key,
those showing "M-", e.g. "M-W" mean press Alt with the character key.
nano stations.ini
In the stations.ini file I replaced the contents with my preferred stations.
The first link on each line is the actual radio link, the second half is a link
to a logo:
[Jazz]
Radio Swiss Jazz mp3=http://stream.srg-ssr.ch/srgssr/rsj/mp3/128|http://www.radioswissjazz.ch/_nuxt/img/rsj-logo-claim-desktop.beb322c.png
Radio Swiss Jazz aac=http://stream.srg-ssr.ch/srgssr/rsj/aac/96|http://www.radioswissjazz.ch/_nuxt/img/rsj-logo-claim-desktop.beb322c.png
This gives me two streams at radioswissjazz, one mp3, the other aac.
Enter the genre and stations of your preference.
Similarly, edit avr.ini if you want to make changes. I left avr.ini unchanged.:
nano avr.ini
Now, edit ytuner.ini. First go to the ytuner folder. username is the user that you entered when making the image file.
cd /home/username/ytuner
nano ytuner.ini
In my configuration I have one Denon AVR, and my internal router/gateway address is 192.168.1.1.
The lines that I changed in the ytuner.ini file are:
Make sure that you are in the home folder, /home/username, (use pwd to check), and use the cp command to copy the ytuner file tree to /opt. -R means copy files recursively, that is, copy entire directories to new directories.
cd /home/username
sudo cp -R ytuner /opt
Use the tree command to see the current status of the new ytuner folder (the -ugp switches show group and user ownership, and permissions):
cd /opt
tree -ugp
sudo chown -R ytuner:ytuner /opt/ytuner
sudo chmod +x /opt/ytuner/ytuner
Type the tree command in the terminal, it will show a tree of files and folders that should look like this:
Files and folders are owned by ytuner, and the ytuner executable has x permissions.
The executable needs to be able to access/bind to port 80. This is privileged so ytuner has to be given permission. Use:
sudo setcap CAP_NET_BIND_SERVICE=+eip /opt/ytuner/ytuner
sudo nano /etc/systemd/system/ytuner.service
[Unit]
Description=YTuner Internet Radio Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=ytuner
Group=ytuner
ExecStart=/opt/ytuner/ytuner
[Install]
WantedBy=multi-user.target
To check that the file has been created correctly and contains the correct text, use the command cat on the new file:
cat /etc/systemd/system/ytuner.service
The contents of the file will be printed in the terminal.
Enable and start the ytuner service using systemctl commands. Commands that change the state of a service are privileged and require sudo.:
sudo systemctl enable ytuner.service
sudo systemctl start ytuner.service
Check the status of the service with:
systemctl status ytuner.service
The result should be something like:
Notes: The image above shows (amongst other things)
One of the main requirements for the system is that it starts up automatically at boot
time. To test this, restart the system, or shutdown, power off, and power on again to restart.
To restart:
sudo shutdown -r now
Alternatively, shutdown to a halt, then power off and power on the system.
sudo shutdown -h now
Wait until the system has restarted, this may take a few minutes. Check the status of the service, as in section J above, with:
systemctl status ytuner.service
The result should be something like the figure in section J.