Skip to content

Instantly share code, notes, and snippets.

@funkyremi
Last active January 20, 2017 08:40
Show Gist options
  • Save funkyremi/d1c1a58185645519fa409543c00dc341 to your computer and use it in GitHub Desktop.
Save funkyremi/d1c1a58185645519fa409543c00dc341 to your computer and use it in GitHub Desktop.
This script lets you play music (internet radio) from you terminal.
#!/bin/bash
# This script lets you play music from you terminal.
# 1) Install mplayer
# 2) chmod +x music
# 3) Put 'music' script in a folder on your PATH.
# 4) Enjoy ;)
if [ -z $1 ]; then
echo "Usage:"
echo "$0 <style | stop>"
echo "Play rock music: $0 rock"
echo "Stop music: $0 stop"
echo "Available styles: classic, old, alternative, easy, electro, folk, jazz, metal, pop, rap, reggae, rock, soundtrack"
exit 0
fi
ARG=$1
case $ARG in
"classic") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=22146 > /dev/null 2>&1&;;
"old") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1462509 > /dev/null 2>&1&;;
"easy") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1392941 > /dev/null 2>&1&;;
"electro") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=47007 > /dev/null 2>&1&;;
"folk") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1475332 > /dev/null 2>&1&;;
"jazz") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=709809 > /dev/null 2>&1&;;
"metal") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1404695 > /dev/null 2>&1&;;
"pop") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=830692 > /dev/null 2>&1&;;
"rap") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=492072 > /dev/null 2>&1&;;
"reggae") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1391499 > /dev/null 2>&1&;;
"rock") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1101040 > /dev/null 2>&1&;;
"soundtrack") nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1263172 > /dev/null 2>&1&;;
"stop") killall mplayer;;
*) nohup mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1101040 > /dev/null 2>&1&;; #Rock is default
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment