Skip to content

Instantly share code, notes, and snippets.

@psd
Created December 27, 2017 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psd/dbfc26f476a28150b52c1c13c64db1c2 to your computer and use it in GitHub Desktop.
Save psd/dbfc26f476a28150b52c1c13c64db1c2 to your computer and use it in GitHub Desktop.
#!/bin/bash
awk -F' ' \
-v artist="Underworld" \
-v album="Everything Everything" \
'BEGIN {
total=0;
n=0;
}
{
n++;
split($3, tm, ":");
track = $2;
start = sprintf("%02d:%02d:%02d.000", (total / 3600), (total/60) % 60, total %60)
secs = tm[1]*60 + tm[2]
total = total + secs
filename = sprintf("%02d.mp3", n)
cmd = sprintf("ffmpeg -loglevel panic -n -ss %s -i full.mp3 -max_muxing_queue_size 100000 -t %s %s", start, secs, filename);
print(cmd);
system(cmd);
cmd = sprintf("mid3v2 -a \"%s\" -A \"%s\" -T %s -t \"%s\" \"%s\"", artist, album, n, track, filename)
print(cmd);
system(cmd);
}' <<-!
1 Juanita/Kiteless 11:23
2 Cups 3:58
3 Push Upstairs 7:29
4 Pearls Girl 8:58
5 Jumbo 8:33
6 Shudder/King of Snake 12:17
7 Born Slippy .NUXX 10:56
8 Rez/Cowgirl 11:47
!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment