dotfiles/.local/bin/scripts/qobuz

17 lines
551 B
Bash
Executable File

#!/bin/sh -ex
target="${1:-$PWD}"
cd $DATA/5*
mkdir -p qobuz
cd qobuz
tar xf ../Qobuz-commandes.tar
mv -v ../*.jpg . || true
cd ..
mv -v qobuz $target/ #$d4/music/Worship/
rm -i Qobuz-commandes.tar
cd $target/qobuz
find -type d -exec sh -c 'test $(ls "{}" | wc -l) -eq 1 && find "{}" -maxdepth 1 -type f | xargs -i% mv -v % .' \;
find -type d -empty -delete
formatsongs
find -maxdepth 1 -name "*.jpg" -exec sh -c 'mv -v "{}" "$(echo {} | rev | cut -d"/" -f1 | rev | cut -d"-" -f1-2 | tr -s "-" " " | xargs -i% find -type d -iname "%*")/"' \;
exec zsh