tty_radio

Linux/OS X RESTful player for online radio streams, like SomaFM and WCPE. Comes with a terminal UI flavored with colors and ASCII art and web UI for remote management.


Keywords
radio, somafm, streaming, mpg123
License
Other
Install
pip install tty_radio==1.1.2

Documentation

Streaming Radio Terminal Client

No more Flash or awkward browser windows consuming memory in order to pipe in your jams. tty_radio supports manual entries you want to import as well as auto-generated entries from SomaFM.

This package wraps your favorite terminal based audio stream player (like mpg123). It provides a RESTful API to control stream selection and playback. Includes a simple text based UI to select stations: banners autogenerated with pyfiglet, and (optionally) album thumbnails converted to ASCII with Pillow. Also serves a web UI at http://localhost:7887, for remote management.

On the road map:

  • Plugin architecture to easily add station specific scrapers

Install

  • Verify you have mpg123
    • else change stream.mpg123.subp_cmd to your fav player
    • Whatever you choose must not buffer output
    • For OS X, macports: port install mpg123
    • For Linux, apt: sudo apt-get install mpg123
  • Optionally, if you want to display album art
    • pip install pillow
  • pip install tty_radio
    • This adds radio to your path

Usage

  • radio
  • Defaults to a list of favorite channels
    • Auto-generated from a hardcoded value
    • Edit ~/.tty_radio-favs.csv to add/remove
    • Any changes are permanent (it's not auto updated)
  • Select the station to listen to by typing its number (left column) and pressing Enter
  • There are other views:
    • At the bottom of the list is a SomaFM view
      • Auto-generated from web scraping updated if more than 7 days old
      • Edit ~/.tty_radio-soma.csv to add/remove, but you will loose changes on next update
    • The Di.FM view has been removed since they've blocked direct streaming

Older docs

#########################################
##### Dependencies
# For finding channel links from websites, req beautifulsoup4
# For ascii banners of station/stream names, req pyfiglet
# For ascii art of stream album art, req pillow
# Examples of the ascii fun below:
"""
 _______                      _______ ___ ___  _______                        
|   _   .-----.--------.---.-|   _   |   Y   ||       .--.--.-----.-----.----.
|   1___|  _  |        |  _  |.  1___|.      ||.|   | |  |  |     |  -__|   _|
|____   |_____|__|__|__|___._|.  __) |. \_/  |`-|.  |-|_____|__|__|_____|__|  
|:  1   |                    |:  |   |:  |   |  |:  |                         
|::.. . |                    |::.|   |::.|:. |  |::.|                         
`-------'                    `---'   `--- ---'  `---'                         
  ______                   _______ _______    _______                      
 / _____)                 (_______|_______)  (_______)                     
( (____   ___  ____  _____ _____   _  _  _       _ _   _ ____  _____  ____ 
 \____ \ / _ \|    \(____ |  ___) | ||_|| |     | | | | |  _ \| ___ |/ ___)
 _____) ) |_| | | | / ___ | |     | |   | |     | | |_| | | | | ____| |    
(______/ \___/|_|_|_\_____|_|     |_|   |_|     |_|____/|_| |_|_____)_|    

 _______                                 _______         __           __ 
|     __|.----.-----.-----.--.--.-----. |     __|.---.-.|  |.---.-.--|  |
|    |  ||   _|  _  |  _  |  |  |  -__| |__     ||  _  ||  ||  _  |  _  |
|_______||__| |_____|_____|\___/|_____| |_______||___._||__||___._|_____|


>>> Groove Salad: a nicely chilled plate of ambient beats and grooves. [SomaFM]
>>> Minot - The Cycle Of Venus
8 8888      8 8888      88    d888888o.   8 8888        8 
8 8888      8 8888      88  .`8888:' `88. 8 8888        8 
8 8888      8 8888      88  8.`8888.   Y8 8 8888        8 
8 8888      8 8888      88  `8.`8888.     8 8888        8 
8 8888      8 8888      88   `8.`8888.    8 8888        8 
8 8888      8 8888      88    `8.`8888.   8 8888        8 
8 8888      8 8888      88     `8.`8888.  8 8888888888888 
8 8888      ` 8888     ,8P 8b   `8.`8888. 8 8888        8 
8 8888        8888   ,d8P  `8b.  ;8.`8888 8 8888        8 
8 888888888888 `Y88888P'    `Y8888P ,88P' 8 8888        8 

Press enter if you like banner, else any char then enter 
>>> Lush: Mostly female vocals with an electronic influence. [SomaFM]
>>> Miaow - Tempered Song

http://ice.somafm.com/cliqhop, cliqhop idm, Blips'n'beeps backed mostly w/beats. Intelligent Dance Music.
----------------------------------------------------------------------
-----------------KA ----------- ---------------------------------~=---
-----   -  ))  A-  W      (-  M                 ------------=A-   -- ~
---+M  =- ~A  MK  [(  ]   A      M   ]  K]  -   ]--------K          -(
---M  KK- A) -A  ]K  MK  A- [K   ~ -W[  M   M  ) --AMW*K --         -K
 --  [KWW MWMMMWK- (K[  MAAMKWKKK (KKW- ~ (MA[( --]          =][)  -=-
M((]~[[+  -]) ------](()- ------*----- A]]( +-)[)M     -+K)=    - - (-
[W]------[-KMW-)W-~-------------------------M- )-     K    [-   K ]A--
---------------~-A- W] ------------------- ] *=     -      (   ] M-~ =
--------------------W K[-=-------------------M-    -      (   ( (* ~+-
-----------------------W ( )----------------M     -   K  [   MW+  M-+K
------------------------ -+(W)+------------M     ) ( ]  [   (K    =-K-
--------------------------- [](-M--------+*        W  W   ~]] -  ][(--
------------------------------([) (--------[(     )[-    = A](  [A)K--
M[ ------------------------------] W=----)W)]-A        -M=-M  ) (K)A--
K-M--------------------------------A A- [==-~- WM     ~-++**~-W+] (](M
M([ K --------------(~([]-----------+M*K]   *==+  M  ]-*~~*++A-]-=[*))
--- M] K+ --~-M  =][][[(][)- [)([=---(~]       -=*--=-]---------------
------(M= [((--*------------- -(] *[~(    ]) WA    ()~ M--------------
-----------W[*--(]--------------- W]+[   ]        W+  + --------------
------------+~](AM~K-------------W  -   -           ] [---------------
--------------*( W ~[[)---------W                 - )W([[~-*----------
--------------- WA W) =------- M      -M          *=-[~[([-*][]- --(=-
----------+(-(--- *[= ++------K        (        ]M [----------------* 
-------- M( *A+][KW)(M=[-[ (~)             (M  [  K-A[ ---------------
------WK K (-      -K(----(A](]=M(             - M -A(~A [~-----------
---- AA-A=+ -[K)-[+A( -----W     -))[  ([~](    A ----- -[+]][[~- -[+-
-~A K  -*--[K]---- [--------]          -([A))( -[)-----~=([AM(=M~)]W* 
---A* W~ M+W--------[+M ----[ AW[              [--W  -*+(K=W--K[M[-([-
      WM- A         +(- K  ) -+=- [MA-       W+    AMWWKA  [  WM])    
----------       -     +--~- ~ +**~~~+--***-~-- * ~-- -----K(+W -[-]-+
-+- +]])]))()()]-W)       -]- =  --+-      --*~ +- =---* ]])])))(]]) ]
  (]])([)])[*   -    )[]--      ~ -- +--= ==+- =- =- *- )]))[=-       
][]))(( -A             )[)+-     ~ -+= *--- -~ *=~=+ ~~ - K))[])((*~=-
  A]][[) --*-----=~++]]+(]]]+*[ *  - ~~--   --~*+* +=* ~~ -- -)])[([))
"""