-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Unitscript failure #440
Comments
Great catches - It was a little too eager to merge things in. @rosecitytransit is going to build out the example script a little more. that is interesting... it may not like relative directories. let me go check that out. The conversation on this feature is here: |
Excellent! I started a little Bash research myself just so I can play more later. Eventually I’d like to figure out how to mark or otherwise pull aside transmissions coming from my radio for “post-event review.” |
Great to hear people are already trying to use the feature. It makes me wish I could have gotten it in 3 years ago, but oh well. As for the config entry, you probably need to include If no one else does it, I do indeed plan to get the script finished and tested, either tonight or in the next few days. As for saving transmissions from a specific radio, that's entirely possible. On one of my installs, I have the radio IDs being put in the file name so that would be an easy My next goal is an option to create daily call log files (instead of hundreds of JSON files); this could be easily searched for radio IDs. For now, I think you'd need a script that reads every JSON file and searches through the list of radios. |
Still not working (getting a sed error) but here is what I have now. I noticed that @CrimeIsDown tried unit logging in #411 : b2987a2 #!/bin/bash
CAPTUREDIR="test" #fill this in with the path used in config.json, no ending /
# Creates a list of radio IDs in a file named "radiolist.csv" located in the
# shortName directory along side the recordings, and logs of radio activity to
# "radiolog.csv" located in each day's recordings directory
# file format: radioID, timestamp, action, talkgroup
# for radiolist.csv, acknowledgment response timestamp in 5th column when it was
# seen after other action
# Feel free to customize this script; to use for multiple systems, include in each
# system's config.json section
# NOTE: For efficiency, this script does not check for/create the radio log files,
# so they MUST exist beforehand. Run "echo > radiolist.csv" where you are keeping
# it or them, and set up a daily cron task of &&
# sed script based on https://stackoverflow.com/a/49852337
printf -v TRDATE '%(%Y/%-m/%-d)T'
printf -v NOWTIME '%(%s)T'
if [ ! "$3" == "ackresp" ]; then
sed -i -e 's/^'${2}',.*/{s/'${2}','${NOWTIME}','${3}','${4}',/;:a;n;ba;q}' -e '$a'${2}','${NOWTIME}','${3}','${4}',' $CAPTUREDIR/$1/radiolist.csv
else
sed -i -e 's/^'${2}',\([0-9]*\),\([on|join|off|call]\),\([0-9]*\),\([0-9]*\)/{s/'${2}',\1,\2,\3,'${NOWTIME}'/;:a;n;ba;q}' -e '$a'${2}','${NOWTIME}',ackresp,,' $CAPTUREDIR/$1/radiolist.csv
fi
echo "$2,$NOWTIME,$3,$4" >> $CAPTUREDIR/$1/$TRDATE/radiolog.csv |
OK, I think this is working. Go ahead and try it, and if so, I'll submit a pull request: #!/bin/bash
CAPTUREDIR="test" #fill this in with the path used in config.json, no ending /
# Creates a list of radio IDs in a file named "radiolist.csv" located in the
# shortName directory along side the recordings, and logs of radio activity to
# "radiolog.csv" located in each day's recordings directory
# file format: radioID, timestamp, action, talkgroup
# for radiolist.csv, acknowledgment response timestamp in 5th column when it
# was seen after other action
# Feel free to customize this script; to use for multiple systems, include in
# each system's config.json section
# NOTE: You need to run "echo > radiolist.csv" where the file(s) is going to be
# beforehand as sed doesn't work on empty files, and to capture actions before
# trunk-recorder makes the daily directory upon recording the first call,
# set up a daily cron task of mkdir -p <capturedir>/
# sed usage based on https://stackoverflow.com/a/49852337
printf -v TRDATE '%(%Y/%-m/%-d)T'
printf -v NOWTIME '%(%s)T'
if [ ! "$3" == "ackresp" ]; then
sed -i -e '/^'${2}',.*/{s//'${2}','${NOWTIME}','${3}','${4}',/;:a;n;ba;q}' -e '$a'${2}','${NOWTIME}','${3}','${4}',' $CAPTUREDIR/$1/radiolist.csv
else
sed -i -e '/^'${2}',\([0-9]*\),ackresp,,/{s//'${2}','${NOWTIME}',\1,ackresp,,/;:a;n;ba;q}' -e '/^'${2}',\([0-9]*\),\([a-z]*\),\([0-9]*\),\([0-9]*\)/{s//'${2}',\1,\2,\3,'${NOWTIME}'/;:a;n;ba;q}' -e '$a'${2}','${NOWTIME}',ackresp,,' $CAPTUREDIR/$1/radiolist.csv
fi
#echo "$2,$NOWTIME,$3,$4" >> $CAPTUREDIR/$1/$TRDATE/radiolog.csv |
Are you using the latest one, in the new pull request, and is this in
radiolist.csv or radiolog.csv?
…On Sat, Mar 13, 2021, 5:36 AM rpdale ***@***.***> wrote:
I'm not sure if it's a script issue or software issue... but I'm only
getting "calls" - no joins or any other status so far.
[image: unitrunker]
<https://user-images.githubusercontent.com/11564694/111031784-3710fe80-83d7-11eb-829e-8b5e46d52f47.gif>
[image: trunker]
<https://user-images.githubusercontent.com/11564694/111031786-38422b80-83d7-11eb-8ccf-d8f803571db6.gif>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAB7DOLEXMWUIMXEEXZELDTDNL6FANCNFSM4ZBC5TCQ>
.
|
I should add that if you're only getting call entries, then it makes me think the script isn't being called correctly, since it's done differently for calls (as the program, of course, actually processes calls unlike with the other actions). @robotastic or whoever, am I doing it correctly? The code flow is: unit_registration(sys->get_unit_script(), message.source);
void unit_registration(string unit_script, long unit) {
unit_affiliations[unit] = 0;
if (unit_script.length() != 0) {
char shell_command[200];
sprintf(shell_command, "%s %li on &", unit_script.c_str(), unit);
int rc = system(shell_command);
}
} I know I could pass Oh, and I am planning on upgrading my version trunk-recorder soon (attempting to address #180 and #200) and have a spare SDR, so I'll be able to test things myself soon. |
I updated the script to the file versus the reply here and same response... Only calls are showing up in both .csv files In addition - my reception isn't perfect, so may be to blame - but occasionally getting these errors where it appears to be using the radio ID as the system name (should be 'mpscs') /media/pi/F4D9-02F5/9384148/2021/3/13/radiolog.csv: |
Presumably, the shortName is not getting passed to the script, which causes the following parameters to shift over (I'm betting that file doesn't include the radio IDs). My guess is that trunk-recorder is decoding a system ID which does not match the existing one that the shortName has been applied to, and creates a new system. But unless the directory structure already exists, I don't see how the file is getting created since the If you could attach or link to the trunk-recorder log file, that might be helpful. |
There's nothing terribly exciting that I see in the logfile before that happens. 9239955 is a valid MPSCS radio ID, as well as 10233242. [2021-03-13 18:41:09.594562] (info) - Starting P25 Recorder Num [5] TG: 1258 Freq: 7.707062e+08 TDMA: false Slot: 0 Mod: false 9232043,1615677035,call,1258, [2021-03-13 18:34:36.982562] (error) [mpscs] TG: 12627 Freq: 7.713812e+08 Broadcastify Metadata Upload Error: SKIPPED---ALREADY-RECEIVED-THIS-CALL 10233298,1615672318,call,1258, |
A thought occurred to me: it's NOT a decoding issue (I'm not even sure another
system is set up when a different System ID is seen), but that the errors
are all the joins, etc and what's happening is that I'm not accessing the
shortName correctly so it's not getting passed.
For now, if you wanted you could replace the $1 in the script with your
actual shortName. To get the data into the correct columns, you'd have to
shift the parameters over when it's not a call.
…On Sat, Mar 13, 2021, 3:52 PM rpdale ***@***.***> wrote:
There's nothing terribly exciting that I see in the logfile before that
happens. 9239955 is a valid MPSCS radio ID, as well as 10233242.
[2021-03-13 18:41:09.594562] (info) - Starting P25 Recorder Num [5] TG:
1258 Freq: 7.707062e+08 TDMA: false Slot: 0 Mod: false
[2021-03-13 18:41:09.596169] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Starting Recorder on Src: rtl=2
[2021-03-13 18:41:24.006429] (info) Currently Active Calls: 1
[2021-03-13 18:41:24.006850] (info) TG: 1258 Freq: 7.707062e+08 Elapsed:
15 State: recording
[2021-03-13 18:41:24.007164] (info) [ 5 ] State: active
[2021-03-13 18:41:24.007278] (info) Recorders:
[2021-03-13 18:41:24.007378] (info) [ rtl=1 ]
[2021-03-13 18:41:24.007480] (info) [ D0 ] State: inactive
[2021-03-13 18:41:24.007571] (info) [ D1 ] State: inactive
[2021-03-13 18:41:24.007662] (info) [ D2 ] State: inactive
[2021-03-13 18:41:24.007748] (info) [ D3 ] State: inactive
[2021-03-13 18:41:24.007839] (info) [ D4 ] State: inactive
[2021-03-13 18:41:24.007931] (info) [ rtl=2 ]
[2021-03-13 18:41:24.008020] (info) [ D5 ] State: active
[2021-03-13 18:41:24.008106] (info) [ D6 ] State: inactive
[2021-03-13 18:41:24.008195] (info) [ D7 ] State: inactive
[2021-03-13 18:41:43.006907] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Ending Recorded Call - Last Update: 4sCall Elapsed: 34
[2021-03-13 18:41:43.150012] (info) - Stopping P25 Recorder Num [5] TG:
1258 Freq: 7.707062e+08 TDMA: false Slot: 0
[2021-03-13 18:41:45.023567] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Broadcastify Upload Success - file size: 105311
[2021-03-13 18:42:04.009000] (info) [mpscs] TG: 1258 Freq: 7.707062e+08 TG
not in Talkgroup File
[2021-03-13 18:42:04.009660] (info) - Starting P25 Recorder Num [5] TG:
1258 Freq: 7.707062e+08 TDMA: false Slot: 0 Mod: false
[2021-03-13 18:42:04.010406] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Starting Recorder on Src: rtl=2
[2021-03-13 18:42:04.779131] (info) [mpscs] TG: 12627 Freq: 7.713812e+08
TG not in Talkgroup File
[2021-03-13 18:42:04.779398] (info) - Starting P25 Recorder Num [6] TG:
12627 Freq: 7.713812e+08 TDMA: false Slot: 0 Mod: false
[2021-03-13 18:42:04.779529] (info) [mpscs] TG: 12627 Freq: 7.713812e+08
Starting Recorder on Src: rtl=2
[2021-03-13 18:42:10.148803] (info) [mpscs] TG: 12627 Freq: 7.697188e+08
Update Retuning - New Freq: 7.697188e+08 Elapsed: 6s Since update: 2s
sed: can't read /media/pi/F4D9-02F5/9239955/radiolist.csv: No such file or
directory
/home/pi/trunk-recorder/unit-script.sh: line 14:
/media/pi/F4D9-02F5/9239955/2021/3/13/radiolog.csv: No such file or
directory
sed: can't read /media/pi/F4D9-02F5/9239955/radiolist.csv: No such file or
directory
/home/pi/trunk-recorder/unit-script.sh: line 14:
/media/pi/F4D9-02F5/9239955/2021/3/13/radiolog.csv: No such file or
directory
9232043,1615677035,call,1258,
9230852,1615679266,call,1258,
9230049,1615676568,call,1041,
9230047,1615678128,call,1041,
9230904,1615676735,call,1041,
[2021-03-13 18:34:36.982562] (error) [mpscs] TG: 12627 Freq: 7.713812e+08
Broadcastify Metadata Upload Error: SKIPPED---ALREADY-RECEIVED-THIS-CALL
[2021-03-13 18:34:42.018009] (info) Currently Active Calls: 1
[2021-03-13 18:34:42.018310] (info) TG: 1258 Freq: 7.707062e+08 Elapsed:
24 State: recording
[2021-03-13 18:34:42.027607] (info) [ 5 ] State: active
[2021-03-13 18:34:42.027989] (info) Recorders:
[2021-03-13 18:34:42.028166] (info) [ rtl=1 ]
[2021-03-13 18:34:42.028278] (info) [ D0 ] State: inactive
[2021-03-13 18:34:42.028382] (info) [ D1 ] State: inactive
[2021-03-13 18:34:42.028484] (info) [ D2 ] State: inactive
[2021-03-13 18:34:42.028612] (info) [ D3 ] State: inactive
[2021-03-13 18:34:42.028743] (info) [ D4 ] State: inactive
[2021-03-13 18:34:42.028856] (info) [ rtl=2 ]
[2021-03-13 18:34:42.028966] (info) [ D5 ] State: active
[2021-03-13 18:34:42.029068] (info) [ D6 ] State: inactive
[2021-03-13 18:34:42.029163] (info) [ D7 ] State: inactive
[2021-03-13 18:35:03.003593] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Ending Recorded Call - Last Update: 4sCall Elapsed: 45
[2021-03-13 18:35:03.149963] (info) - Stopping P25 Recorder Num [5] TG:
1258 Freq: 7.707062e+08 TDMA: false Slot: 0
[2021-03-13 18:35:06.965822] (info) [mpscs] TG: 1258 Freq: 7.707062e+08
Broadcastify Upload Success - file size: 197351
sed: can't read /media/pi/F4D9-02F5/10233242/radiolist.csv: No such file
or directory
/home/pi/trunk-recorder/unit-script.sh: line 14:
/media/pi/F4D9-02F5/10233242/2021/3/13/radiolog.csv: No such file or
directory
sed: can't read /media/pi/F4D9-02F5/10233242/radiolist.csv: No such file
or directory
/home/pi/trunk-recorder/unit-script.sh: line 14:
/media/pi/F4D9-02F5/10233242/2021/3/13/radiolog.csv: No such file or
directory
[2021-03-13 18:36:10.283197] (info) [mpscs] TG: 1237 Freq: 8.519750e+08 TG
not in Talkgroup File
[2021-03-13 18:36:10.283577] (info) - Starting P25 Recorder Num [0] TG:
1237 Freq: 8.519750e+08 TDMA: false Slot: 0 Mod: false
[2021-03-13 18:36:10.284078] (info) [mpscs] TG: 1237 Freq: 8.519750e+08
Starting Recorder on Src: rtl=1
[2021-03-13 18:36:17.658789] (info) [mpscs] TG: 1237 Freq: 8.528500e+08
Update Retuning - New Freq: 8.528500e+08 Elapsed: 7s Since update: 3s
[2021-03-13 18:36:27.001575] (info) [mpscs] TG: 1237 Freq: 8.528500e+08
Ending Recorded Call - Last Update: 4sCall Elapsed: 17
10233298,1615672318,call,1258,
10233216,1615672775,call,1258,
10233287,1615675381,call,11923,
10233220,1615675335,call,1258,
10233232,1615675386,call,1258,
10233250,1615675414,call,1258,
10233208,1615679416,call,1258,
10233288,1615676001,call,1258,
10233234,1615676297,call,1258,
10233281,1615677576,call,11923,
10233240,1615678646,call,1258,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAB7DMFXLNOBMF23LYPRUDTDPUBXANCNFSM4ZBC5TCQ>
.
|
I only just now realized that I'm not even trying to pass shortName ( I think I have the issue fixed in the new pull request (#441) if you can try that. Just replace trunk-recorder/trunk-recorder/main.cc with this one |
No change with a rebuild. It is getting things right most of the time, but still occasionally using the radio ID as the system name. And radiolist.csv no longer has anything at all in it. The file is empty. radiolog.csv is filling up (other than when it gets the radio ID in there instead.) sed: can't read /media/pi/F4D9-02F5/9230099/radiolist.csv: No such file or directory |
Finally getting back to this. In trunk-recorder/trunk-recorder/main.cc, do you find If radiolist.csv is completely empty, open the file, press enter a couple times to generate a blank line or two and save it. As I said, sed won't work on empty files. Try replacing occurrences of I have an extra SDR so I'm going to work on getting it set up and tested myself. |
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1504710864;
mso-list-type:hybrid;
mso-list-template-ids:1177562740 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:20.5pt;
text-indent:-.25in;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:56.5pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:92.5pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:128.5pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:164.5pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:200.5pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:236.5pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:272.5pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:308.5pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l1
{mso-list-id:1661036772;
mso-list-type:hybrid;
mso-list-template-ids:1841737246 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->I hardcoded the unit-script.sh file and that changed things a bit… I am now seeing on/join/add instead of just calls in the log. But something doesn’t look right still. radiolist.csv:1199991,1616336409,call,1191,0,1616336425,call,1191,on,1616336492,,,join,1616336492,11923,, radiolog.csv:0,1616336252,call,11910,1616336252,call,11910,1616336253,call,1191on,1616336298,,on,1616336298,,join,1616336298,11922,join,1616336298,11922,1199991,1616336408,call,11911199991,1616336408,call,11911199991,1616336409,call,1191 From: Jason McHuffSent: Sunday, March 21, 2021 1:58 AMTo: robotastic/trunk-recorderCc: rpdale; AuthorSubject: Re: [robotastic/trunk-recorder] Unitscript failure (#440) Finally getting back to this.In trunk-recorder/trunk-recorder/main.cc, do you find sys->get_unit_script(), sys->get_short_name()? I'm pretty sure I'm calling both the same way, so I'm not sure why one would show up and not the other.If radiolist.csv is completely empty, open the file, press enter a couple times to generate a blank line or two and save it. As I said, sed won't work on empty files.Try replacing occurrences of $1 in unit-script.sh with your actual short name, mpscs.I have an extra SDR so I'm going to work on getting it set up and tested myself.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
What doesn't look right? It's a little hard for me to tell since the line breaks didn't come through, but it looks OK. |
I got the new version of trunk-recorder set up and running! Yay! So in unit-script.sh, remove the radiolist.csv:
radiolog.csv
|
Weird, because the on/off/join messages which look messed up on yours are working fine for me:
If you want, I could log in to your system (either directly or via remote desktop program) and look at it. E-mail me |
Awesome!
…On Sun, Mar 28, 2021, 6:19 AM rpdale ***@***.***> wrote:
Looking good!
[image: image]
<https://user-images.githubusercontent.com/11564694/112753681-9b6eb900-8fa6-11eb-94e9-f50a4a7eb10e.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAB7DMB7AR5UAP6GPSKHUDTF4UE3ANCNFSM4ZBC5TCQ>
.
|
I’m getting a syntax error on Line 11 (“elif”) and I’m no Bash expert - but I think elif has to have a test parameter behind it. And I don’t think “!=“ is used in Bash either?
Also the readme seems to imply that I just put the script into the ~/trunk-recorder directory, but it couldn’t find it when I ran recorder. It worked with the fully delimited name (after I first noticed the file was executable -but that’s when the syntax errors popped up.)
Last question - what’s the operational difference between this and OnUnitChange?
The text was updated successfully, but these errors were encountered: