[library_works] remove obsolete opus
This commit is contained in:
parent
ef79128f12
commit
a6f13eb046
16
encode_all
16
encode_all
@ -8,8 +8,8 @@ function ts() {
|
|||||||
date '+%Y-%m-%d_%H:%M'
|
date '+%Y-%m-%d_%H:%M'
|
||||||
}
|
}
|
||||||
|
|
||||||
overwrite_all=true
|
# overwrite_all=true
|
||||||
# overwrite_all=false
|
overwrite_all=false
|
||||||
debug_only=false
|
debug_only=false
|
||||||
# debug_only=true
|
# debug_only=true
|
||||||
|
|
||||||
@ -20,12 +20,12 @@ logdir="${HOME}/encoding_logs"
|
|||||||
start_ts="$(ts)"
|
start_ts="$(ts)"
|
||||||
log="${logdir}/${start_ts}_encoding_log"
|
log="${logdir}/${start_ts}_encoding_log"
|
||||||
fixes="${logdir}/${start_ts}_fixes.sh"
|
fixes="${logdir}/${start_ts}_fixes.sh"
|
||||||
|
temp_dir="$(mktemp -d)"
|
||||||
|
|
||||||
printf '#!/bin/bash\n# FIXES generated by library_works/encode_all\n\n' > "$fixes"
|
printf '#!/bin/bash\n# FIXES generated by library_works/encode_all\n\n' > "$fixes"
|
||||||
|
|
||||||
function encode() {
|
function encode() {
|
||||||
file="$1"
|
file="$1"
|
||||||
|
|
||||||
# file is full original path + filename
|
# file is full original path + filename
|
||||||
src_dir="$(dirname "$file")"
|
src_dir="$(dirname "$file")"
|
||||||
file_name="$(basename "$file")"
|
file_name="$(basename "$file")"
|
||||||
@ -34,6 +34,8 @@ function encode() {
|
|||||||
-e 's/\.flac$/.opus/' \
|
-e 's/\.flac$/.opus/' \
|
||||||
-e "s_${HOME}/flac_${HOME}/opus_" <<< "$file")"
|
-e "s_${HOME}/flac_${HOME}/opus_" <<< "$file")"
|
||||||
|
|
||||||
|
sum="$(sha256sum <<< "$final_opus" | cut -d\ -f1)"
|
||||||
|
printf '%s\n' "$final_opus" > "$temp_dir/$sum"
|
||||||
if [[ -f "$final_opus" && "$overwrite_all" == 'false' ]]; then
|
if [[ -f "$final_opus" && "$overwrite_all" == 'false' ]]; then
|
||||||
printf '%s exists, not reencoding\n' >> "$log"
|
printf '%s exists, not reencoding\n' >> "$log"
|
||||||
return
|
return
|
||||||
@ -146,4 +148,12 @@ function encode() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo going to process
|
||||||
find "$src_library" -type f -name '*.flac' -print0 | env_parallel -P 0 -0 --bar encode {}
|
find "$src_library" -type f -name '*.flac' -print0 | env_parallel -P 0 -0 --bar encode {}
|
||||||
|
echo done processing
|
||||||
|
|
||||||
|
diff -d --suppress-common-lines <(cat "$temp_dir"/* | sort -V) <(find "$output_dir" -type f | sort -V) | grep -E '^>' | sed 's/^> //' | while read old_opus; do
|
||||||
|
rm -f "$old_opus"
|
||||||
|
done
|
||||||
|
|
||||||
|
find "$output_dir" -empty -type d -delete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user