#!/bin/bash # The user must enter a target game directory if [ -z "$1" ] ; then echo "usage: ./download_mp3s.sh [gamedir] where [gamedir] is the XXX: http://bluelaguna.net/music/XXX/mp3s.php e.g. ./download_mp3s lodost" exit 1 fi gamedir="$1" tmp_html='/tmp/html_data_slkdfj' wget -q -O $tmp_html "http://bluelaguna.net/music/$1/mp3s.php" sleep 1 # just making sure the wget output buffers are done... :| # This is the line that contains the MP3 links :) # p = print # q = quit # d = delete line lineout=`cat $tmp_html | sed -e '/rectangle/{p ; q}; d'` # Put each mp3 on its own line mp3junklist=`echo "$lineout" | sed -e 's/\.mp3/.mp3\n/g'` # Clean out the garbage mp3list=`echo -n "$mp3junklist" | sed -e '/\.mp3$/ {s,.*/\(.*\.mp3\)$,\1, ; s/+/%20/g ; p} ; d' | uniq` for i in $mp3list ; do target="http://delta.bluelaguna.net/$gamedir/$i" echo "Fetching: $target" wget -q $target done #http://delta.bluelaguna.net/lodost/*.mp3