Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scripts I wrote to manage my music collection
#!/usr/bin/env bash
# Wrap FLAC files in an OGG wrapper (.oga file).
# Deletes the original flac file after verifying that the oga file matches.
# For safety all warnings are treated as errors (and prevent deletion of flac files).
#
# WARNING: Does not prompt before overwriting `.oga' files.
#
# Examples:
#
# $ flac2ogg flacfile.flac
# -> flacfile.oga
#
# $ find ~/Music -name "*.flac" -type f -print0 | xargs -0 flac2ogg
# -> Converts all FLAC files in the music directory tree
args=("$@")
for ((i=0; i < $#; i++)) {
flac --decode-through-errors --force --verify --delete-input-file -w --best --ogg "${args[$i]}"
}
#!/usr/bin/env bash
# Recursively rename all *.oga files in the current tree to .ogg
#
# WARNING: This will rename everything in the current tree. Don't run at `/'.
find -L . -type f -name "*.oga" | while read FNAME; do
mv "$FNAME" "${FNAME%.oga}.ogg"
done
#!/usr/bin/env bash
# Recursively rename all *.ogg files in the current tree to .oga
#
# WARNING: This will rename everything in the current tree. Don't run at `/'.
find -L . -type f -name "*.ogg" | while read FNAME; do
mv "$FNAME" "${FNAME%.ogg}.oga"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment