|
|
@ -6,33 +6,17 @@ set -e
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
source="$HOME/kskcloud/Musik/"
|
|
|
|
source="$HOME/kskcloud/Musik/"
|
|
|
|
tmp="$HOME/Musik.tiny/"
|
|
|
|
export destination="$HOME/Musik.tiny/"
|
|
|
|
destination="$HOME/kskcloud/Musik.tiny/"
|
|
|
|
|
|
|
|
placeholder="$destination/a"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf "$tmp"
|
|
|
|
|
|
|
|
mkdir "$tmp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$destination"
|
|
|
|
mkdir -p "$destination"
|
|
|
|
|
|
|
|
|
|
|
|
# create a placeholder to prevent * from failing
|
|
|
|
cd "$source"
|
|
|
|
touch "$placeholder"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# copy original target files and existing files as cache
|
|
|
|
# create directory structure
|
|
|
|
echo 'copying . . .'
|
|
|
|
find . -type d -exec mkdir -p "$destination/{}" \;
|
|
|
|
cp -a --reflink=always "$source/"* "$destination/"* "$tmp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# compress with opus; +e because ffmpeg errors on .jpg, .txt, etc.
|
|
|
|
# set +e because ffmpeg errors on .jpg, .txt, etc.
|
|
|
|
echo 'compressing . . .'
|
|
|
|
# compress with opus
|
|
|
|
set +e
|
|
|
|
set +e
|
|
|
|
find "$tmp" -type f -not -name '*.opus' | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a libopus -map_metadata 0 -b:a 128k ""{.}.opus""'
|
|
|
|
find . -type f -not -name '*.opus' | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a libopus -map_metadata 0 -b:a 128k ""$destination/{.}.opus""'
|
|
|
|
set -e
|
|
|
|
#set -e
|
|
|
|
|
|
|
|
|
|
|
|
# delete all non-opus files
|
|
|
|
|
|
|
|
echo 'deleting . . .'
|
|
|
|
|
|
|
|
find "$tmp" -type f -not -name '*.opus' -delete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# copy compressed files to target destination
|
|
|
|
|
|
|
|
cp -a --reflink=always "$tmp/"* "$destination"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm -r "$tmp"
|
|
|
|
|