PyRadio on Windows

PyRadio: Command line internet radio player.

Ben Dowling - https://github.com/coderholic

Table of Contents Top

[Back to Build Instructions] | [Back to README]

Running PyRadio on Windows Top

What? A linux console application on Windows?

Yes, sure. Why not?

PyRadio is a python script after all, and python does run on Windows. So, with a little bit of tweaking of the code, it is possible.

This page will guide you through the process of installing, updating and running PyRadio on Windows.

How it all works Top

First of all, let me tell you that if you are still running Windows XP, you can just stop reading right now; it won’t happen…

PyRadio on Linux (its main target platform) can use any of three players MPV, MPlayer and VLC; and this is also the case on Windows!

MPV is the preferred player for Windows. Its installation takes a few extra steps, but once installed, it’s super reliable due to its using “Named Pipes” (in a client-server paradigm) for its communication with the client application (in this case PyRadio.)

Installing MPlayer also takes a couple of extra steps, and you may find that some streams (e.g. m3u8) may not be playable. Furthermore, special care has to be taken in order to be able to save the volume of the player.

VLC is much easier to install, but song titles’ updating may not be 100% consistent (if any). If this is not a deal breaker for you, then just go on and use VLC as PyRadio’s player.

Other than that, you will have a fully functional PyRadio installation.

Having said that, let us proceed with the installation.

Installation Top

The installation consists of three steps:

  1. Python installation
  2. Player installation
  3. PyRadio installation

Python installation Top

Installing Python

If you don’t already have Python installed, just get to its Windows Downloads page and download one of the 3.x releases.

A tip as to which Python version to choose is to go to zephyrproject-rtos /windows-curses github page and check the latest supported version.

Here’s how you do that: the page contains some folders named pyXY (XY is the python version the folder corresponds to). Make a note of the largest XY number; this is the latest Python version supported, and this is the one you should download. At the time of writing this, version 3.9 was the latest supported one (folder py39), even though Python 3.10 had already been released.

When the download is done, run its setup and select “Custom Installation” so that you can “Add Python to environment variables”. You can refer to the following image to see the relevant setting.

Python Installation

Verifying the installation

Either if you have just installed Python or you already have it installed, you need to verify that its executable is in the PATH (i.e. Python can be executed from a console by typing”python”).

So, go ahead and open a console (the command is cmd) and type python.

If you get something similar to the following snippet, you are good to go.

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win
Type "help", "copyright", "credits" or "license" for more information.
>>>

If the command could not be found, you have to run the installation again, select “Modify” and set the “Add Python to environment variables” option. You can refer to the following image to see the relevant setting.

Python Installation Modification

Note: If you don’t have the setup file of the original Python installation, you will have to download it from Python’s Windows Downloads. In case you want to upgrade to the latest version, you must uninstall the one currently installed, beforehand.

Player installation Top

It’s time to decide which player you want to use, either MPlayer or VLC, or even both of them.

This is what you should know before making your decision:

MPV MPlayer VLC
Pros Fully functional Fully functional Easy installation
Plays almost all streams
Cons Extra steps to install Extra steps to install
May not play all streams (e.g. m3u8)
Titles update is not consistent (if any)

MPV installation

If MPV is your selection, please refer to the relevant instructions.

MPlayer installation

If MPlayer is your selection, please refer to the relevant instructions.

VLC installation

If VLC is your selection, just go and get it and install it as any other Windows program.

As long as you install it to its default location (e.g “C:\Program Files\VideoLAN\VLC” or “C:\Program Files (x86)\VideoLAN\VLC”) Pyradio will be able to detect and use it.

PyRadio installation Top

At last!

You are ready to install PyRadio!

So here’s how you do it: Right click on this link and use your browser “Save as” menu entry to save the file in your home folder as install.py.

Finally, open a console (press the Win key, type cmd and press ENTER).

Then type:

cd %USERPROFILE%
python install.py
Fresh python installation?

If you have just installed Pyhon, you will probably end up with the following message and the installation script will terminate.

PyRadio has installed all required python modules.
In order for them to be properly loaded, the installation script
has to be executed afresh.

Please execute the installation script again, like so:

    python install.py

This is perfectly normal; some Python modules have been installed, but in order to be used by the installation script, it has to be executed one more time. So you just type (again):

python install.py

in order to complete the installation.

Final steps

If the installation is successful, you will get something similar to the following snippet:

...
Installing pyradio-script.py script to C:\Users\spiros\AppData\Local\Programs\Python\Python37\Scripts
Installing pyradio.exe script to C:\Users\spiros\AppData\Local\Programs\Python\Python37\Scripts

Installed c:\users\spiros\appdata\local\programs\python\python37\lib\site-packages\pyradio-0.8.9-py3.7.egg
Processing dependencies for pyradio==0.8.9
Finished processing dependencies for pyradio==0.8.9

*** HTML files copyed to "C:\Users\spiros\AppData\Roaming\pyradio\help"
=== Player "mplayer" found in "C:\Users\spiros\mplayer"
=== Player "mplayer" found in PATH
*** Installing Dekstop Shortcut


Installation successful!

Finally, you can type pyradio and enjoy!

Note: For your convenience, the installation batch file has tried to installed a shortcut on your Desktop. You can use it to launch PyRadio and optionally modify it (change font size, window dimensions, etc). If it’s not there, you can just copy it from the “help” directory of the Explorer File Manager which will open after executing pyradio -ocd.

Cleaning up

After the installation is completed, there will be some files left on your system, which you may want to remove. These are:

  1. install.py: The script you originally downloaded. It should be in your home folder.
  2. tmp-pyradio: A folder containing PyRadio’s sources and intermediate installation scripts. It should be in your home folder.

You can safely delete these files.

If you need to have PyRadio’s sources, you can just get them from the “tmp-pyradio” folder.

Updating PyRadio Top

PyRadio will inform you when a new release is available and ask you to go on with the update.

If you answer “y” to the question asked, PyRadio will terminate after creating an update batch file and opening Windows Explorer to its location.

You just double click on the batch file (called update.bat) to go on with the update.

In any case, you can perform the update at any time, using the command:

pyradio -U

Updating a pre 0.8.9 installation Top

If you are on a pre 0.8.9 release and want to update PyRadio, just follow the installation instructions, but add the “–force” command line parameter to the installation command.

So, instead of

python install.py

do a

python install.py --force

Uninstalling PyRadio Top

To uninstall PyRadio you just have to open a console window and execute the command:

pyradio -R

PyRadio create an uninstall batch file and open Windows Explorer to its location.

You just double click on the batch file (called uninstall.bat) to complete the procedure.

Reporting bugs Top

When a bug is found, please do report it by opening an issue at github.

In you report you should, at the very least, state your pyradio version and python version.

It would be really useful to include %USERPROFILE%/pyradio.log in your report.

To create it, enter the following commands in a terminal:

cd %USERPROFILE%
del pyradio.log
pyradio -d

Then try to reproduce the bug and exit PyRadio.

Finally, include the file produced in your report.