Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

track ordering vs date ordering (feature request) #2

Open
fanfani opened this issue May 27, 2020 · 0 comments
Open

track ordering vs date ordering (feature request) #2

fanfani opened this issue May 27, 2020 · 0 comments

Comments

@fanfani
Copy link

fanfani commented May 27, 2020

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

read_dat.c.patch.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant