Skip to content

Instantly share code, notes, and snippets.

@SamWhited
Last active October 8, 2015 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamWhited/3280305 to your computer and use it in GitHub Desktop.
Save SamWhited/3280305 to your computer and use it in GitHub Desktop.
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