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 hidden or 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 (afrendeiro@gmail.com) | |
| # 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 |
Author
Thanks! It was 12 years ago, so yeah Python 3 wasn't very popular - and it was back in the good times I used local music files
Thanks to you! Just glad to have someone do the hard work on the script, even if it was a dozen years ago. Still using music files, streaming gives me the sweats haha.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant! Python changed print syntax. Change line 35 to:
And it works flawlessly!