15 lines
393 B
Bash
15 lines
393 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
ls media/*\ -\ *.mp3 | while read line ; do
|
||
|
UUID=$(./jukebox/node_modules/.bin/uuid v4)
|
||
|
echo "mv \"$line\" \"media/$UUID\""
|
||
|
|
||
|
FILE=$(basename "$line" ".mp3")
|
||
|
set -- $FILE
|
||
|
|
||
|
TAG=${@:1:1}
|
||
|
LABEL=${@:3}
|
||
|
echo "INSERT INTO tags (tag) VALUES (\"$TAG\");" 1>>/dev/stderr;
|
||
|
echo "INSERT INTO library (tag, label, uuid) VALUES (\"$TAG\", \"$LABEL\", \"$UUID\");" 1>>/dev/stderr;
|
||
|
done
|