-
Notifications
You must be signed in to change notification settings - Fork 4
track ordering vs date ordering (feature request) #2
Description
hello andrew,
i have a bunch of dat tapes that have incorrect datetime metadata.
my understanding is that read_dat is using datetime for file naming,
so i end up with:
$ ls *.details | head -3
1994-12-31-23-05-04.details
1994-12-31-23-06-54.details
1994-12-31-23-07-11.details
but the filename ordering does not match the order of tracks in the tape, in fact:
$ cat 1994-12-31-23-05-04.details # THIS IS THE FIRST FILE IN LS OUTPUT
Sampling frequency: 32000
Channels: 2
Samples: 8065920
Quantization: 12-bit non-linear
Emphasis: none
Program_number: --
First date: Sat Dec 31 23:05:04 1994
Last date: Sat Dec 31 23:09:16 1994
First frame: 79026
Last frame: 83226
Invalid frames: 9
but:
$ cat 1994-12-31-23-06-54.details # THIS IS THE **SECOND** FILE IN LS OUTPUT
Sampling frequency: 32000
Channels: 2
Samples: 111360
Quantization: 12-bit non-linear
Emphasis: none
Program_number: 1
First date: Sat Dec 31 23:06:54 1994
Last date: Sat Dec 31 23:06:57 1994
First frame: 57
Last frame: 114
Invalid frames: 2
the second file starts and ends before the first!
In cases like this it would be probably better to somehow use the sequential number of track for the file name.
a way of working around this issue is to rename files using the "first frame" value in .details as a file prefix. this can be achieved with this bash one-liner:
$ for i in *.details ; do FF=$(grep "First frame" "$i" | awk '{printf "%09d\n", $3}') ; FB=$(echo "$i" | cut -d '.' -f 1) ; mmv "$FB.*" "$FF.$FB.#1" ; done
it would be also nice to have an option in read_dat to prepend a prefix with track number to the file names!
a friend of mine coded this patch for me (i don't have C skills). it basically adds this option:
-N len
use a 0-padded numeric prefix of length equal to len.
it works and has even some documentation in it.
have a look at it and consider including the code in read_dat.c