Created
January 27, 2015 07:55
-
-
Save eggc/e6a51a8ebcd61d4cbe85 to your computer and use it in GitHub Desktop.
cue, img -> mp3
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/bash | |
| # img , cue があるディレクトリでこのスクリプトを実行すると mp3 で抽出する。 | |
| # 予め bchunk, lame をインストールする必要がある。brew を使うと楽。 | |
| IMG_NAME=(*.img) | |
| CUE_NAME=(*.cue) | |
| BASE_NAME=${IMG_NAME%.*} # cut extension | |
| # ${IMG_NAME[@]} と書くのは、空白文字を許すため。 | |
| if [ -f "${IMG_NAME[@]}" ] && [ -f "${CUE_NAME[@]}" ] | |
| then | |
| # bchunk コマンドで img と cue を結合して wav で出力する。 | |
| bchunk -w "$IMG_NAME" "$CUE_NAME" "$BASE_NAME" | |
| # lame コマンド で wav を mp3 に変換する。 | |
| for WAV_FILE in *.wav | |
| do | |
| lame -b256 -h "$WAV_FILE" | |
| rm "$WAV_FILE" | |
| done | |
| mkdir "$BASE_NAME" | |
| mv *.mp3 "$BASE_NAME" | |
| else | |
| echo "*.cue and *.img are not found." | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment