X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=mp3chop.sh;h=2f089f5d8d7f2da0960670b7e6b52ca40fefc6ed;hb=adc759eb7fd1a953204347cc00791f89d6c85120;hp=6af88f748945c703e2a69efcf2d34a0359bd01b8;hpb=12759288743bae9510b4403f4f92326acbe25c83;p=cmccabe-bin diff --git a/mp3chop.sh b/mp3chop.sh index 6af88f7..2f089f5 100755 --- a/mp3chop.sh +++ b/mp3chop.sh @@ -40,17 +40,18 @@ shift $(( OPTIND-1 )) mkdir -p "$output_dir" || die "failed to create $output_dir" for file in "$@"; do + bfile="$(basename "${file}")" absfile="$(readlink -f "${file}")" - mkdir -p "${output_dir}/${file}.dir" - pushd "${output_dir}/${file}.dir" &>/dev/null \ - || die "failed to pushd to ${output_dir}/file" + mkdir -p "${output_dir}/${bfile}.dir" + pushd "${output_dir}/${bfile}.dir" &>/dev/null \ + || die "failed to pushd to ${output_dir}/bfile" ln "$absfile" || die "failed to hardlink ${absfile}" - mp3splt -t "${segment_size}" "${file}" \ - || die "mp3splt failed on file ${file}" - rm -f "$file" + mp3splt -t "${segment_size}" "${bfile}" \ + || die "mp3splt failed on file ${bfile}" + rm -f "$bfile" mv * .. cd .. - rmdir "${file}.dir" || die "rmdir ${file}.dir failed" + rmdir "${bfile}.dir" || die "rmdir ${bfile}.dir failed" popd &> /dev/null || die "popd failed" done