Ubuntu Pastebin

Paste from at Thu, 19 Mar 2015 13:54:57 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env bash

USAGE="$0: /path/to/APEFile"
if [ $# -lt 1 ]; then echo -e "Error: Ensure that you're supplying the path to your .APE file.\n$USAGE" >&2; exit 1; fi

file=$1

tracks=`gawk -vRS="TRACK" 'END {print NR-1}' "$file"`

shnsplit -f "$file" -o "flac flac -V --best -o %f -" "$1" -t "%n - %t" 2>&1 | \
gawk -vvar=$tracks 'NR>=1 && NR<=var {print "#Track ",NR," of ", var;print (NR-1)*100/var};{fflush();}' | \
(if $(zenity --title="Splitting Tracks..." --progress --auto-close --percentage=0);
then
	echo 'done'
else
	killall shnsplit
exit 1
fi)
Download as text