Skip to content

olavfosse/eradio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 

Repository files navigation

https://melpa.org/packages/eradio-badge.svg

Synopsis

eradio is a simple Internet radio player for Emacs.

The public interface consists of three functions and three variables.

Functions

  • eradio-play prompts you for a channel to play.
  • eradio-stop stops the player.
  • eradio-toggle stops the player if a song is playing. Otherwise it plays the previous played channel. If no songs have been played so far it prompts for a channel in the same way as eradio-play.

Variables

  • eradio-channels is an alist of radio channel names and their URLs.
  • eradio-player is a list of the media player and its arguments.
  • eradio-current-channel is the currently, or previously, played radio channel. It is used by eradio-toggle to determine what channel to play.

Installation

The package is available in the Melpa repository.

Doom

;; ~/.doom.d/packages.el
(package! eradio)

use-package

;; ~/.emacs.d/init.el
(use-package eradio
  :ensure t)

Media player

eradio requires an external media player such as VLC or mpv. The command to be used is determined by the eradio-player variable. The head of eradio-player is the program and the tail is the arguments. The default command uses VLC from the exec-path variable(which may differ from $PATH), but it can be customized to use mpv, VLC.app or alternatively set to use something else entirely.

To use VLC.app, customize eradio-player to vlc-mac or set it to ("/Applications/VLC.app/Contents/MacOS/VLC" "--no-video" "-I" "rc"). To use mpv, customize eradio-player to mpv or set it to ("mpv" "--no-video" "--no-terminal")

Keybindings

eradio does not bind any keys by default. Therefore you should bind them yourself. The following snippets are just suggestions. You can of course use any keybindings you would like.

Doom

;; ~/.doom.d/config.el
(map! :leader (:prefix ("r" . "eradio") :desc "Play a radio channel" "p" 'eradio-play))
(map! :leader (:prefix ("r" . "eradio") :desc "Stop the radio player" "s" 'eradio-stop))
(map! :leader (:prefix ("r" . "eradio") :desc "Toggle the radio player" "t" 'eradio-toggle))

Vanilla

;; ~/.emacs.d/init.el
(global-set-key (kbd "C-c r p") 'eradio-play)
(global-set-key (kbd "C-c r s") 'eradio-stop)
(global-set-key (kbd "C-c r t") 'eradio-toggle)

Radio channels

eradio comes without any radio channels by default, but here are some of my favorites.

;; ~/.doom.d/config.el or ~/.emacs.d/init.el
(setq eradio-channels '(("def con - soma fm" . "https://somafm.com/defcon256.pls")          ;; electronica with defcon-speaker bumpers
                        ("metal - soma fm"   . "https://somafm.com/metal130.pls")           ;; \m/
                        ("cyberia - lainon"  . "https://lainon.life/radio/cyberia.ogg.m3u") ;; cyberpunk-esque electronica
                        ("cafe - lainon"     . "https://lainon.life/radio/cafe.ogg.m3u")))  ;; boring ambient, but with lain

If you are looking for more channels I encourage you to check out the SomaFM catalog. They have a lot of good channels of all genres and aesthetics. Needless to say I am not associated with SomaFM.

Troubleshooting

Some VLC ports are incapable of playing Internet radio. This seems to be the case with OpenBSD’s port. To verify that your vlc installation works run vlc --no-video -I rc <radio-channel> for example vlc --no-video -I rc https://somafm.com/defcon256.pls. Be aware that it might take some seconds before the audio starts. That is expected. A possible solution to this problem is to instead use mpv, which works as expected on OpenBSD too.

About

The simple radio player for GNU Emacs

Resources

License

Stars

Watchers

Forks