2022 06 01


Tags: music apps
Reading time: less than 1 minute

I’ve been listening to SomaFM on and off for almost 10 years. In this time I’ve used various methods to listen; from their web player to shell scripts that run mplayer with their station URLs.

I wanted to make a bite-sized project that involved making a GUI application for Linux, so I thought “why not a SomaFM player?”. For the GUI library, I picked PySimpleGUI. It seems to be a wrapper around Tcl/Tk.

=> https://github.com/PySimpleGUI/PySimpleGUI

Since I wanted to do it properly, nothing was hard-coded. I used the SomaFM API at https://somafm.com/channels.xml. This URL provides up-to-date information about all of their stations; station and DJ names, currently playing songs, listener counts and URLs that can be used to listen live.

The player supports multiple “backends” for playing audio. The following commands are tried in this order, before giving up.

  • mpv –no-video $URL
  • ffplay -nodisp $URL
  • clvc $URL
  • vlc $URL

Since ffplay comes with ffmpeg, I imagine this will cover a large range of distros that can use this application.

You can find the code at this URL.

=> https://github.com/gkbrk/scripts/blob/master/somafm.py

Citation

If you find this work useful, please cite it as:
@article{yaltirakli,
  title   = "2022 06 01",
  author  = "Yaltirakli, Gokberk",
  journal = "gkbrk.com",
  year    = "2024",
  url     = "https://www.gkbrk.com/journal/2022-06-01"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation
Gokberk Yaltirakli, "2022 06 01", November, 2024. [Online]. Available: https://www.gkbrk.com/journal/2022-06-01. [Accessed Nov. 12, 2024].
APA Style
Yaltirakli, G. (2024, November 12). 2022 06 01. https://www.gkbrk.com/journal/2022-06-01
Bluebook Style
Gokberk Yaltirakli, 2022 06 01, GKBRK.COM (Nov. 12, 2024), https://www.gkbrk.com/journal/2022-06-01

Comments

© 2024 Gokberk Yaltirakli