pyradio(1)
pyradio(1) โ General Commands Manual ๐
๐ NAME ๐
pyradio โ a curses Internet radio player. Thatโs the whole vibe: terminal radio, but make it cute. ๐
๐ SYNOPSIS ๐
pyradio [OPTIONS]
โจ DESCRIPTION โจ
Okay so bestie, pyradio is a command line Internet Radio Player based on curses, and it uses external media players to perform the actual playback. Periodt. ๐
It currently supports these players: MPV, MPlayer and VLC. Yes, those exact names, slay. ๐
๐ OPTIONS ๐
๐ General options ๐
-c CONFIG_DIR,--config-dir CONFIG_DIRโ use specified configuration directory instead of the default one. PyRadio will try to create it, if it does not exist. Not available on Windows.-p [STATION_NUMBER],--play [STATION_NUMBER]โ start and play. The value is num station or empty for random.-u PLAYER,--use-player PLAYERโ use specified player. A comma-separated list can be used to specify detection order. Supported players:mpv,mplayer,vlc.-l,--listโ list of available stations in a playlist.-lt,--log-titlesโ log titles to file.-sd,--show-config-dirโ print config directory[CONFIG DIR]location and exit.-od,--open-config-dirโ open config directory[CONFIG DIR]with default file manager.-pc,--print-configโ print PyRadio sonfig (yes, the page says โsonfigโ; Iโm just the messenger ๐ญ).-d,--debugโ start PyRadio in debug mode.-ul,--unlockโ remove sessions' lock file.-us,--update-stationsโ update"stations.csv"(if needed).-U,--updateโ update PyRadio.-R,--uninstallโ uninstall PyRadio.-V,--versionโ display version information.
๐ง Playlist selection ๐ง
-ls,--list-playlistsโ list of available playlists in config dir.-s PLAYLIST,--stations PLAYLISTโ load the specified playlist instead of the default one.-tlp,--toggle-load-last-playlistโ toggle autoload last opened playlist.
๐จ Themes ๐จ
-t THEME,--theme THEMEโ use specified theme.--show-themesโ show Internal and System Themes names.--no-themesโ disable themes (use default theme).--write-theme IN_THEME OUT_THEMEโ write an Internal or System Theme to themes directory.
๐ธ Terminal selection ๐ธ
--terminal TERMINALโ use this terminal for Desktop file instead of the auto-detected one. Use"none"to reset to the default terminal or"auto"to reset to the auto-detected one.--terminal-param TERMINAL_PARAMโ use this as PyRadio parameter in the Desktop File. Please replace hyphens with underscores when passing the parameter, for example:--terminal-param "_p 3 _t light"(which will result to"pyradio -p 3 -t light").
๐ฆ Cache ๐ฆ
-oc,--open-cacheโ open the Cache folder.-sc,--show-cacheโ show Cache contents.-cc,--clear-cacheโ clear Cache contents.-gc,--get-cacheโ download source code, keep it in the cache and exit.
๐ Recording stations ๐
-r,--recordโ turn recording on (not available for VLC player on Windows).-or,--open-recordingsโ open the Recordings folder.-lr,--list-recordingsโ list recorded files.-mkv MKV_FILE,--mkv-file MKV_FILEโ specify a previously recorded MKV file to be used with one of the following options. TheMKV_FILEcan either be an absolute or a relative path, or a number provided by the-lrcommand line paremater (their spelling, not mine ๐ซถ). If it is a relative path, it should be found in the current or in the Recordings directory.-scv PNG_FILE,--set-mkv-cover PNG_FILEโ add or change the cover image of a previously recorded MKV file.PNG_FILEcan either be an absolute or a relative path. If relative, it should be found in the current or in the Recordings directory.-srt,--export-srtโ export a previously recorded MKV file chapters to an SRT file. The file produced will have the name of the input file with the"mkv"extension replaced by"srt".-ach,--add-chaptersโ add (or replace) chapter markers to a previously recorded MKV file. The chapters file will be a SRT file, much like the one produced by the previous command line parameter.
๐ง Headless operation ๐ง
--headless IP_AND_IPORTโ start in headless mode.IP_AND_IPORTcan be a)auto(uselocalhost:11111), b)localhost:XXXXX(access the web server through localhost), c)lan:XXXXX(access the web server through the LAN) or d)IP_ADDRESS:XXXX(theIP_ADDRESSmust be already assigned to one of the network interfaces).XXXXXcan be any port number above1025. Please make sure it is different than the one set in the configuration file.--addressโ show remote control server address.-fd,--free-dead-headless-serverโ use this if your headless server has terminated unexpectedly, and you cannot start a new one (you get a message that it is already running).
The following options can also be set in pyradioโs configuration file:
-s parameter default_playlist (default value: stations)
-p parameter default_station (default value: -1)
-u parameter player (default value: mpv, mplayer, vlc)
๐ฎ CONTROLS ๐ฎ
Up/Down/PgUp/PgDownโ change station selection.j/kโ change station selection (vi-like).Enter/Right/lโ play selected station.rโ select and play a random station.Space/Left/hโ stop/start playing selected station.Pโ jump to playing station.H M Lโ jump to top / middle / bottom of screen.gโ jump to the start of the playlist.<n>Gโ jump to the end of the playlist. If<n>(line number) was entered, jump to it.-/+or,/.โ change volume.mโ mute.vโ save volume (MPV and MPlayer only).o s Rโ open / save / reload playlist.a Aโ add / append a new station.eโ edit current station.Eโ change current station's encoding.DEL,xโ delete selected station.Oโ open RadioBrowser.< / >โ browse the Stations history list.Jโ create a Jump tag.<n>^U,<n>^Dโ move current station up / down. If<n>(line number) was entered, or a Jump tag has been defined, move the station there.tโ open the Theme Selection window.Tโ toggle background transparency.cโ open the Configuration window.',\,yโ get into Registers, Extra Commands, Yank mode, respectively.zโ toggle"Force http connections".Zโ display the"Extra Player Parameters"window.?โ show keys help.Esc/qโ quit.
The same logic applies to all pyradio windows.
Note: When inserting numbers (either to jump to a station or to move a station), the number will be displayed at the right bottom corner of the window, suffixed by a"G", i.e. pressing35will display[35G].
Note: When tagging a station position for a move action (by pressing"J"), the position will be displayed at the right bottom corner of the window, suffixed by a"J", i.e. pressing"J"on position35will display[35J].
๐ Global shortcuts ๐
Some of the functions provided by pyradio will always be available to the user. These functions are:
+/-and,/.โ adjust volume.mโ mute player.vโ save volume.Tโ toggle transparency.Wโ toggle title logging.wโ like a station.^N/^P[1] [2] โ play next / previous station.</>[1] โ play next / previous station history entry.
Every window in pyradio will respect these shortcuts, even the ones with a โPress any key toโฆโ message. No cap. โจ
When focus is on a Line editor, all shortcuts will work when preceded by a \.
๐ Notes ๐
[1]โ Function not available when in Playlist and Registers mode. More info on pyradio's modes below.[2]โ Function not available in the RadioBrowser Search window.
๐ธ Pyradio's Modes ๐ธ
okay bestie, pyradio has these primary modes โ think of them as the main-character states of the app:
- The Main mode โ this is what you get when you open the program: a list of stations (a playlist) that you can play and edit. Thatโs why itโs also called the editing mode. All the other modes come from this one, and itโs the mode you have to get back to in order to terminate the program. ๐
- The Playlist mode โ open it by pressing
"o". From there you can open, create, paste a station, etc. โจ - The Registers mode โ identical to the
Playlistmode, but instead of displaying playlists it displays register. Enter it by pressing''(two single quotes) and exit withEscorq. You can also press'(single quote) to get to thePlaylistmode and back. ๐ - The Register Main mode โ identical to the
Mainmode, except it displays the content of a named register. ๐ - The Listening mode โ made for when you just want pyradio to play your favorite station and not take up too much space. Itโs ideal for tilling window manager use, because the whole TUI can be reduced all the way down to a single line (displaying the
Status Bar). In this mode, adjusting, muting and saving the volume are the only actions available. To get pyradio back to normal operation, you just resize its window to a reasonable size (7lines vertically, or more). ๐ฆ
A set of secondary modes is also available โ and yes, a secondary mode works within a primary one:
- The Extra Commands mode โ gives you access to extra commands. Enter it by pressing
\(backslash). Then a backslash is displayed at the bottom right corner of the window. โญ - The Yank (Copy) mode โ used to copy stations to registers. Enter it by pressing
y. Then ayis displayed at the bottom right corner of the window. ๐ - The Open Register mode โ used to open a register or get into the Registers or Register Main mode. Enter it by pressing
'(single quote). Then a single quote is displayed at the bottom right corner of the window. ๐ - The Paste mode โ available in the Station editor window only. Itโs designed to help you paste a URL (and optionally a stationโs name). Why, you might ask... Well, the Station editor normally treats the
?and\characters as special characters (actually commands). So if a URL containing these characters (more frequently the?character) is pasted, it will be corrupted unless the Paste mode is enabled. ๐ญ
The functions available through the secondary modes are content dependant, so you can see what command is available by pressing ? while within such a mode. Pressing any other key will exit the secondary mode. ๐ซถ
๐ง Tiling manager modes ๐ง
These modes are specifically designed to be used with tiling window managers, trying to face a rapid reduction of window height or width (or both).
- The Limited Height mode โ automatically enabled when the window height gets below
8lines.
In this mode, only a limited information is visible, and if playback is on, the volume is the only thing that can be adjusted (or muted) and saved. This is the Limited display. ๐
- The Limited Width mode โ automatically enabled when the window width get below certain limits:
- a. When the width gets below
40columns, all windows will be closed and the main window will be the only visible one (either displaying stations, playlists or registers). ๐ธ - b. When the width gets below
20columns, theLimited displaywill be activated. โจ
- a. When the width gets below
๐ Config File ๐
when pyradio runs, it first reads its package configuration file and then tries to read the user configuration file. If an error occurs while parsing it, an error message will be displayed and pyradio will terminate. no cap, thatโs the rule. ๐
๐ฆ The package config file ๐ฆ
The package configuration file contains the programโs default parameters. These are the player to use, the playlist to load, etc. It is heavily commented, so it can be used as a template in order to manually create the user configuration file. ๐
You can also get the configuration file with the active parameter values (i.e. after being changed by the user config file) by executing the command:
pyradio -pc
๐ The user config file ๐
This file (typically ~/.config/pyradio/config) is created by pyradio when needed. It will contain only the parameters whose value is different from the one set in the package configuration file. ๐
You can easily edit it manually, though. The best practice is to execute pyradio with the -ocd command line option, which will open the configuration directory in your file manager, and then edit (or create it) using your preferable text editor. Donโt forget you can get the list of parameters by executing pyradio -pc. โจ
The file can also be altered while pyradio is running by pressing c, which will open the Configuration window. This window presents all pyradio options and provide the way to change them and finally save them by pressing s. ๐
In any case, pyradio will save the file before exiting (or in case Ctrl+C is pressed) if needed (e.g. if a config parameter has been changed during its execution). ๐ซถ
If saving the configuration file fails, pyradio will create a back up file and terminate. When restarted, pyradio will try to restore previously used settings from the said back up file. ๐
๐ธ About Playlist Files ๐ธ
Okay bestie, so pyradio reads the stations it's gonna play from a CSV file. Each line has two columns: column one is the station name, column two is the stream URL. Simple, iconic, no cap.
Optionally, you can add a third column that says what encoding the station uses โ more on that at Specifying Stations' Encoding. And optionally, two more columns can be used.
So the whole lineup is: the third column defines the encoding used by the station (again, more at Specifying Stations' Encoding), and the fourth column sets an Icon URL, which gets used when displaying Desktop Notifications. ๐
By default, pyradio loads the user's stations file, like ~/.config/pyradio/stations.csv. If that file isn't found, it gets created and populated with a default set of stations. Slay.
Tip: If you already have a customstations.csvfile but wanna update it withpyradio's default one, just rename your file, runpyradioso the default one gets created, and then merge the two files. Easy.
Note: Older versions used to use~/.pyradioas the default stations file. If that file is found, it will be copied to the user's config directory (e.g.~/.config/pyradio) and renamed tostations.csvโ or, if that file already exists, topyradio.csv. In this case, this file will be the default one.
โจ Defining and using Groups โจ
To organize stations inside a big playlist, pyradio supports Groups. A Group is defined as a normal "station" entry whose URL field is a hyphen (-). For example, this defines a Group Header for a Group called Blues:
Blues,-
A Group Header entry does not define a station, so it cannot start a playback session. Other than that, it can be moved, copied, deleted, etc. just like any other playlist entry. Main character energy, honestly.
To add a Group Header, press a, fill in the name, and type - in the URL field.
You can navigate among Groups with:
^E/^Yโ go to the next / previous Group.^Gโ display a list of existing Groups to select from.
๐ Integrating new stations ๐
When the package's stations.csv file gets updated, those changes do not automatically appear in the user's stations file. Rude, but true.
pyradio will display a message asking the user to either update the file, ignore the changes for this version, or postpone the decision until the next time pyradio is executed.
Either way, the user can always manually update their stations file by issuing this command:
pyradio -us
If changes have been applied, a message resembling the following will appear:
Reading config...
Updating "stations.csv"
Last updated version: 0.9.2
Last synced version: None
From version: 0.9.2
+/- updating: "Reggae Dancehall (Ragga Kings)"
+++ adding: "Groove Salad Classic (Early 2000s Ambient)"
+++ adding: "n5MD Radio (Ambient and Experimental)"
+++ adding: "Vaporwaves [SomaFM]"
+++ adding: "The Trip: [SomaFM]"
+++ adding: "Heavyweight Reggae"
+++ adding: "Metal Detector"
+++ adding: "Synphaera Radio (Space Music)"
Summary
+++ added : 7
+/- updated : 1
--- deleted : 0
If the file is already up to date, this message will be displayed:
Reading config...
Updating "stations.csv"
Last updated version: 0.9.2
Last synced version: 0.9.2
Already synced: "stations.csv"
๐ Specifying a playlist to load (command line) ๐
Normally, pyradio loads its default playlist file, as described above, when it starts. A different file can be loaded when the -s command line option is used.
The -s option accepts:
- a relative or absolute file name.
- the name of a playlist file that's already in its configuration directory.
- the number of a playlist file, as provided by the
-lscommand line option.
Examples, because we love a demonstration:
To load a playlist called blues.csv, you'd use:
pyradio -s /path/to/blues.csv
If that file was saved inside pyradio's configuration directory, you could use:
pyradio -s blues
To use the playlist number, you'd execute:
pyradio -ls
Playlists found in "/home/user/.config/pyradio"
โโโโโโณโโโโโโโโโโโณโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ # โ Name โ Size โ Date โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 1 โ hip-hop โ 6.41 KB โ Mon Nov 7 18:17:47 2022 โ
โ 2 โ party โ 1.94 KB โ Fri Nov 29 10:49:39 2021 โ
โ 3 โ stations โ 5.30 KB โ Sat Jul 18 23:32:04 2022 โ
โ 4 โ huge โ 1.94 MB โ Wed Oct 23 11:05:09 2019 โ
โ 5 โ blues โ 5.30 KB โ Thu Jul 16 16:30:51 2020 โ
โ 6 โ rock โ 2.56 KB โ Fri Jan 10 00:20:07 2023 โ
โ 7 โ pop โ 1.01 KB โ Fri Sep 18 00:06:51 2020 โ
โโโโโโดโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโ
pyradio -s 5
Note: Python 2 output is much simpler, but the functionality is the same.
Note: The default playlist to load can also be set inpyradio's configuration file, parameterdefault_playlist(default value isstations).
๐ฆ Autoloading playlists ๐ฆ
As already stated, pyradio normally loads its default playlist (called stations) on startup. This behavior can be changed in two ways:
- Changing the default playlist. This is done using the
Def. playlistconfiguration option (optionally along with theDef. stationoption). - Always loading the last used playlist at startup. This is done using the
Open last playlistconfiguration option. In this case, the last used playlist will be opened the next timepyradiois executed, trying to restore the previously selected station or starting playback. This option takes precedence before theDef. playlistconfiguration option (if it's used) and the-s(--stations) command line option.
Note: When theOpen last playlistconfiguration option is set, all playlist operations will be performed on the last opened playlist. In order to use the-a(--add) or-l(--list) command line options along with the-s(--stations) command line option, the-tlp(--toggle-load-last-playlist) option can be used to temporarily deactivate autoloading.
๐ Managing Playlists (within Pyradio) ๐
Once pyradio has loaded, you can perform a bunch of actions on the current playlist and on the set of playlists saved in its configuration directory. Currently, the following actions are available:
Pressing a or A lets you add a new station (either below the currently selected station or at the end of the list), while e edits the currently selected station. All of these actions open the "Station editor".
If you just wanna change the encoding of the selected station, press E. If the station is currently playing, playback will be restarted so the encoding change takes effect (hopefully correctly displaying the station/song title). Fingers crossed, bestie.
Then, when that's done, you can either save the modified playlist by pressing s, or reload the playlist from disk by pressing R. A modified playlist will automatically be saved when pyradio exits (or when Ctrl+C is pressed).
One thing you may also wanna do is remove a station from a playlist โ e.g. when you find it no longer works. You can do that by pressing DEL or x.
Finally, opening another playlist is also possible. Just press o and you'll be presented with a list of saved playlists to choose from. These playlists must be saved beforehand in pyradio's configuration directory.
While executing any of the previous actions, you may get confirmation messages (when opening a playlist while the current one is modified but not saved, for example) or error messages (when an action fails). Just follow the on-screen information, keeping in mind that a capital letter as an answer will save this answer in pyradio's configuration file for future reference. ๐
๐ซถ Managing โForeignโ Playlists ๐ซถ
A playlist that does not reside within the program's configuration directory is considered a "foreign" playlist. This playlist can only be opened by the -s command line option.
When this happens, pyradio will offer you the choice to copy the playlist into its configuration directory, making it available for manipulation within the program.
If a playlist of the same name already exists in the configuration directory, the "foreign" playlist will be time-stamped. For example, if a "foreign" playlist is named stations.csv, it will be named 2019-01-11_13-35-47_stations.csv (provided that the action was taken on March 11, 2019 at 13:35:47).
โญ Playlist History โญ
pyradio keeps a history of all the playlists opened (within a given session), so navigating between them is easy. To go back to the previous playlist, you just press \\ (double backslash). To get to the first playlist, \] (backslash - closing square bracket) can be used.
Going forward in history is not supported. We don't do that here. ๐
๐ง Stations history ๐ง
Playing several stations โ sometimes among different playlists โ and returning to them is sometimes a tedious operation. This problem is addressed with the Station history functionality, which is actually a list of stations that have been played back.
The user can go back and forth in this list using the < and > keys.
The list is not saved between sessions (restarting the program will lead to an empty list). When an online service is used (e.g. RadioBrowser), the list is reset with every search that is performed. ๐ฆ
๐ SEARCH FUNCTION ๐
Okay bestie, listen: any window thatโs showing you a list of things โ stations, playlists, themes โ has a search function, and you open it by pressing /. ๐
The Search Window supports normal and extend editing and in session history. You can always get help by pressing the ? key.
After a search term has been successfully found โ and yes, search is case insensitive โ you get the next occurrence with n and the previous occurrence with N. Iconic. โจ
โจ LINE EDITOR โจ
pyradioโs โSearch functionโ and โStation editorโ use a Line editor so you can type and edit stationsโ data. It works on both Python 2 and Python 3, but it does not give you the same functionality on both versions:
- In Python 2, only ASCII characters can be inserted.
- In Python 3, no such restriction exists. Furthermore, using CJK characters is also supported.
You can always display help by pressing ?, but that causes a drawback: you cannot actually have a ? within the string. To do that, you use the backslash key \ and then press ?.
To sum it all up:
- Press
?to get help. - Press
\?to get a?. - Press
\\to get a\.
When in Station editor, the Line editor recognizes an extra mode: Paste mode. This mode is enabled by pressing \p and gets automatically disabled when the focus moves off the line editors.
Paste mode is designed to directly accept the ? and \ characters โ which are normally used as command indicators. This makes it possible to easily paste a stationโs name and URL, especially when the ? and \ characters exist in them; it is very common to have them in URLs. ๐ซถ
๐ง CJK Characters Support ๐ง
The Line editor supports the insertion of CJK Unified Ideographs [1], as described on CJK Unified Ideographs (Unicode block) [2], also known as URO, abbreviation of Unified Repertoire and Ordering. These characters, although encoded as a single code-point (character), actually take up a 2-character space when rendered on the terminal.
A depiction of the editorโs behavior can be seen at this image:
https://members.hellug.gr/sng/pyradio/pyradio-editor.jpg
- [1]
https://en.wikipedia.org/wiki/CJK_Unified_Ideographs - [2]
https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_(Unicode_block)
๐ MOVING STATIONS AROUND ๐
Rearranging the order of the stations in the playlist is another feature pyradio offers. All you have to do is specify the source station โ the station to be moved โ and the position it will be moved to โ the target. ๐ฏ
There are three ways to do that:
- Press
Ctrl-UorCtrl-Dto move the current station up or down. - Type a station number and press
Ctrl-UorCtrl-Dto move the current station there. - Go to the position you want to move a station to, and press
J. This will tag this position (making it the target of the move). Then go to the station you want to move and pressCtrl-UorCtrl-Dto move it there.
๐งฌ SPECIFYING STATIONSโ ENCODING ๐งฌ
Normally, stations provide information about their status โ including the title of the song playing, which pyradio displays โ in Unicode (utf-8 encoded). Therefore, pyradio will use utf-8 to decode such data by default.
In an ideal world that would be the case for all stations, everything would be okay, and as far as pyradio is concerned, songsโ titles would be correctly displayed. Unfortunately, this is not the case. ๐ญ
A lot of stations encode and transmit data in a different encoding (typically the encoding used at the region they come from). The result in pyradio would be that a song title would be incorrectly displayed, not displayed at all, or trying to display it might even break pyradioโs layout.
Note โvlcwill not work in this case; it presumably tries to decode the said data beforehand, probably usingutf-8by default, and when it fails, it provides a"(null)"string, instead of the actual data. So, youโd better not usevlcif such stations are in your playlists.
pyradio addresses this issue by allowing the user to declare the encoding to use either in a station by station mode or globally. ๐
๐ Station By Station Encoding Declaration ๐
As previously stated, a pyradioโs playlist can optionally contain a third column (in addition to the station name and station URL columns), which declares the stationโs encoding.
So, when a non-utf-8 encoded station is inserted in a playlist, its encoding can also be declared along with its other data. The drawback of this feature is that an encoding must be declared for all stations (so that the CSV file structure remains valid). To put it simple, since one station comprises the third column, all stations must do so as well.
This may seem intimidating (and difficult to achieve), but itโs actually really simple; just add a , character at the end of the line of each station that uses the default encoding. In this way, all stations comprise the third column (either by declaring an actual encoding or leaving it empty).
Example:
Suppose we have a playlist with one utf-8 encoded station:
Station1,Station1_URL
Now we want to add "Station2" which is iso-8859-7 (Greek) encoded.
Since we know all stations must comprise the third (encoding) column, we add it to the existing station:
Station1,Station1_URL,
This way we add an empty encoding, forcing
Finally, we insert the new station to the playlist:
Station1,Station1_URL,
Station2,Station2_URL,iso-8859-7
Note โ Using the-acommand line option will save you all this trouble, as it will automatically take care of creating a valid CSV file. Alternatively, you can change the selected stationโs encoding by pressingEwhile inpyradio.
๐ Global Encoding Declaration ๐
pyradioโs configuration file contains the parameter default_encoding, which by default is set to utf-8.
Setting this parameter to a different encoding will permit pyradio to successfully decode such stations.
This would be useful in the case where most of your stations do not use utf-8. Instead of editing the playlist and adding the encoding to each and every affected station, you just set it globally. Slay. โจ
๐ Finding The Right Encoding ๐
A valid encoding list can be found at:
https://docs.python.org/2.7/library/codecs.html#standard-encodings
replacing 2.7 with specific version: 3.0 up to current python version.
๐ฎ PLAYER DETECTION / SELECTION ๐ฎ
pyradio is basically built around the existence of a valid media player it can use. Thus, it will auto detect the existence of its supported players upon its execution.
Currently, it supports MPV, MPlayer and VLC, and it will look for them in that order. If none of them is found, the program will terminate with an error.
Users can alter this default behavior by using the -u command line option. This option will permit the user either to specify the player to use, or change the detection order.
Example:
pyradio -u vlc
will instruct pyradio to use VLC; if it is not found, the program will terminate with an error.
pyradio -u vlc,mplayer,mpv
will instruct pyradio to look for VLC, then MPlayer and finally for MPV and use whichever it finds first; if none is found, the program will terminate with an error.
Note โ The default player to use can also be set inpyradioโs configuration file, parameterplayer(default value ismpv, mplayer, vlc).
๐ Changing player mid-session ๐
If the user faces a playback problem with a given station, chances are that a different player will successfully play it.
Pressing \m will bring up the โSwitch Media Playerโ window, where a different player can be activated.
Note โ The activated player will not be saved; PyRadio will still use the player defined at its config next time it is executed.
๐ SPECIFYING A STATIONโS REFERER URL ๐
Although pyradio is meant to be a radio station player, it can also be used to listen to video stations transmitting m3u8 playlists (HTTP Live Streaming or HLS).
The thing with these transmissions is that usually a Referer URL has to be provided so that the connection does not fail.
pyradio now does support the declaration of a Referer URL for individual stations; it does it in an โanorthodoxโ way, but it is available and it works.
So, let us imagine that a station called "My video station" has been added to a playlist. The user tries to play it but it fails; the referer URL is missing.
To rectify the situation, a file containing the referer URL would have to be saved in the config directory: its name must be the name of the station as it is in the playlist, followed by the .referer.txt extension.
In our example above, the file will have to be named:
"My video station.referer.txt"
A note of caution โ If such a file has been created for a station, please do not rename the station in the playlist manually; the โlinkโ to the referer file will be lost. Rename the station using pyradio rename functionality and save the playlist instead; the referer file will be renamed as well.
Note โ This will unfortunately not work with MPlayer. It seems it will not use the Referer provided, as shown in the following part of the command execution output:
[tcp @ 0x7f4a42c7fa60]Successfully connected to XX.XX.XXX.XX port 443
[https @ 0x7f4a42c7fa60]request: GET /live/XXXXXXXX.m3u8 HTTP/1.1
User-Agent: Lavf/60.16.100
Accept: */*
Range: bytes=0-
Connection: close
Host: XXXXXX-XXXXXXXXX.XXXXXX.XXX.XXX.XX
Icy-MetaData: 1
[https @ 0x7f4a42c7fa60]HTTP error 403 Forbidden
๐ธ EXTRA PLAYER PARAMETERS ๐ธ
Ok so bestie, plot twist: all three supported players can accept a significant number of "command line parameters" โ and they're all well documented and accessible through man pages (on linux and macOS) or the documentation (on Windows). Iconic of them honestly.
pyradio uses some of these parameters to execute and communicate with the players. In particular, the following parameters are in use by default:
mpvโ--no-video,--quiet,--input-ipc-server,--input-unix-socket,--playlist,--profilemplayerโ-vo,-quiet,-playlist,-profilevlcโ-Irc,-vv. On Windows only:--rc-host,--file-logging,--logmode,--log-verbose,--logfile
Note โ the user should not use or change the above player parameters. Failing to do so may render the player unusable. Like, do not touch, bestie, it's giving "handle with care". ๐
pyradio provides a way for the user to add extra parameters to the player, either by a command line parameter, or the "Configuration Window" (under "Player:").
This way, 10 sets of parameters can be inserted and made available for selection. Slay.
๐ Using The Configuration Window
When the user uses the configuration window (screenshot in the docs: pyradio-player-selection.jpg), they're presented with an interface which will permit them to select the player to use with pyradio and edit its extra parameters.
Each of the supported players can have up to 11 sets of extra parameters (the first one is the default).
The user can add (a) a new parameter, edit (e) an existing set and delete (x or DEL) one. So simple, so clean. โจ
๐ PLAYER CONNECTION PROTOCOL ๐
Most radio stations use plain old http protocol to broadcast, but some of them use https.
Experience has shown that playing a https radio station depends on the combination of the station's configuration and the player used. It's giving "it's complicated" ๐ญ
If such a station fails to play, one might as well try to use http protocol to connect to it.
pyradio provides a way to instruct the player used to do so: the "Force http connections" configuration parameter. If it is False (the default), the player will use whatever protocol the station proposes (either http or https). When changed to True, all connections will use the http protocol.
When the selected player is initialized (at program startup), it reads this configuration parameter and acts accordingly.
If the parameter has to be changed mid-session (without restarting the program), one would press z to display the "Connection Type" window, where the parameter's value can be set as desired.
Note โ changes made using the "Connection Type" window are not stored; next time the program is executed, it will use whatever value the configuration parameter holds. Furthermore, changing the configuration stored value will not affect the "working" value of the parameter. Two different girls, bestie, don't mix them up. ๐
๐ Visual reminder
When this option is activated, either through the config or the keyboard, a [http forced (z)] message appears on the top right corner of the window, as can be seen in the screenshot http-force.jpg in the docs.
The z in parenthesis is just a hint to remind the user that they can change the behavior by pressing z.
As the window shrinks in width, the message becomes a [h]; when it shrinks even more, it disappears completely. Shy little thing. ๐ฆ
๐ PLAYER DEFAULT VOLUME LEVEL ๐
All players, when started, use their saved (or default) volume level to play any multimedia content. Fortunately, this is not the case with VLC.
This introduces a problem to pyradio: every time a user plays a station (i.e. restarts playback), even though they may have already set the volume to a desired level, the playback starts at the player's default level. Annoying? Lowkey yes. ๐ญ
The way to come around it is to save the desired volume level in a way that it will be used by the player whenever it is restarted.
This is done by typing v right after setting a desired volume level. Periodt.
๐ง MPV
MPV uses profiles to customize its behavior.
pyradio defines a profile called [pyradio] in MPV's configuration file (e.g. ~/.config/mpv/mpv.conf). This profile will be used every time playback is started.
Example:
volume=100
[pyradio]
volume=50
๐ถ MPlayer
MPlayer uses profiles to customize its behavior as well.
pyradio defines a profile called [pyradio] in MPV's configuration file (e.g. ~/.mplayer/config). This profile will be used every time playback is started.
Example:
volume=100
[pyradio]
softvol=1
softvol-max=300
volstep=1
volume=50
Note: starting withpyradiov.0.8.9, mplayer's default profile will use its internal mixer to adjust its volume; this is accomplished using thesoftvol=1andsoftvol-max=300lines above. The user may choose to remove these lines from the config (to activate system-wide volume adjustment) or add them to the config (in case the profile was created by an olderpyradioversion).
๐ฆ VLC
Although VLC can use a local configuration file, there seems to be no reliable way of defining the playback volume in it.
In the past, VLC would just use any volume setting it had saved from a previous execution, but now it is possible to save the volume it will use when executed by pyradio.
This means that VLC will start and connect to a station, use whatever volume level it's stored for it and then pyradio will reset the volume to the desired one (as saved within pyradio).
The volume that will be saved is in a file called vlc.conf and resides within the data directory, inside pyradio's configuration folder. Cute little file, doing its thing. ๐
๐งบ BUFFERING ๐งบ
When a station is slow (or the internet connection is slow), one might get to a situation where the connection timeout will run out before the connection with the station can be established. Even worse, pyradio will connect to the station, but the sound will be choppy and crackling. Absolutely not the vibe. ๐
The solution is to use a large enough buffer to connect to the station; this will effectively make pyradio connect to the station and start receiving data, but will not start playback until the buffer is full.
All pyradio supported players support buffering, using a number of command line parameters to actually set it up. pyradio will remove all this complexity by making it as simple as inserting a single value into the "Buffering" window (screenshot in the docs: pyradio-buffering-win.jpg).
The window opens by pressing \B while in the Main mode.
It will display the current buffer size (0 means no buffering), and will permit adjusting it, or using the previously used value (pressing r).
In any case, one can enable or disable the use of buffering by pressing \b (using either the default value or the one set in the "Buffering" window).
๐ ๏ธ Parameters used
The following list shows the command line parameters used by pyradio when the "Buffering" window is used to set up buffering.
mpv(X in seconds)--demuxer-readahead-secs=X-1--demuxer-cache-wait=yes--cache=yes--cache-secs=X--cache-on-disk=yes/no *- * disabled if more than 500KB of memory is free
mplayer(X in KBytes)-cache X-cache-min 80
vlc(X in seconds)--network-cachin X * 1000
๐ Customizing the buffering behaviour
In case one wants to use a different set of parameters (when using mpv or mplayer, but not vlc), one would just not use the integrated solution; one would just use a profile.
Please refer to the players' documentation on profiles and the "Player default volume level" section in this man page.
As long as the word cache is contained in the profile's name, pyradio will understand this is a buffering profile and act accordingly. But it's up to the user to make sure this presupposition is honored. No cap, that part is on you bestie. ๐ซถ
๐ How it works
When buffering is enabled, and a connection to a station initializes, pyradio will display a [B] at the top left corner of the window, and display Buffering: and the name of the station in the status bar, until it gets a token that the buffering has stopped.
Screenshot in the docs: pyradio-b.jpg โ an example is shown there.
Now, this behaviour depends on the station, and the data it sends (or does not send) while it is buffering. For example, an ICY title may be received while buffering, which will be displayed in the status bar.
It should be noted that no volume adjustment can be performed while buffering. Like, the volume slider is just not taking calls right now. ๐ญ
๐ต๏ธโโ๏ธ DISPLAYING STATION INFO ๐ต๏ธโโ๏ธ
When a connection to a radio station has been established, the station starts sending audio data for the user to listen to.
Well, that's obvious, right?
Yes, but this is just half of the story.
The station actually also sends identification data, audio format data, notifications, etc. Part of this non-audio data transmitted by a station is the title of the song currently playing; this is why we can have this data displayed at the bottom of the screen. Main character data honestly. โญ
Now, not all stations send the whole set of data; most send their name, website, genre and bitrate, for example, but some may omit the website or the genre.
pyradio can receive, decode and display this data, and even help the user to identify an unknown station. This is the way to do it:
After a connection to a station has been established (after playback has started), just press i to display the station's info.
The window that appears includes the "Playlist Name" (the station name we have in the playlist) and the "Reported Name" (the name the station transmitted to us) among other fields (an example can be seen at pyradio-station-info.jpg in the docs). If these two names are not identical, the user can press r to rename the station in the playlist using the "Reported Name". This way an unknown station (when only the URL is known) can be correctly identified (after being inserted in a playlist with a dummy station name). Mystery solved, Nancy Drew ate. ๐ฅ
๐ Copying And Pasting - Registers ๐
okay so pyradio takes the concept of registers from ivim (https://www.vim.org) and adapts their function to its own needs. So this is how it all works, bestie.
There are 36 named registers (a-z, 0-9) and one unnamed register.
๐ Named registers ๐
a-z,0-9โ these are actually files that contain stations and can be opened and edited as regular playlist files. There are some differences in handling them: they are accessible either individually or using a special window, they are automatically saved, and writing errors are ignored. That last bit means registers should not be regarded as normal playlist files that can be safely saved and used forever; this is true as long as thereโs no problem with writing to them. If a writing error occurs, they may get overwritten or emptied. To permanently save a register, youโd rename it to a normal playlist file.
๐ฆ The unnamed register ๐ฆ
The unnamed register holds just one station (the one that has been copied or added to a register or deleted from a playlist), and it is the one used when pasting to a register or a playlist. One can see its contents by pressing \u.
To copy a station to a register, press y and:
- one of
a-z,0-9โ add it to the corresponding named register. The unnamed register is also populated. ENTERโ add it to the unnamed register.
To open a named register, press ' (single quote) and:
- one of
a-z,0-9โ open the corresponding register. '(single quote) โ open the Registers window, so that a register can be selected.
To rename a named register, press \r either in the Registers window or while editing the register.
To clear a named register, press \c either in the Registers window or while editing the register.
To clear all registers, press \C either in the Registers window or while editing a playlist or a register.
To paste the unnamed register to a playlist or register, press:
pwhile editing a playlist or register.\pwhile editing a playlist or register. This opens the Paste selection window.\pin the Playlist Selection or the Registers window.
๐ Favorites playlist ๐
Pressing * in Main Mode will add the selected station to the favorites playlist.
If the station is already there, it will either be updated if its name has been changed, for example, or will be ignored, to avoid creating duplicate entries.
The favorites playlist, residing in the configuration folder, is a normal playlist in any other respect, which can be subsequently opened, edited, deleted even, as any other playlist.
๐จ Pyradio Themes ๐จ
pyradio comes with 6 preconfigured (hard coded) themes:
dark(8 color theme) โ This is the appearance pyradio has always had. Enabled by default.light(8 color theme) โ A theme for light terminal background settings.dark_16_colors(16 color theme) โ dark theme alternative.light_16_colors(16 color theme) โ light theme alternative.white_on_blackorwob(256 color b&w theme) โ A theme for dark terminal background settings.black_on_whiteorbow(256 color b&w theme) โ A theme for light terminal background settings.
Furthermore, a number of System Themes (these are actual files saved in the themes installation directory) are also available:
AM_by_amski1โ A simple green on dark theme, created for Windows.blue-by-boxerโ A reddish on blue theme by user Boxer at Mabox Forum (https://forum.maboxlinux.org/).catppuccin-frappe,catppuccin-latte,catppuccin-macchiatoandcatppuccin-mochaโ Four themes by the Catppuccin community (https://github.com/catppuccin).classic_by_obsdgโ A classic theme by The OpenBSD Guy (https://github.com/OpenBSDGuy), originally created on OpenBSD (https://www.openbsd.org/).cupcake_by_edunfeltโ Two themes by edunfelt (https://github.com/edunfelt) inspired by the base16 (https://github.com/base16-project) project.dracula_by_Plyply99โ A theme based on the Dracula theme by Plyply99 (https://github.com/Plyply99).gruvbox_dark_by_sngandgruvbox_light_by_sngโ Two themes based on the gruvbox (https://github.com/morhetz/gruvbox) theme.hyprland_amber_goldandhyprland_draculaโ Two themes by mechatour (https://github.com/mechatour), from hyprland_amber_gold (https://github.com/mechatour/hyprland_amber_gold) and hyprland_dotfiles (https://github.com/mechatour/hyprland_dotfiles).minima_by_ben_chileโ A theme by ben_chile (https://forum.maboxlinux.org/u/ben_chile) created on the Mabox Linux Forum (https://maboxlinux.org).pastel_based_by_sngโ A dim but colorful theme.
Contrary to the old styling method, which was terminal and palette dependent, a new styling method has been implemented; actual CSS colors can now be defined.
Pressing t will bring up the Theme selection window, which can be used to activate a theme and set the default one.
Note If the theme selected in the Theme selection window (or requested using the-tcommand line option), is in any way invalid, or is of the old format, pyradio will fall-back to thedarktheme and will display a relevant message.
The window will display the current state of the Use transparency and Force transparency configuration options in its bottom right corner:
- A
[T]means that the Use transparency option is enabled. - A
[F]means that the Force transparency option is enabled. - A
[TF]means that both options are enabled.
Note the options indication will not be visible when the window is opened within pyradioโs Configuration Window.
One can get more info about these options in the โUsing Transparencyโ section, below.
The Theme selection window will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing q or any other relevant key โ pressing ? will bring up its help).
Pressing SPACE will apply the theme and make it default, and pressing c will apply the theme and make it default and start a file watch function on the file, so that if the file changes, pyradio will automatically update itself.
๐ Alternative Main Window border color ๐
It is also possible to change the Main Window border color. This is a feature that has been requested and implemented, but not used by default.
To provide an alternative border color, one would just add the following to a theme file:
# Border color for the Main Window
# (background color will come from Stations)
Border #69a9a7
Note This color will be used only when the terminal supports more than 16 colors. This is because pyradio already uses colors 0-15, and this border color will be declared as color No 16.
๐ง Virtual terminal restrictions ๐ง
After introducing CSS color themes, it has come to my attention that pyradio will not display colors correctly when executed within specific terminals, konsole, yakuake, deepin-teminal, qterminal and terminology, just to name a few.
Now, I do not know whether this is because of the terminals themselves, python curses implementation or whatever, but thatโs that.
pyradio will try to detect these terminals and disable themes (after displaying a relative message). Then the default theme will be used.
Some of the terminals that work ok, are: gnome-terminal, mate-terminal, xfce4-terminal, lxterminal, terminator, termite, kitty, alacritty, sakura, roxterm, tilix, lilyterm, st, xst, rxvt, urxvt, uxterm, xterm.
If you want to make pyradio start in one of these terminal, just follow the instructions given at Desktop File: Specifying the terminal to use.
๐ CSS color themes restrictions ๐
Using CSS colors imposes a couple of restrictions on the type of terminals pyradio will be able to run:
- The
TERMvariable must be set (Linux and MacOs only). pyradio will set it to"xterm-256color"if not set. Furthermore, ifTERMis set to anything like"xterm*","screen*"or"tmux*", pyradio will set it to"xterm-256color"as well. - Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the curses library). These terminals will default to either the
"dark"or the"light"theme (determined by the configuration parameterconsole_theme), displaying whatever colors the active palette dictates. - There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly. This means that, in order for a theme change to take full effect, pyradio will have to be restarted.
๐ Secondary windows background ๐
Secondary windows (such as messages, questions, the Theme Selection window, the Encoding Selection window, etc.) originally use the same background color as the Main window.
It is now possible to use a different background color for these windows, to get better visual result.
There are two ways to do that:
- Defined in a theme
- Using a calculated color
๐ Theme defined secondary windows color ๐
Themes have the following entry:
# Message window border foreground and background.
# The background color can be left unset.
# Please refer to the following link for more info
# https://github.com/coderholic/pyradio#secondary-windows-
# background
#
Messages Border #a3b367
It's also possible to define a background color too, like this:
Messages Border #a3b367 #F5DBDE
When you do that, this color becomes the Secondary Windows background color. ๐
You can technically use literally any color here, but for the best visual result it's highly recommended you follow these guidelines:
- The color should be 1โ20% lighter or darker than the "Stations Background" color setting of your theme. ๐จ
You can use this page http://www.workwithcolor.com/hsl-color-picker-01.htm (or one like it) to drop in the base color and then adjust the L component until it's cute. A terminal alternative is pastel (https://github.com/sharkdp/pastel), which you can use like this:
pastel color '#fbf1f2' # show color info
pastel lighten .1 '#fbf1f2' # color lightened by 10%
pastel darken .1 '#fbf1f2' # color darkened by 10%
- If the Stations Background color is dark, make a lighter version of it. If it's light, make a darker version. ๐
Ngl though, this is just a recommendation โ honestly just grab a color that combines well with the existing ones (border foreground, stations foreground and active station). ๐ซถ
This info is technically about creating a new pyradio theme, but it's super important to understand how the calculated background color works. iykyk. โจ
๐ Calculated secondary windows color ๐
By default, pyradio uses the same background color for all windows โ that's the case as long as the theme you're using doesn't define a Messages Border background color.
So if you want a Messages Border background color that's different from the Stations background color, and the selected theme doesn't define one, there's a config option for you: "Calculated color". ๐
This config option takes a value between 0 and 0.2.
- If it's 0, no color change happens at all.
- Otherwise, the value acts as a percentage (a factor) telling pyradio how much the luminance of the Stations background color should change to produce the new background color. ๐
Here's how that actually works: pyradio calculates the Stations background color's perceived brightness, which tells it whether the color is dark or light. Then, depending on that, it adds or subtracts factor percent from its luminance value.
Finally, it checks whether this new color is too close to the Messages Border foreground color, and re-adjusts it as possible. ๐ง
๐ Optional Calculated Color in a Theme ๐
Another way to get a different background color for secondary windows is to just provide one right in the theme file itself. Like so:
# Luminance Color Factor
# The factor to lighten or darken Stations background
# color, to get a calculated color used as background
# for secondary windows
# Valid values: 0 - 0.2
Color Factor 0.05
In this case, the value you provide (i.e. 0.05) gets used exactly the same way as the config option "Calculated color".
And fr fr, if both a theme factor value and a config factor value are provided, the value from the theme wins. ๐
Note โ If the "Messages Border" theme option provides both a foreground and a background, both of the calculated values get ignored. ๐
Note โ When a calculated background color is in use, pressing ~ (tilde) toggles it on and off. This setting stays valid until pyradio terminates, or until a new theme is loaded. ๐ฅ
๐ฆ User themes ๐ฆ
Bestie, you can easily make your own themes! Use CSS color names (https://www.cssportal.com/css3-color-names/) as a resource, then:
- Copy (and rename) one of the System Themes into the user's themes folder. This folder might not exist yet โ you have to create it in the pyradio config directory (
~/.config/pyradio). ๐ธ
To get access to the System Themes, run these commands:
cd `python -c 'import site; print(site.getusersitepackages())'`
cd pyradio/themes
(you may have to use python2 or python3 instead of plain python, depending on your OS and distribution).
- Customize it however you want. ๐จ
- Load it from the Theme selection window โ it'll show up under "User Themes". โจ
๐ Converting old themes ๐
An old theme (the old format, bestie) can be easily converted to the new format using the script found at this gist (https://gist.github.com/s-n-g/65aa6ae12e135481bf3a503ece4e92d2).
Note: To get the color that was actually intended, you must use the same palette that was used when the original theme was created. ๐
๐ Using Transparency ๐
For pyradio, transparency means a theme's background actually disappears, effectively making it display whatever is on the terminal (color / picture / transparency). The visual result depends on your terminal settings and whether a compositor is running. โจ
Not every theme looks good with transparency ON, so themes can now declare whether they want to use transparency or not. This is the transparency variable of the theme, and it can have these values:
0โ means the theme will be opaque (no transparency).1โ means the theme will be transparent.2โ2means the theme looks good either way (the default), and the global transparency setting value (defined in the pyradio config file) will be used. ๐ฆ
Heads up: this behavior changed since v. 0.9.2.7 โ theme transparency will always be honored, regardless of the global config value. ๐ญ
Which means: a theme set to be transparent (by its creator) will always be transparent, no matter if global transparency is on or off. Same energy the other way โ if a theme is set to be opaque, it stays opaque regardless of the global transparency value.
The only time global transparency comes into play is when the theme doesn't care about it (theme transparency set to 2 โ Obey config setting). ๐
Since v. 0.9.2.14, you can also force the use of the Transparency setting โ that's the "Force Transparency" configuration option. When enabled, it effectively makes all themes behave as if their transparency setting was set to 2 (Obey config setting). ๐ฅ
โญ Updating themes automatically โญ
Terminal users have been using all kinds of software to change / update / adapt their terminal colors and palettes, like ibASE16 (https://github.com/chriskempson/base16), pywal (https://github.com/dylanaraps/pywal), wpgtk (https://github.com/deviantfero/wpgtk), theme.sh (https://github.com/lemnos/theme.sh), just to name a few. ๐
pyradio can now "watch" a given theme for changes and update its colors whenever the theme changes. ๐
To set a theme up for auto update, just open the Theme Selection window, navigate to a theme under User Themes and press c. To create a user theme, follow the procedure in section User themes. ๐
Consequently, the default theme name will be preceded by:
*โ if the theme is the default one (the way it's always been).-โ if the theme is the default one, and pyradio will watch it for changes. โจ
๐ง Using Project Themes ๐ง
pyradio can use (and watch) the output of certain projects that modify terminal colors. ๐
pyradio will detect these projects (programs installed and initialized) and add them under the Ext. Themes Projects section of the Themes Selection Window. ๐
If loading any of these themes fails, the default dark theme will be loaded โ but unlike a local theme being invalid, the selection will persist (so the theme gets loaded whenever it becomes available). ๐
Currently, these are the supported projects:
- base16
Thanks to the wonderful work by user edunfelt (https://github.com/edunfelt), there's now a pyradio base16 (https://github.com/base16-project) template in place, and themes have been produced based on the project (there are more than 900 themes available). ๐คฏ
This implementation adds four entries in the theme selection menu (with alternative and variant forms of the main theme).
Then any of those themes can either be activated or watched โ in which case pyradio will download and apply the corresponding theme. ๐ฅ
Using the themes without base16
In case you want to use any of these themes but not install or use base16 (https://github.com/base16-project), you can grab them from this repo (https://github.com/edunfelt/base16-pyradio), and use the cycle_themes.py and install_themes.py scripts to inspect and install them. ๐ซถ
- pywal
When detected, two themes get added to the menu โ the main one and the alternative form. โจ
Since these themes are generated on the fly as the wallpaper changes, there's no way to use them if pywal (https://github.com/dylanaraps/pywal) isn't in use. ๐ญ
Note: If pywal themes are activated but not watched, the theme will be corrupted when the wallpaper changes, and will have to be manually reloaded. So, itโs better to just always watch these themes. ๐ญ
3. theme.sh
When detected, four themes will be added to the menu; the main and the alternative forms (there are 400 plus themes available, which makes a stuggering number of around 1800 themes for pyradio!). ๐
Using the themes without theme.sh
In case one wants to use any of these themes, but not install or use theme.sh (https://github.com/lemnos/theme.sh), one can download this repo (https://github.com/s-n-g/theme-sh-pyradio), and use the create_themes.sh script to create the themes, and cycle_themes.py and install_themes.py scripts to inspect and install them. โจ
๐ฑ๏ธ MOUSE SUPPORT ๐ฑ๏ธ
Okay so, bestie, being a console application, pyradio was never intended to work with a mouse. No cap.
Furthermore, when using the mouse on a console application, the result is highly dependent on the terminal used and the way it implements mouse support. Itโs giving terminal main character energy, honestly.
Having said that, and since the question of using the mouse with pyradio has been risen, basic mouse support has been implemented; starting, stopping and muting the player, scrolling within the playlist and adjusting the playerโs volume is now possible using the mouse. ๐ซถ
All one has to do is enable mouse support in the โConfig Windowโ (mouse support is disabled by default) and restart pyradio for the change to take effect.
Then, the mouse can be used as follows:
- Click โ Change selection.
- Double click โ Start / stop the player.
- Middle click โ Toggle player muting (does not work with all terminals).
- Wheel โ Scroll up / down.
- Shift-Wheel โ Adjust volume (does not work with all terminals).
๐ TITLE LOGGING ๐
Version 0.8.9.17 adds to pyradio the ability to log the titles displayed at the bottom of its window, in a log file, for refference. Iconic, honestly.
The logger, which works independantly from the degub function, is actually a Rotating File Handler (https://docs.python.org/3/library/logging.handlers.html#logging.handlers.RotatingFileHandler), configured to write up to 5 files of around 50KB each (parameters maxBytes=50000 and backupCount=5).
The way this works, according to the documenataion, is that one โcan use the maxBytes and backupCount values to allow the file to rollover at a predetermined size. When the size is about to be exceeded, the file is closed and a new file is silently opened for output. Rollover occurs whenever the current log file is nearly maxBytes in lengthโฆ When backupCount is non-zero, the system will save old log files by appending the extensions โ.1โ, โ.2โ etc., to the filename. For example, with a backupCount of 5 and a base file name of app.log, you would get app.log, app.log.1, app.log.2, up to app.log.5. The file being written to is always app.log. When this file is filled, it is closed and renamed to app.log.1, and if files app.log.1, app.log.2, etc. exist, then they are renamed to app.log.2, app.log.3 etc. respectively.โ
The function can be enabled:
- using the
-lt(--log-titles) command line parameter, or - by pressing
"W"while in the Main, the Playlist or the Register mode.
The titles are written in a file called pyradio-titles.log which is saved at pyradio configuration directory.
Log file sample:
Apr 18 (Mon) 13:12 | >>> Station: Lounge (Illinois Street Lounge -
SomaFM)
Apr 18 (Mon) 13:12 | Jack Costanzo - La Cumparsa, Harlem
Nocturne
Apr 18 (Mon) 13:14 | Don Baker Trio - Third Man Theme
Apr 18 (Mon) 13:16 | Gillian Hills - Un Petit Baiser
Tagging a title
An extra functionality is made possible because of โtitlesโs loggingโ: tagging a title (something like liking a song). Obsessed with this little feature, fr fr. ๐
The idea is that the user plays a station and hears a song he likes and want to look it up later. With this functionality, he can tag the song (make a note in the log file), so he can refer to it at a later time.
To tag a title, one has to press the w key.
Then, if titlesโs logging is already enabled, the log file will have an entry similar to the one shown below:
Apr 18 (Mon) 13:39 | Tom Russell - Bus Station
Apr 18 (Mon) 13:40 | Tom Russell - Bus Station (LIKED)
If titleโs logging is not enabled, it will be turned on, the song will be tagged and logging will be turned off again:
Apr 18 (Mon) 15:38 | === Logging started
Apr 18 (Mon) 15:38 | >>> Station: Folk (Folk Forward - SomaFM)
Apr 18 (Mon) 15:38 | Lord Huron - Lullaby
Apr 18 (Mon) 15:38 | Lord Huron - Lullaby (LIKED)
Apr 18 (Mon) 15:38 | === Logging stopped
๐ ONLINE RADIO DIRECTORY SERVICES ๐
pyradio supports the following Online Radio Directory services:
RadioBrowser โ https://www.radio-browser.info/
This is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible.
For more information please refer to the relevant man page: pyradio_rb(1).
To access supported services, just press "O" at the programโs main window. Periodt. ๐
๐ DESKTOP NOTIFICATIONS ๐
pyradio can provide Desktop Notifications when a notification daemon is already present (on Linux and BSD).
The behavior and presentation of notifications greatly depends on the daemon/service and command line utility used to trigger a notification.
If enabled, pyradio will display:
- The playlist name, when playback starts.
- Song info (as provided by the radio station). That means that if the radio station does not provide any info, no notification will be issued.
- Connection failure messages.
- Player crash messages.
Configuration
Desktop Notifications are disabled by default. To enable them, go to pyradio config window and customize the โEnable notificationsโ option.
Available values are:
-1: disabled (deault)0: enabled (no repetition)x: enabled and repeat everyxseconds
pyradio supports notifications repetition, so that even when used with quake or yakuake and the like, you still have some info on whatโs going on with it.
Notifications can be set to repeat every "x" seconds, with "x" ranging from 30 to 300 (30 seconds to 5 minutes), in 30 seconds steps.
Notification Icon
The icon that is displayed in the notification message is by default pyradio icon.
pyradio will search for this icon, named pyradio.png (or pyradio.ico on Windows) in the following locations:
- In the configuration directory, under
data(orHelpfolder on Windows). - In the distribution directory (under the
iconsfolder). As a consequence, one could replace the icon found in the configuration directory (underdataorHelp) with a custom icon, preserving the icon name as appropriate (pyradio.png, orpyradio.icoon Windows).
If the station defines a Station Icon URL (either on a local playlist or an online service; RadioBrowser includes an icon for many stations, for example), pyradio will used this one instead, provided that it is of JPG or PNG format.
On Linux
On Linux (and the BSDs), pyradio uses the notification daemon thatโs already present and whatever command line helper program it provides to send notifications to the daemon.
By default, pyradio uses the following command to issue notifications:
notify-send -i ICON TITLE MSG
This command will:
- display the title
"TITLE"and message"MSG". - display an icon (
-i).
The "ICON", "TITLE" and "MSG" tokens are just placeholders; pyradio will replace them with real data when issuing the notification.
If that does not work for you, or you want to customize the output, this is what to do:
- put together a valid command that can be executed on a terminal and produce the desired notification.
- create a file called
notificationinpyradioconfiguration directory. - write the above command in that file and put each field in a different line.
Example
I have this custom command:
notify-send -i ICON -t 6000 TITLE MSG
The file I wrote is ~/.config/pyradio/notification:
notify-send
-i
ICON
-t
6000
TITLE
MSG
On MacOS
MacOS Maverick (and later) provides a scripting service to issue notifications from the command line.
The command pyradio uses is:
osascript -e 'display notification "MSG" with title "TITLE"'
If that does not work for you, or you want to display the icon as well, just install terminal-notifier:
brew install terminal-notifier
After it is installed, write the following in ~/.config/pyradio/notification:
terminal-notifier
-message
MSG
-title
TITLE
-appIcon
ICON
and you are done! ๐
๐ฅ๏ธ Desktop File ๐ฅ๏ธ
okay so pyradio will install a Desktop File under ~/.local/share/applications. iconic behavior, honestly.
Note: The system wide Desktop File will probably be under/usr/share/applicationsor/usr/local/share/applications.
By default, this Desktop File will add a โpyradioโ entry under the "Internet" category (or menu), and will execute pyradio no matter if the directory it resides in is the PATH or not, using the default terminal that the system uses. main character energy fr fr ๐
In case of a local installation, when a system wide installation also exists, the entry will display "PyRadio - Local" to distinguish itself from the system wide "PyRadio" one. the way thatโs actually thoughtful ๐ญ
Note: If the TERMINAL variable is set, the Desktop File will use that instead.
๐ฅ๏ธ Specifying the terminal to use ๐ฅ๏ธ
If a specific terminal has to be used, using the --terminal command line option is the way to go:
pyradio --terminal kitty
This command will set the terminal in the Desktop file, so that:
Exec=kitty -e pyradio
To have pyradio try to find a suitable terminal, execute:
pyraio --terminal auto
To restore the original functionality (specifying no terminal):
pyradio --terminal none
๐๏ธ Specifying pyradio parameters ๐๏ธ
If a pyradio parameter has to be present in the Desktop File, use the --terminal-param command line option:
pyradio --terminal none --terminal-param "_p 2"
This command will use no specific terminal and will pass the -p 2 (play station No 2 automatically) parameter to pyradio. To pass such a parameter, substitute all hyphens with underscores. lowkey a little spell, but it slays โจ
๐ Session Locking ๐
pyradio uses session locking, which actually means that only the first instance executed within a given session will be able to write to the configuration file. periodt.
Subsequent instances will be โlockedโ. This means that the user can still play stations, load and edit playlists, load and test themes, but any changes will not be recorded in the configuration file. ngl, thatโs the vibe: you can play, but the config file is not taking notes ๐
๐ Session unlocking ๐
If for any reason pyradio always starts in locked mode, one can unlock the session, using the --unlock command line parameter. bestie, thatโs your escape hatch ๐ซถ
๐ Update Notification ๐
pyradio will periodically (once every 10 days) check whether a new version has been released. lowkey attentive ๐
If so, a notification message will be displayed, informing the user about it and asking to proceed with updating the program (provided this is not a distribution package). iykyk.
๐งน Cleaning Up ๐งน
pyradio will uninstall all previously installed versions when updated (using the -U command line parameter), so no extra steps are needed any more to house keep your system. no cap, itโs giving self-cleaning icon โจ
๐ Debug Mode ๐
Adding the -d option to the command line will instruct pyradio to enter Debug mode, which means that it will print debug messages to a file. This file will always reside in the user's home directory and will be named pyradio.log. meticulous queen ๐
In case of a bug or a glitch, please include this file to the issue you will open in github at https://github.com/coderholic/pyradio/issues. fr fr, it helps so much.
๐ Reporting Bugs ๐
When a bug is found, please do report it by opening an issue at github at https://github.com/coderholic/pyradio/issues, as already stated above. donโt be shy, bestie ๐
In your report you should, at the very least, state your pyradio version, python version and method of installation (built from source, AUR, snap, whatever). the details matter, okay?
It would be really useful to include ~/pyradio.log in your report. literally the receipts.
To create it, enter the following commands in a terminal:
$ rm ~/pyradio.log
$ pyradio -d
Then try to reproduce the bug and exit pyradio.
Finally, include the file produced in your report. slay the bug report process ๐๐ฅ
๐ซถ Acknowlegement ๐ซถ
pyradio uses code from the following projects:
- CJKwrap (
https://gitlab.com/fgallaire/cjkwrap) by Florent Gallaire โ A library for wrapping and filling UTF-8 CJK text. - ranger (
https://ranger.github.io/) โ A console file manager with VI key bindings. - Vifm (
https://vifm.info/) โ A file manager with curses interface, which provides a Vi[m]-like environment.
not me being obsessed with the collaboration timeline ๐ญ๐
๐ Files ๐
/usr/share/doc/pyradio/README.html/usr/share/doc/pyradio/build.html/usr/share/doc/pyradio/radio-browser.html/usr/share/doc/pyradio/windows.html/usr/share/doc/pyradio/windows-mplayer.html/usr/share/licenses/pyradio/LICENSE
Note: On Mac OS, these files may be installed in /usr/local/share/doc/pyradio, depending on whether or not SIP is enabled.
๐ Authors ๐
- Ben Dowling (
https://github.com/coderholic) โ Origianl author ๐ญ - Kirill Klenov (
https://github.com/klen) โ (2012) - Laurent Stacul (
https://github.com/stac47) โ (2013) - Peter Stevenson (2E0PGS) (
https://github.com/2E0PGS) โ (2018) - Spiros Georgaras (
https://github.com/s-n-g) โ (2018-2024)
You can see a complete list of contributors at https://github.com/coderholic/pyradio/graphs/contributors.
the whole squad ate ๐ ๐
๐ Special thanks ๐
- edunfelt (
https://github.com/edunfelt), for her wonderful work on base16 themes (https://github.com/edunfelt/base16-pyradio), and ideas regarding theming and such. - amano-kenji (
https://github.com/amano-kenji), for his valuable suggestions and bug reports.
genuinely iconic contributions, no notes ๐
๐ See also ๐
pyradio_rb(1)โ RadioBrowser Implementationpyradio_rec(1)โ Recording stationspyradio_server(1)โ Remote Control Serverpyradio-client(1)โ Remote Control Client
๐ Thatโs the whole page, bestie! Source/version: pyradio ยท date: June 2024 ยท manual: pyradio(1) โจ๐ป
๐ฆ where this page comes from
- opensuse-leap 16.0: pyradio 0.9.3.9-bp160.1.10 ยท MIT
- Copyright (C) 2011 Ben Dowling <http://www.coderholic.com/pyradio>
- Copyright (C) 2018-2024 Spiros Georgaras <sng@hellug.gr>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms