You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
742 B
Plaintext
24 lines
742 B
Plaintext
6 years ago
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
6 years ago
|
#
|
||
|
# this script compresses everything in $source and saves it in $destination
|
||
|
#
|
||
|
|
||
6 years ago
|
source="$HOME/kskcloud/Musik/"
|
||
6 years ago
|
export destination="$HOME/Musik.tiny/"
|
||
6 years ago
|
|
||
6 years ago
|
cd "$source"
|
||
6 years ago
|
|
||
6 years ago
|
# create directory structure
|
||
|
find . -type d -exec mkdir -p "$destination/{}" \;
|
||
6 years ago
|
|
||
6 years ago
|
# copy existing files
|
||
6 years ago
|
find . -type f -and \( -name '*.mp3' -or -name '*.ogg' -or -name '*.m4a' -or -name '*.opus' \) -exec cp -a --reflink=always "{}" "$destination/{}" \;
|
||
6 years ago
|
|
||
6 years ago
|
# set +e because ffmpeg errors on .jpg, .txt, etc.
|
||
6 years ago
|
# compress with mp3
|
||
6 years ago
|
set +e
|
||
5 years ago
|
find . -type f -not -name '*.mp3' -not -name '*.ogg' -not -name '*.m4a' -not -name '*.opus' | parallel --eta --progress 'nice -n19 ffmpeg -v 0 -n -i ""{}"" -c:a mp3 -b:a 320 -map_metadata 0 ""$destination/{.}.mp3""'
|
||
6 years ago
|
#set -e
|