-
Notifications
You must be signed in to change notification settings - Fork 0
/
movit
42 lines (42 loc) · 1.25 KB
/
movit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/zsh -e
source="$(find ~nicotine/done/ -mindepth 1 -type d | head -n 1)"
if [[ -z "$source" ]]; then
echo "Nothing to do!"
exit 0
fi
artist="$(metaflac --show-tag=artist $source/*([1-9]-|\ )01\ *.flac)"
artist="${artist#artist=}"
artist="${artist#ARTIST=}"
dir=($(ls -d /music/*/"$artist" || :))
if [[ -z "$dir" ]]; then
echo "I don't know the artist $artist, where do you want to put 'em."
while :; do
printf "\e[;9G[4]ad [H]ipHop [J]azz [K]lassiek [M]etal [P]op [S]oundtracks [N]ew"
read -sk1 answer
case $answer in
4)
dir="/music/4ad/$artist"; break ;;
h)
dir="/music/HipHop/$artist"; break ;;
j)
dir="/music/Jazz/$artist"; break ;;
k)
dir="/music/Klassiek/$artist"; break;;
m)
dir="/music/Metal/$artist"; break ;;
p)
dir="/music/Pop/$artist"; break ;;
s)
dir="/music/Soundtracks/$artist"; break ;;
n)
dir="/music/New/$artist"; break ;;
esac
done
mkdir -p $dir
echo
fi
set -x
rsync -v --info=progress2 --partial -rlptD "$source" "$dir"
set +x
chmod -R g-w "$dir"
rm -rf "$source"