Post by aemaeth on Apr 7, 2011 23:33:07 GMT -5
I use pianobar to listen to music from pandora.com
Pianobar is an amazing cli tool made by someone, from somewhere!
This script also requires UrlSnarf which is in the "dsniff" packages.
You only need to use pandora.com (WHICH IS REALLY GOD AWFUL AND SHOULD NEVER BE USED BY HUMANS, THAT JAVA WILL SUCK UP RESOURCES LIKE IT'S MY EX) to make an account (which is free, they do offer premium, but it's worthless from what i can tell) and to maybe add a station to it.
first you need to make a "pianobar" folder in your ~/.config/ so the directory will be ~/.config/pianobar/
you put this file in as "config" filling in username/password and the autostart station, which running pianobar regularly will give you the long string of digits for the station ID. I guess you don't HAVE to do this, but it helps.
then you run this in the directory you want your growing music collection in (Note, please change "wlan0" to whatever you use for internet port) This has to run with sudo, urlsnarf requires it...:
Now you're ready to start the special pianobar script that will extract the name of the music, and also give you the url to download it with.
You can # out echo "$songname" and echo "$artist" those were mostly for troubleshooting purposes. Someone suggested the idea that cut might not work on some systems, but a friend confirmed that it worked in arch.
If you can get this to work in one shell, then that would be awesome, otherwise run both and you're automatically downloading music freely distributed by pandora.com
Pianobar is an amazing cli tool made by someone, from somewhere!
This script also requires UrlSnarf which is in the "dsniff" packages.
You only need to use pandora.com (WHICH IS REALLY GOD AWFUL AND SHOULD NEVER BE USED BY HUMANS, THAT JAVA WILL SUCK UP RESOURCES LIKE IT'S MY EX) to make an account (which is free, they do offer premium, but it's worthless from what i can tell) and to maybe add a station to it.
first you need to make a "pianobar" folder in your ~/.config/ so the directory will be ~/.config/pianobar/
you put this file in as "config" filling in username/password and the autostart station, which running pianobar regularly will give you the long string of digits for the station ID. I guess you don't HAVE to do this, but it helps.
user =
password =
audio_format = mp3
autostart_station =
then you run this in the directory you want your growing music collection in (Note, please change "wlan0" to whatever you use for internet port) This has to run with sudo, urlsnarf requires it...:
#!/bin/bash
#flv download
urlsnarf -n -i wlan0 "libwaitress" | while read line; do echo "$line"| grep -v 'Wget' | sed -e 's/^.*\"GET //' -e 's/.HTTP.*//' ; done | while read url;
do
read filename < name.txt
( wget -O "$filename" -nc -U 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13' $url &)
done
Now you're ready to start the special pianobar script that will extract the name of the music, and also give you the url to download it with.
#!/bin/bash
#Download pianobar streams
pianobar | while read line
do
echo "$line"
if echo "$line" | grep "by"
then
songname=`echo "$line" | cut -s -d \" -f2`
artist=`echo "$line" | cut -s -d \" -f4`
echo "$songname"
echo "$artist"
echo "$artist - $songname.mp3" > name.txt
fi
done
You can # out echo "$songname" and echo "$artist" those were mostly for troubleshooting purposes. Someone suggested the idea that cut might not work on some systems, but a friend confirmed that it worked in arch.
If you can get this to work in one shell, then that would be awesome, otherwise run both and you're automatically downloading music freely distributed by pandora.com