1966Mustang
Member
My SDRTrunk preferences for recorded calls is set to /storage/sdrtrunk_recordings/current, so this is where they all end up.
It can gather 10000s of small mp3s in a day.
This was annoying to me.
The script finds all mp3 created 'yesterday' in the 'current' folder.
It then parses the filename and groups and sorts them into created archive/DATE/Talkgroup folders.
This solved one problem, but the next problem was now I just had 1000's of files in a bunch of directories in archive/DATE/TALKGROUP...
Another example:
It's rather inconvenient to select all of them and make your mp3 player play all these small files.
So, I made a script to go into the DATE/TALKGROUP directories and merge them in order of occurance into a single DATE_TALKGROUP.mp3 file. This ends up in the 'merged' folder.
Now, they are 'fairly' convenient and each DATE/TALKGROUP.mp3 represents all of the recorded call data from those dates.
Oh... A couple of other things it does is generate SQL files about the source mp3s for loading into a postgres database. Not sure what I am going to do with this yet, but it was fun.
Script is freely available at: GitHub - xtpclark/sdrtrunk_recording_parser: Scripts to parse the sdrtrunk recording dir and move stuff around by date and talk group.
If you choose to check it out, please read through or ask questions and/or correct anything...
"It works on my box..."
It can gather 10000s of small mp3s in a day.
This was annoying to me.
The script finds all mp3 created 'yesterday' in the 'current' folder.
Code:
ppc@linuxbox:/storage/sdrtrunk_recordings/current$ ls -l
total 35968
-rw-rw-r-- 1 ppc ppc 2994 Sep 29 00:00 20230929_000012PossumCreek_PossumCreek_TRAFFIC__TO_608_FROM_5556762.mp3
-rw-rw-r-- 1 ppc ppc 1896 Sep 29 00:00 20230929_000013PossumCreek_PossumCreek_TRAFFIC__TO_609.mp3
-rw-rw-r-- 1 ppc ppc 21714 Sep 29 00:00 20230929_000016PossumCreek_PossumCreek_TRAFFIC__TO_611_FROM_5556191.mp3
-rw-rw-r-- 1 ppc ppc 4794 Sep 29 00:00 20230929_000017PossumCreek_PossumCreek_TRAFFIC__TO_612_FROM_5556768.mp3
-rw-rw-r-- 1 ppc ppc 2992 Sep 29 00:00 20230929_000019PossumCreek_PossumCreek_TRAFFIC__TO_616_FROM_16044.mp3
It then parses the filename and groups and sorts them into created archive/DATE/Talkgroup folders.
Code:
ppc@linuxbox:/storage/sdrtrunk_recordings/archive/20230927$
total 536
drwxrwxr-x 2 ppc ppc 61440 Sep 29 14:55 608
drwxrwxr-x 2 ppc ppc 4096 Sep 29 14:55 609
drwxrwxr-x 2 ppc ppc 376832 Sep 29 14:55 611
drwxrwxr-x 2 ppc ppc 90112 Sep 29 14:55 612
drwxrwxr-x 2 ppc ppc 4096 Sep 29 14:55 616
This solved one problem, but the next problem was now I just had 1000's of files in a bunch of directories in archive/DATE/TALKGROUP...
Code:
ppc@linuxbox:/storage/sdrtrunk_recordings/archive/20230927/608$ ls -l | head -5
total 3096
-rw-rw-r-- 1 ppc ppc 2634 Sep 27 21:23 20230927_212304PossumCreek_PossumCreek_TRAFFIC__TO_608_FROM_5556521.mp3
-rw-rw-r-- 1 ppc ppc 3712 Sep 27 21:23 20230927_212306PossumCreek_PossumCreek_TRAFFIC__TO_608_FROM_16040.mp3
-rw-rw-r-- 1 ppc ppc 12714 Sep 27 21:23 20230927_212313PossumCreek_PossumCreek_TRAFFIC__TO_608_FROM_5556521.mp3
-rw-rw-r-- 1 ppc ppc 2632 Sep 27 21:23 20230927_212316PossumCreek_PossumCreek_TRAFFIC__TO_608_FROM_16040.mp3
Another example:
Code:
ppc@linuxbox:/storage/sdrtrunk_recordings/archive/20230927/609$ ls -l | head -5
total 208
-rw-rw-r-- 1 ppc ppc 815 Sep 27 21:44 20230927_214402PossumCreek_PossumCreek_TRAFFIC__TO_609.mp3
-rw-rw-r-- 1 ppc ppc 2631 Sep 27 22:02 20230927_220224PossumCreek_PossumCreek_TRAFFIC__TO_609_FROM_16040.mp3
-rw-rw-r-- 1 ppc ppc 7311 Sep 27 22:03 20230927_220312PossumCreek_PossumCreek_TRAFFIC__TO_609_FROM_16040.mp3
-rw-rw-r-- 1 ppc ppc 3711 Sep 27 22:03 20230927_220314PossumCreek_PossumCreek_TRAFFIC__TO_609_FROM_16040.mp3
It's rather inconvenient to select all of them and make your mp3 player play all these small files.
So, I made a script to go into the DATE/TALKGROUP directories and merge them in order of occurance into a single DATE_TALKGROUP.mp3 file. This ends up in the 'merged' folder.
Code:
ppc@linuxbox:/storage/sdrtrunk_recordings/merged$ ls -l
total 45208
-rw-rw-r-- 1 ppc ppc 2253393 Sep 29 15:46 20230927_608.mp3
-rw-rw-r-- 1 ppc ppc 143145 Sep 29 15:46 20230927_609.mp3
-rw-rw-r-- 1 ppc ppc 14997177 Sep 29 15:45 20230927_611.mp3
-rw-rw-r-- 1 ppc ppc 4746537 Sep 29 15:45 20230927_612.mp3
Now, they are 'fairly' convenient and each DATE/TALKGROUP.mp3 represents all of the recorded call data from those dates.
Oh... A couple of other things it does is generate SQL files about the source mp3s for loading into a postgres database. Not sure what I am going to do with this yet, but it was fun.
Script is freely available at: GitHub - xtpclark/sdrtrunk_recording_parser: Scripts to parse the sdrtrunk recording dir and move stuff around by date and talk group.
If you choose to check it out, please read through or ask questions and/or correct anything...
"It works on my box..."
Last edited: