windytan / redsea

Command-line FM-RDS decoder with JSON output.
MIT License
390 stars 36 forks source link

Script for writing RDSSpy compatible sample files #43

Closed andimik closed 6 years ago

andimik commented 7 years ago

rtl-rx_rdsspy.sh will write PI-Code, Date, Time and Frequency to the file name in the current directory

windytan commented 6 years ago

I've added this command in the wiki instead.

andimik commented 6 years ago

Ok

andimik commented 4 years ago

One question: I wanted to improve it by adding the timestamp (like in the original RDSSPY app),

<recorder="RDS Spy" date="2020-01-07" time="18-39-02" source="2" name="" location="" notes="">
A3DD 0403 E376 4120 @2020/01/07 18:39:00.86
A3DD 0400 767F 522E @2020/01/07 18:39:00.86
A3DD 0401 E376 4D41 @2020/01/07 18:39:00.94
A3DD 0402 767F 5249 @2020/01/07 18:39:01.01
A3DD 0403 E376 4120 @2020/01/07 18:39:01.21
A3DD 0400 767F 522E @2020/01/07 18:39:01.21

but microseconds are not detected with parameter %f

#!/bin/sh
rtl_fm -M fm -l 0 -A std -p 0 -s 171k -g 40 -F 9 $@ | redsea -x -t '@%Y/%m/%d %H:%M:%S.%f' | tee `head -12l | tail -1l | cut -d" " -f1`_`date +%F`_`date +%k`-`date +%M`-`date +%S`_$2Hz.spy
A203 0548 6C78 2020 @2020/05/13 20:28:31.%f
A203 2542 6575 6674 @2020/05/13 20:28:31.%f
A203 0549 E36F 4F45 @2020/05/13 20:28:31.%f
A203 2543 2059 6F75 @2020/05/13 20:28:31.%f
A203 E545 7B22 A201 @2020/05/13 20:28:31.%f
A203 054A 6F78 2033 @2020/05/13 20:28:31.%f
A203 2544 2053 686F @2020/05/13 20:28:31.%f

Do you have an idea?

windytan commented 4 years ago

Unlike Python's datetime.now().strftime(), the C strftime used by redsea doesn't support fractional seconds. A possible solution would be to add a special option just for printing the timestamp in the RDS Spy format (-T or something); just thinking aloud.

windytan commented 4 years ago

This is an interesting problem and I want to do it right, I wrote some technical notes in #70 - mainly for myself but comments are welcome, too.

windytan commented 4 years ago

You should now be able to use "%f".