Page 1 of 1

Song Fight download script

Posted: Sun Jan 10, 2010 3:48 pm
by Manhattan Glutton
This code is pretty old and probably embarrassing since I wrote it many years ago, and there may be other better utilities out there, but I thought I'd share this anyway. Might be helpful to someone... somewhere... for some reason.

It's a PHP command-line script. It will work under linux/unix, and probably Windows or Windows/Cygwin as long as you have PHP installed.

It downloads all mp3s and playlist.m3u to current directory/formatted_song_name/

USAGE:
songfight
Will prompt you which song you want to download this week (it used to be compatible with the multiple songs per week paradigm, but that code's commented out).

songfight -t "Back to the Well"
Will download the song "Back to the Well"

songfight -l back_to_the_well
If my formatting doesn't work on the title for some reason, you can put in the URL-safe formatted name of the song.

Right click -> Save As

Re: Song Fight download script

Posted: Sun Jan 10, 2010 7:49 pm
by irwin
I just do:

mkdir this_week_fight
cd this_week_fight
wget http://www.songfight.org/music/this_wee ... aylist.m3u
wget -i playlist.m3u
rm playlist.m3u

(If I leave the playlist.m3u in there my player picks it up and I get two copies of every song, one local, one from the playlist)

Could wrap it up into a shell script and auto transform the title, I suppose. In OSX, replace wget with curl (and change the flags accordingly), or just install wget.

Re: Song Fight download script

Posted: Sun Jan 10, 2010 7:55 pm
by roymond
I just use DownThemAll! in Firefox.

Re: Song Fight download script

Posted: Sun Jan 10, 2010 8:09 pm
by Manhattan Glutton
irwin wrote:I just do:

mkdir this_week_fight
cd this_week_fight
wget http://www.songfight.org/music/this_wee ... aylist.m3u
wget -i playlist.m3u
rm playlist.m3u

(If I leave the playlist.m3u in there my player picks it up and I get two copies of every song, one local, one from the playlist)

Could wrap it up into a shell script and auto transform the title, I suppose. In OSX, replace wget with curl (and change the flags accordingly), or just install wget.
Well, that's a hell of a lot less complicated. I didn't even know wget had that option.

Re: Song Fight download script

Posted: Sun Jan 10, 2010 8:40 pm
by Lunkhead
I listen to the songs in Firefox at http://www.bozos.com/sf/fights/current since I generally only like a couple of songs enough to bother downloading them.

Re: Song Fight download script

Posted: Sun Jan 10, 2010 9:15 pm
by irwin
irwin wrote: mkdir this_week_fight
cd this_week_fight
wget http://www.songfight.org/music/this_wee ... aylist.m3u
wget -i playlist.m3u
rm playlist.m3u

In OSX, replace wget with curl (and change the flags accordingly), or just install wget.
Since Ross asked, in OSX, I do:

curl -O (drag 'steam all' link from the fight page into the terminal. This pastes the URL). *enter*
for i in `cat playlist.m3u`; do
curl -O ${i}
done

I do not know of the curl option to feed it a file containing a list of URLs (the equivalent of wget's -i option).

Re: Song Fight download script

Posted: Sun Jan 10, 2010 9:35 pm
by Ross
I found a cool drag and drop for mac. Just download the .m3u and drag it onto the application's icon and it grabs all teh files

m3u2mp3

http://www.macupdate.com/info.php/id/24220

Re: Song Fight download script

Posted: Sun Jan 10, 2010 9:40 pm
by Manhattan Glutton
Lunkhead wrote:I listen to the songs in Firefox at http://www.bozos.com/sf/fights/current since I generally only like a couple of songs enough to bother downloading them.
Lunkhead's trying not to fill up the 4GB hard disk in his Packard Bell.

Re: Song Fight download script

Posted: Mon Jan 11, 2010 6:38 am
by jast
Here's another one to download the current fight:

Code: Select all

wget -nd -r -A .mp3 http://www.songfight.org/currentsong.php
rm robots.txt
And here's a shortcut for what irwin pasted for OS X (assuming OS X has 'xargs'... and if it doesn't it's stupid because all BSDs I know have it):

Code: Select all

curl (drag 'stream all' link from the fight page into the terminal) | xargs curl --remote-name-all
That said, I just use DownThemAll!, which also allows me to automatically use the link text in the filename. I don't think wget/curl support that.

Re: Song Fight download script

Posted: Fri Feb 05, 2010 2:04 pm
by fluffy
I guess I never bothered to post my various songfight download+tag scripts so here they are. http://beesbuzz.biz/code/sf-scripts.tar.gz

These days I run them on a Mac (previously I ran them on Linux, and it would probably work fine on Cygwin as well), although there's a bunch of dependencies you'd need to install (wget, id3v2, perl and a bunch of modules for it, etc.). Basically it uses the RSS feed to grab the current week, and then it uses HTML scraping on the full archive to make sure that it's got all the past fights too, and it tags them all in a uniform manner.

For getting the current fight without tagging you could just do this one-liner:

Code: Select all

wget -A mp3 -r -l 1 http://www.songfight.org/
which is how I get less-frequent stuff like remixfight and GOM.

or if you want to be a bit fancier:

Code: Select all

wget -O - http://songfight.org/playlist.m3u | xargs wget -i -
basically the nice thing about this stuff is there's more than one way to do it.

Re: Song Fight download script

Posted: Mon Feb 08, 2010 8:03 am
by signboy
I've been using Web Ripper because I don't like the way code & scripts stare at me. :) I'm pretty sure it's free (I got it off a friend, not the d/l link) and it works pretty slick, for more than just SF.

Re: Song Fight download script

Posted: Sun Aug 08, 2010 11:09 am
by JonPorobil
This is useful, so... *BUMP*