Created
September 15, 2013 10:39
-
-
Save afrendeiro/6569589 to your computer and use it in GitHub Desktop.
Command-line conversion of flac+cue files to mp3 split tracks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Flacon-style convert to mp3 and split tracks from flac+cue files | |
# Made by André Rendeiro ([email protected]) | |
# Rename | |
{ | |
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done | |
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done | |
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done | |
} >/dev/null 2>&1 | |
# Find all flac files | |
for file in `find -name '*.flac'`.flac | |
do | |
file=`echo "$file" | sed 's/.flac//g'`; | |
# Convert FLAC to MP3 VBR | |
flac -cd $file.flac | lame -h - -v \ | |
--preset cd $file.mp3 | |
# Split file | |
mp3splt -q -a -c $file.cue -o @n.\ @t $file.mp3 | |
#Remove files | |
rm $file.mp3 | |
rm $file.cue | |
rm $file.flac | |
rm $file.log | |
done | |
for file in `find ./ -iname "*.jpg"` | |
do | |
filename=`basename $file` | |
cap=`echo "$filename" | python -c "print raw_input().capitalize()"`; | |
path=`echo "$file" | sed "s/$filename//"` | |
mv $file `echo "$path$cap"` | |
done | |
# Fix encoding | |
convmv -r --notest -f windows-1255 -t UTF-8 * | |
# Remove stupid files | |
for file in `find ./ -iname "IMPORTANT_NOTE.txt"`; do rm $file; done | |
for file in `find ./ -iname "Thumbs.db"`; do rm $file; done | |
# Rename back | |
{ | |
find . -name '**' | while read file; do target=`echo "$file" | sed 's/_/ /g'`; mv "$file" "$target"; done | |
find . -name '**' | while read file; do target=`echo "$file" | sed 's/_/ /g'`; mv "$file" "$target"; done | |
find . -name '**' | while read file; do target=`echo "$file" | sed 's/_/ /g'`; mv "$file" "$target"; done | |
} >/dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment