recordings
This commit is contained in:
32
src/awk/recordings.awk
Normal file
32
src/awk/recordings.awk
Normal file
@@ -0,0 +1,32 @@
|
||||
BEGIN { OFS="\t" }
|
||||
|
||||
{
|
||||
gsub("&", "\\\\&")
|
||||
id = $1
|
||||
med = $2
|
||||
nr = $3
|
||||
dur = $4
|
||||
title = $5
|
||||
artist = $6
|
||||
# Parse duration
|
||||
if (dur) {
|
||||
dur = int(dur / 1000)
|
||||
dh = int(dur / 3600)
|
||||
dur = dur % 3600
|
||||
dm = int(dur / 60)
|
||||
ds = dur % 60
|
||||
if (ds <= 9)
|
||||
ds = "0"ds
|
||||
dur = dh ? dh":"dm":"ds : dm":"ds
|
||||
} else {
|
||||
dur = "??:??"
|
||||
}
|
||||
line = format
|
||||
sub("<<med>>", med, line)
|
||||
sub("<<nr>>", nr, line)
|
||||
sub("<<title>>", title, line)
|
||||
sub("<<artist>>", artist, line)
|
||||
sub("<<duration>>", dur, line)
|
||||
sortk = med" "nr
|
||||
print sortk, line, id
|
||||
}
|
Reference in New Issue
Block a user