Created
April 23, 2016 04:09
-
-
Save rixtox/8506f18f30ec003a6824494adfae5930 to your computer and use it in GitHub Desktop.
Revisions
-
rixtox created this gist
Apr 23, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/bin/zsh # ------------------------------------------------------------------ # [Rix] Bemuse.ninja BMS Convertor # Converts the Japanese encoded BMS and reorder folders. # ------------------------------------------------------------------ VERSION=0.1.0 SUBJECT=bemuse USAGE="Usage: bemuse DIR" ORANGE='\033[0;33m' NC='\033[0m' # --- Option processing -------------------------------------------- if [[ $# == 0 ]] ; then echo $USAGE exit 1; fi INPUT_DIR="$1" find "$INPUT_DIR" -maxdepth 1 -type f -name "*.bme" \ -exec printf "Processing ${ORANGE}{}${NC}\n" \; \ -exec sh -c 'iconv -f CP932 -t UTF-8 "{}" | sed -e '\''s/^\(\#WAV[[:alnum:]]\+\)[[:space:]]*.*[\\\/]\([^\\\/]\+\.[[:alnum:]]\+\)$/\1 \2/gmi'\'' | tee "{}" &> /dev/null ' \; printf "${ORANGE}Moving files...${NC}\n" mv -f "$INPUT_DIR"/*/* "$INPUT_DIR"/ find "$INPUT_DIR"/* -maxdepth 0 -type d \ -exec printf "Deleting folder ${ORANGE}{}${NC}\n" \; \ -exec rm -rf "{}" \;