#!/bin/sh

usage() {
	cat <<EOF
usage: $(basename $0) [playlist.m3u] [directory]

[directory] is where you want the files to end up
EOF
	exit 1
}

[ -n $1 ] || usage
[ -n $2 ] || usage

playlist="$1"
directory="$2"

mkdir -p "$directory"

files="$(grep 'file://' "$playlist")"
echo $files
for i in $files; do
	cp -v "$(echo "$i" | cut -c 8- -)" "$directory/"
	# "echo "$i" | cut -c 8-" deletes file://
done
