‰ cat download-tracks
#!/bin/zsh
# Usage: $0 'The One Electronic'
mkdir -p "$1" || exit 1
cd "$1" || exit 1
for u in `Xtract '*div/small/a/@href' <(curl -s "http://www.last.fm/music/${1// /+}/+tracks" | sed -e '/<!–\[if IE\]/d' | tidy -asxml 2>/dev/null | cat -v) | urldecode | urldecode`; do
wget "$u" -O "${${u##*/}+/ }"
done
‰ cat num
#!/bin/bash
i=0
for f in "$@"; do
mv "$f" "`printf '%04d' "$i"` $f"
: $(( i+=1 ))
done