Updated mp3blog mp3 grabbing script

I've updated the script so that it now lists the sites visited and tells you what, if any, songs were downloaded from the site. I also tweaked the actual code that does the work a little too so it's probably like .000001 milliseconds faster now.

This thing still looks like a drug abusing monkey jotted it down while he was on the toilet, but it works. I'm sure there are 6000 quicker, less wasteful ways for someone more experienced to code this, but hey, it's only 3 actual lines of code that do all the real work and the rest is cosmetic. You get what you pay for, and in this case you paid for a cheap trick that wears a lot of makeup to hide it's ugliness. All the waste really only accounts for 30 seconds of wait time, which is easily forgotten if you're downloading a lot of mp3s. And it's still a lot faster than visiting all the blogs.

Anyway, the big noticeable change is that after wget does it's thing, you now get output like this:

Site visited: http://villa-straylight.blogspot.com/
Music downloaded:
http://www.eskimo.com/~wage/Mazzy Star - Bells Ring.mp3

Really, it's just echoing the site then if it downloads something it tells you. If the site was offline it would simply not list any songs as downloaded but it would still say it visited the site. Yeah it's dishonest, but if it does grab an mp3, by gum, it'll tell ya. Well, unless you already had that song and the file on the server is no newer. In that case it tells you it downloaded it although it didn't. So don't believe it's evil lies.

Anyway, here it is in all it's glory, fresh from the keyboard of the tmpfile master.

#! /bin/sh

echo 'Visiting blogs.....'
function fetch {
echo ------------------- >> .songtemp
echo Site visited: $1 >> .songtemp
echo Music downloaded: >> .songtemp
lynx -dump $1 | grep "http" | awk '{$1=""; print }' | grep "mp3$\|zip$" | sed 's/^[ \t]*//' >> .songtemp;
cat .songtemp | grep "mp3$\|zip$" >> .tmp

##### ---------------bloglist--------------- #####
fetch http://villa-straylight.blogspot.com/
fetch http://newflux.blogspot.com/
fetch http://tofuhut.blogspot.com/
fetch http://www.mysticalbeast.blogspot.com/
fetch http://www.tangmonkey.com/blogs/music/
fetch http://thenewpink.net/womenfolk/
fetch http://amillionlovesongs.blogspot.com/
fetch http://www.londonlee.com/blog.html/
fetch http://www.sixeyes.blogspot.com/
fetch http://losingmyedge.com/
##### ---------------bloglist--------------- #####

echo 'Checking for new music.....'
cat ./.tmp | sed 's/[ ^t]*$//' | grep -v -f ./.downloaded > .tmp2;
wget -N -T 30 -A.mp3,.zip -i ./.tmp2;
cat .songtemp | grep -v -f ./.downloaded;
cat ./.tmp2 >> ./.downloaded;
rm ./.tmp;
rm ./.tmp2;
rm .songtemp;
echo -------------------
echo Done

<< Home

This page is powered by Blogger. Isn't yours?