Are you too lazy to fire up a full media player, select music tracks or radio station and only then listen to music?
In case you always keep an open terminal, here is a solution for you:
Create a file named radio.py and write:
import random import os PLAY = "mplayer -prefer-ipv4 -playlist " STATIONS = ['http://www.radioswissclassic.ch/live/aacp.m3u', 'http://126.96.36.199/castcontrol/playlist.php?port=8000'] station = random.choice(STATIONS) os.system(PLAY + station)
Append the following two lines in your ~/.bash_aliases file:
alias music='find ~/Music -name *.mp3 > my_playlist.txt; mplayer -quiet -shuffle -playlist my_playlist.txt' alias radio='python ~/scripts/radio.py'
Make sure your ~/.bashrc contains:
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
Given that your music is encoded in mp3 format and is under your ~/Music folder, you can listen to the songs in random order using:
On the other hand, if you like listening to radio stations, you will find yourself listening to a random (from the predefined list) station by writing:
You need mplayer for both functionalities.