Damus
menherahair :redeyeorb:  profile picture
menherahair :redeyeorb:
@nprofile1q... basically the user radio in My Summer Car has to be supplied vorbis encoded files named track${n}.ogg so it's a pain to add or remove tracks even given your collection is already vorbis encoded
so I toss my files in $inputdir, have script find them cached or reencode and cache with the hashed filename, then hardlink in $outputdir with the right filename. so I can easily use my file manager for editing my radio like a normal person. I'll welcome any better ideas

#!/bin/bash
#

[[ -d "in" ]] || exit 1
mkdir -vp "out" "cache" || exit 1
rm out/*

j=1
for i in in/*; do
n="out/track$((j++)).ogg"
h="cache/$(sha1sum <<< $i).ogg"

if [[ -f "$h" ]]; then
ln -v "$h" "$n"

elif [[ "$i" =~ ogg$ ]]; then
cp -v "$i" "$h" && ln -v "$h" "$n"

else
ffmpeg \
-i "$i" \
-acodec libvorbis \
-vn \
-b:a 128k \
-frame_duration 60 \
"$h" &&
ln -v "$h" "$n"

fi
done