dotfiles/.local/bin/scripts/qobuz

19 lines
683 B
Plaintext
Raw Normal View History

2023-03-31 17:09:55 +00:00
#!/bin/sh -ex
2023-04-27 12:28:04 +00:00
# Execute in target directory or with that as parameter
2023-03-31 17:09:55 +00:00
target="${1:-$PWD}"
2023-04-27 12:28:04 +00:00
archive=$(find $DATA/5* -maxdepth 2 -name Qobuz-commandes.tar)
cd $(dirname "$archive")
2023-04-07 17:31:59 +00:00
mkdir -p qobuz
cd qobuz
tar xf ../Qobuz-commandes.tar
mv -v ../*.jpg . || true
cd ..
mv -v qobuz $target/ #$d4/music/Worship/
2023-03-31 17:09:55 +00:00
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