diff options
Diffstat (limited to 'cli')
-rwxr-xr-x | cli/ape2mp3.sh | 111 | ||||
-rwxr-xr-x | cli/cueape2flac.sh | 71 |
2 files changed, 0 insertions, 182 deletions
diff --git a/cli/ape2mp3.sh b/cli/ape2mp3.sh deleted file mode 100755 index d9cf6d6..0000000 --- a/cli/ape2mp3.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh - -### ### -# For APE & CUE file --> Mp3 # -# Version : 0.20 # -# This script build high quality mp3 from APE. # -# You just run it in the dir include APE & CUE file. # -# # -# Author : kevin.li823@gmail.com # -### ### - -echo Lame is the best mp3 encoder! -export APE_FILE=`ls *.[aA][pP][eE]` -export CUE_FILE=`ls *.[cC][uU][eE]` -export WAV_FILE=${APE_FILE%ape}wav -export UTF_CUE_FILE='UTF.cue' - -ALBUM= -CD_ACTOR= -GENRE= -DATE=2000 -ACTOR= -TRACK= -TITLE= - -# Tools have been Installed -which dos2unix >/dev/null 2>&1 || (echo No dos2unix in System; exit ) -which mac >/dev/null 2>&1 || (echo No mac in System; exit ) -which bchunk >/dev/null 2>&1 || (echo No bchunk in System; exit ) -which iconv >/dev/null 2>&1 || (echo No iconv in System; exit ) -which lame >/dev/null 2>&1 || (echo No lame in System; exit ) - -# DOS -> Unix -dos2unix $CUE_FILE - -# GBK -> UTF8 -iconv -f gbk -t utf8 $CUE_FILE > $UTF_CUE_FILE - -# Monkey's Audio Codec, ape -> wav -echo Decoding APE file, it may take a few minutes. -echo Please wait... -mac $APE_FILE $WAV_FILE -d -echo "APE --> WAV Complete! " - -# Split wav with cue file -echo "Start to split wav! " -bchunk $WAV_FILE $CUE_FILE -w wav_ -echo "Splitting Done" - -# Scan Album's Information -ALBUM=`grep 'TITLE' $CUE_FILE|sed -n '1p'|awk -F \" '{print $2}'|\ - sed s/\ /_/g` -UTF_ALBUM=`grep 'TITLE' $UTF_CUE_FILE|sed -n '1p'|awk -F \" '{print $2}'|\ - sed s/\ /_/g` -CD_ACTOR=`grep 'PERFORMER' $CUE_FILE|sed -n '1p'|awk -F \" '{print $2}'|\ - sed s/\ /_/g` -GENRE=`grep ^REM $CUE_FILE|awk '{print ($2, $3)}'|grep ^GENRE |sed -n '1p'|\ - awk '{print $2}'|\sed s/\ /_/g` -DATE=`grep ^REM $CUE_FILE|awk '{print ($2, $3)}'|grep ^DATE |sed -n '1p'|\ - awk '{print $2}'|\sed s/\ /_/g` -# Add Album's Information to CMD line -[ -n $ALBUM ] && CD_INFO="--tl ${ALBUM} " -[ -n $GENRE ] && CD_INFO="${CD_INFO}""--tg ${GENRE} " -[ -n $DATE ] && CD_INFO="${CD_INFO}""--ty $i{DATE}" - -for i in `ls wav_*` -do - # Scan Songs' Information - TRACK=`echo $i|sed s/wav_//g|sed s/.wav//g` - TITLE=`sed -n "/TRACK[\ \ ]"$TRACK"/,$"p $CUE_FILE|grep TITLE|\ - sed -n '1p'|awk -F \" '{print $2}'|sed s/\ /_/g` - UTF_TITLE=`sed -n "/TRACK[\ \ ]"$TRACK"/,$"p $UTF_CUE_FILE|grep TITLE|\ - sed -n '1p'|awk -F \" '{print $2}'|sed s/\ /_/g` - ACTOR=`sed -n "/TRACK[\ \ ]"$TRACK"/,$"p $CUE_FILE|grep PER|\ - sed -n '1p'|awk -F \" '{print $2}'|sed s/\ /_/g` - - # Add Actor to CMDline if possible - [ -z $ACTOR ] && ACTOR=$CD_ACTOR - - # Add Songs' Information to CMD line - [ -n $TITLE ] && NAME=`echo $TRACK\_$UTF_TITLE.mp3` - [ -n $TRACK ] && LAME_INFO=" --tn $TRACK " - [ -n $TITLE ] && LAME_INFO="$LAME_INFO --tt $TITLE " - [ -n $ACTOR ] && LAME_INFO="$LAME_INFO --ta $ACTOR " - LAME_INFO="${LAME_INFO} --tc Made_by_Kevin_Li" - - echo - echo "========== Now Laming $UTF_TITLE ==========" - - #lame -b 32 -m j -h -V 0 -B 320 -q 0 --noath -k --id3v2-only --tt\ - # $TITLE --ta $ACTOR --tl $ALBUM --tc Made_by_Kevin_Li --tn\ - # $TRACK $i $NAME - - # Now Lame the Songs - lame -b 32 -m j -h -V 0 -B 320 -q 0 --noath -k --id3v2-only \ - $CD_INFO $LAME_IMFO $i $NAME - - LAME_INFO= - - echo "========== Lame $UTF_TITLE Done! ==========" - echo -done - -# File Arrangement -[ -n `ls *.mp3` ] && rm *.wav -rm $UTF_CUE_FILE -mkdir \[$ACTOR_$UTF_ALBUM\_MP3\] -mv *.mp3 \[$ACTOR_$UTF_ALBUM\_MP3\] -echo -echo "===================== All Done! =======================" -[/code] diff --git a/cli/cueape2flac.sh b/cli/cueape2flac.sh deleted file mode 100755 index 7022f04..0000000 --- a/cli/cueape2flac.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# PS4="##### " -# convert APE with cue file to FLAC tracks - -selection=`zenity --title="请选择一个.ape文件和一个.cue文件" --file-selection --multiple` -if [ -z "$selection" ]; then exit 0; fi -if [[ "$selection" != *.ape\|*.cue && "$selection" != *.cue\|*.ape ]]; then exit 0; fi -if [ `echo $selection | gawk -F "|" 'END {print NF}'` -ge 3 ]; then exit 0; fi - -arg1=${selection%|*}; arg2=${selection#*|} -if [[ "$arg1" == *.ape ]];then file_ape=$arg1; file_cue=$arg2 -else file_ape=$arg2; file_cue=$arg1; fi - -i=0 -while [ -f "temp$i" ]; do -i=$(($i+1)) -done -> temp$i -iconv -f gb18030 -t utf8 "$file_cue" > "temp$i" && mv "temp$i" "$file_cue" -rm -f "temp$i" - -tracks=`gawk -vRS="TRACK" 'END {print NR-1}' "$file_cue"` -#echo $tracks - -all_titles=`gawk -vRS='TRACK' -vFS='\n' \ -'{j=0;for(i=1;i<=NF;i++){if($i~/TITLE/){print $i;j=1}}};j==0 {print "TITLE \"#####\""}' "$file_cue" | \ -gawk -F "\"" 'NR>=2 {printf("%s|",$2)}'` - -j=1; while [ -n "$all_titles" ]; do -title=${all_titles%%|*} -artist=${all_artists%%|*} -num=`printf "%0${#tracks}d" $j` -rm -f "${num}.$title.flac" -((j++)) -all_titles=${all_titles#*|} -all_artists=${all_artists#*|} -done - -shntool split -f "$file_cue" -t '%n.%t' -o flac "$file_ape" 2>&1 | \ -gawk -vvar=$tracks 'NR>=1 {print "#正在转换...";print (NR-1)*100/var};{fflush();}' | \ -zenity --title="进度" --text="正在转换..." --progress --auto-kill --auto-close - -all_titles=`gawk -vRS='TRACK' -vFS='\n' \ -'{j=0;for(i=1;i<=NF;i++){if($i~/TITLE/){print $i;j=1}}};j==0 {print "TITLE \"#####\""}' "$file_cue" | \ -gawk -F "\"" 'NR>=2 {printf("%s|",$2)}'` - -all_artists=`gawk -vRS='TRACK' -vFS='\n' \ -'{j=0;for(i=1;i<=NF;i++){if($i~/PERFORMER/){print $i;j=1}}};\ -j==0 {print "PERFORMER \"#####\""}' "$file_cue" | gawk -F "\"" 'NR>=2 {printf("%s|",$2)}'` - -album=`gawk -vRS='TRACK' -vFS='\n' \ -'{j=0;for(i=1;i<=NF;i++){if($i~/TITLE/){print $i;j=1}}};j==0 {print "TITLE \"#####\""}' "$file_cue" | \ -gawk -F "\"" 'NR==1 {printf("%s",$2)}'` - -j=1; while [ -n "$all_titles" ]; do -title=${all_titles%%|*} -artist=${all_artists%%|*} -num=`printf "%0${#tracks}d" $j` -if [ "$title" != "#####" ]; then metaflac --set-tag=TITLE="$title" "${num}.$title.flac"; fi -if [ "$artist" != "#####" ]; then metaflac --set-tag=ARTIST="$artist" "${num}.$title.flac"; fi -if [ "$album" != "#####" ]; then metaflac --set-tag=ALBUM="$album" "${num}.$title.flac"; fi -metaflac --set-tag=TRACKNUMBER="$j" "${num}.$title.flac" -#if [ "$title" != "#####" ]; then mv "${num}.$title.flac" "${num:1}.$title.flac" -#else mv "${num}.$title.flac" "${num:1}.NoTitle.flac"; fi -((j++)) -all_titles=${all_titles#*|} -all_artists=${all_artists#*|} -done - -zenity --info --text="结束。" -exit 0 |