bin: beets and qobuz
This commit is contained in:
parent
805e7ffb9c
commit
fc83af639a
|
@ -64,6 +64,25 @@ addalbum() {
|
||||||
unset IFS
|
unset IFS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updatemusic() {
|
||||||
|
for dir in $(find "$MUSIC" -mindepth 1 -maxdepth 1 -type d -name "[A-Z]*")
|
||||||
|
do builtin cd "$dir"
|
||||||
|
find -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read dir
|
||||||
|
do target="$(echo ${dir} | tr -d ' ')"
|
||||||
|
find -maxdepth 1 \( -name "$dir" -o -iname "$(echo ${target} | sed 's/\([a-z]\)\([A-Z][a-z]\)/\1*\2/g')*" \) -not -name "$target" -exec mv -nv {} $target/ \;
|
||||||
|
done
|
||||||
|
done
|
||||||
|
cd "$MUSIC"
|
||||||
|
find -mindepth 4 -type d -not -path '*/Hip-Hop/*' -not -path '*/Movies/*' -not -path '*/LeagueOfLegends/*' -exec sh -c 'mv -vn "{}" "$(echo "{}" | cut -d/ -f2-3)/"' \; -prune
|
||||||
|
find -mindepth 4 -type d -exec sh -c 'test $(find "{}" -type f | grep -vE "(.jpe?g|.png)" | wc -l) -eq 1 && name="$(ls "{}" | grep -vE "(.jpe?g|.png)")" && mv -vi "{}/$name" "$(dirname "{}")/$(echo "$name" | sed "s|^01 ||")" && rm -rv "{}"' \; -prune
|
||||||
|
# TODO delete folders with only images: find -type d -exec sh -c 'test $(find "{}" -type f | grep -vE "(.jpe?g|.png)" | wc -l) -eq 0 && rm -r "{}"' \; -prune
|
||||||
|
find -empty -delete
|
||||||
|
formatsongs
|
||||||
|
printf "=== DONE RENAMING ===\n\n"
|
||||||
|
beet import -AC "$MUSIC"
|
||||||
|
}
|
||||||
|
|
||||||
formatsongs() {
|
formatsongs() {
|
||||||
(
|
(
|
||||||
find -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | formatin
|
find -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | formatin
|
||||||
|
@ -99,7 +118,6 @@ formatsong() {
|
||||||
s/ [[(]\(None\|Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i;
|
s/ [[(]\(None\|Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i;
|
||||||
s/ (\(Acoustic\|Live|.* Remix\))/ [\1]/i;
|
s/ (\(Acoustic\|Live|.* Remix\))/ [\1]/i;
|
||||||
s/ \[\(feat.*\)\]/ (\1)/i;
|
s/ \[\(feat.*\)\]/ (\1)/i;
|
||||||
s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g;
|
|
||||||
s/ \(\..\{2,4\}\)$/\1/;
|
s/ \(\..\{2,4\}\)$/\1/;
|
||||||
s/---/ - /;
|
s/---/ - /;
|
||||||
s/-LLS\././;
|
s/-LLS\././;
|
||||||
|
@ -108,4 +126,5 @@ formatsong() {
|
||||||
s/ \././g;
|
s/ \././g;
|
||||||
s/ / /g;
|
s/ / /g;
|
||||||
s/\(\w\)+\(\w\)/\1 \2/g' -
|
s/\(\w\)+\(\w\)/\1 \2/g' -
|
||||||
|
#s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh -ex
|
||||||
|
# Unpack and sort downloaded qobuz archive
|
||||||
|
# Obsolete through qobuz-dl
|
||||||
|
# Execute in target directory or with that as parameter
|
||||||
|
target="${1:-$PWD}"
|
||||||
|
archive=$(find $DATA/5* -maxdepth 2 -name Qobuz-commandes.tar)
|
||||||
|
cd $(dirname "$archive")
|
||||||
|
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
|
|
@ -1,18 +1,3 @@
|
||||||
#!/bin/sh -ex
|
#!/bin/sh -e
|
||||||
# Execute in target directory or with that as parameter
|
# Wrapper for qobuz-dl
|
||||||
target="${1:-$PWD}"
|
qobuz-dl $(test "$#" -gt 0 && echo dl || echo fun) -q 6 "$@"
|
||||||
archive=$(find $DATA/5* -maxdepth 2 -name Qobuz-commandes.tar)
|
|
||||||
cd $(dirname "$archive")
|
|
||||||
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
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Recursively add replaygain to the given files or from the current directory
|
# Recursively add replaygain to the given files or from the current directory
|
||||||
|
#rsgain custom --album --skip-existing --tagmode=i "${@:-${MUSIC:-.}}"
|
||||||
|
beet replaygain -a -t 4 -w ||
|
||||||
r128gain $(test -f "$1" || echo '--recursive') --skip-tagged --preserve-times 1 "${@:-.}"
|
r128gain $(test -f "$1" || echo '--recursive') --skip-tagged --preserve-times 1 "${@:-.}"
|
||||||
# rsgain custom --album --skip-existing --tagmode=i
|
|
||||||
# Need a find command, call for each album
|
# Need a find command, call for each album
|
||||||
# rsgain easy --skip-existing --multithread=${SPARE_CORES:-3} "${@:-.}"
|
# rsgain easy --skip-existing --multithread=${SPARE_CORES:-3} "${@:-.}"
|
||||||
|
|
Loading…
Reference in New Issue