Local

..:: Home
..:: Legal
..:: Contact
..:: About
..:: RSS
..:: Log in

Links

..:: Fake Bill Gates
..:: Tap the Hive

A Random Quote

"One individual always has the answers to our problems. One is always there when called upon. No mortal can deter this individual. This person is you! You can overcome any obstacle. You can overpower any enemy. You can solve any problem. You can bypass any restriction. You can break any barrier. You can conquer any battle. You can destroy any fortress. You can pass any test. You can surpass any master. You can exceed all expectations. You can win any game. You can create a masterpiece. You can make anything work. You can outsmart anybody. You can do the impossible. You influence everyone around you,changing the world forever. Noting would be the same with you. Because... You are Mighty."

MP3 Cue Splitter: splitall.sh

The purpose of this script is to take all cue files in a directory and split all mp3 files with matching names to the cue files into smaller mp3s based on the title and times of the mp3 in the cue file. since some DJ’s actually use the PERFORMER tag in cue files, the script automatically looks for the performer tag and adjusts as necessary.

For example, I download DJ GT’s latest release from generation trance. His latest release might be comprised of 3 or 4 sets. If I burn the mp3s straight to CD, I have a single 80 minute track, which sucks. If I burn the CD based on the cue file, there might happen to be a couple songs I don’t like on the set. So, I just run splitall.sh and I get some 40 mp3s to check out.

You may need to extend your repositories, but it’s in there.

sudo apt-get install mp3splt

Here’s the script:

#!/bin/bash
#############
# splitall 2006.3.21
# by david loschiavo
#
# REQUIRES: mp3split
# Put this script somewhere in $PATH like /usr/bin.
# if you run the script with no args, it will split all mp3s based
# on their matched name cues in the current directory.
# you can also pass arg1 as a directory to pull cues/mp3s and split there.
#
# assuming u put the script somewhere in $PATH, some examples are
#    splitall.sh
#             splits all cue/mp3 in the present working directory
#    splitall.sh somedir
#             splits all cue/mp3 in somedir
#
# if you do not put the script in $PATH, you will need to use:
#
#    ./splitall.sh
#             splits all cue/mp3 in the present working directory
#    ./splitall.sh somedir
#             splits all cue/mp3 in somedir
#
#############

echo "splitall.sh: v2006.3.21 by David Loschiavo "
echo "splitall.sh: read beginning of script for help"

if [[ $1 != "" ]]
then
        OLD_DIR=$PWD
        cd $1
else
        echo “splitall.sh: no args specified, executing in present working directory”
fi

has_mp3splt=`whereis mp3splt`
if [[ $has_mp3splt == "mp3splt:" ]]
then
        echo “splitall.sh: Sorry, but this script requires mp3splt, and it could not be located.”
        echo “splitall.sh: Make sure it is in $PATH or try one of these:”
        echo “splitall.sh:   Gentoo: emerge mp3splt”
        echo “splitall.sh:   Ubuntu: sudo apt-get install mp3splt”
        echo “splitall.sh:   Debian: apt-get install mp3splt”
        echo “splitall.sh:   Other: get a better distro and reformat”
        exit 0
fi

for file in *.cue
do
        if [[ $file == "*.cue" ]]
        then
                echo “splitall.sh: no cue files found, exiting”
                exit 0
        fi
        title_length=`expr ${#file} - 4`
        title=${file:0:$title_length}
        perf_count=`grep -i PERFORMER “${title}.cue” | wc -l`
        if [[ $perf_count > 1 ]]
        then
                mp3splt -o “@p - @t” -c “${title}.cue” “${title}.mp3″
        else
                mp3splt -o “@t” -c “${title}.cue” “${title}.mp3″
        fi
done

if [[ $1 != "" ]]
then
        cd $OLD_DIR
fi

echo “splitall.sh: splitting completed”
exit 0

Leave a Reply