From 7583537c6a3232888ac15831bdfcf79284bcb821 Mon Sep 17 00:00:00 2001 From: Tad Smith Date: Mon, 21 Nov 2022 15:28:01 -0600 Subject: [PATCH 1/2] Initial commit. --- trunk-recorder/call_concluder/call_concluder.cc | 11 +++++++++-- trunk-recorder/global_structs.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/trunk-recorder/call_concluder/call_concluder.cc b/trunk-recorder/call_concluder/call_concluder.cc index c8f5714c6..ad7f59ffb 100644 --- a/trunk-recorder/call_concluder/call_concluder.cc +++ b/trunk-recorder/call_concluder/call_concluder.cc @@ -235,6 +235,7 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con call_info.compress_wav = sys->get_compress_wav(); call_info.talkgroup = call->get_talkgroup(); call_info.patched_talkgroups = sys->get_talkgroup_patch(call_info.talkgroup); + call_info.min_transmissions_removed = 0; Talkgroup *tg = sys->find_talkgroup(call->get_talkgroup()); if (tg != NULL) { @@ -268,7 +269,9 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con snprintf(formattedTalkgroup, 61, "%c[%dm%10ld%c[0m", 0x1B, 35, call_info.talkgroup, 0x1B); std::string talkgroup_display = boost::lexical_cast(formattedTalkgroup); - BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tRemoving transmission less than " << sys->get_min_tx_duration() << " seconds. Actual length: " << t.length << "." << std::endl; + BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tRemoving transmission less than " << sys->get_min_tx_duration() << " seconds. Actual length: " << t.length << "."; + + call_info.min_transmissions_removed++; if (checkIfFile(t.filename)) { remove(t.filename); @@ -317,10 +320,14 @@ void Call_Concluder::conclude_call(Call *call, System *sys, Config config) { snprintf(formattedTalkgroup, 61, "%c[%dm%10ld%c[0m", 0x1B, 35, call_info.talkgroup, 0x1B); std::string talkgroup_display = boost::lexical_cast(formattedTalkgroup); - if (call_info.transmission_list.size() == 0) { + if (call_info.transmission_list.size() == 0 && call_info.min_transmissions_removed == 0) { BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmission were recorded!"; return; } + else if (call_info.transmission_list.size() == 0 && call_info.min_transmissions_removed > 0) { + BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmission were recorded! " << call_info.min_transmissions_removed << " tranmissions less than " << sys->get_min_tx_duration() << " seconds were removed."; + return; + } if (call_info.length <= sys->get_min_duration()) { BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\t Call length: " << call_info.length << " is less than min duration: " << sys->get_min_duration(); diff --git a/trunk-recorder/global_structs.h b/trunk-recorder/global_structs.h index 572426d87..0edf8fff7 100644 --- a/trunk-recorder/global_structs.h +++ b/trunk-recorder/global_structs.h @@ -90,6 +90,7 @@ struct Call_Data_t { char filename[300]; char status_filename[300]; char converted[300]; + int min_transmissions_removed; std::string short_name; std::string upload_script; From 78db1497bc818fc7348235314bfb882efbd8ad73 Mon Sep 17 00:00:00 2001 From: Tad Smith Date: Mon, 21 Nov 2022 16:36:02 -0600 Subject: [PATCH 2/2] Pluralized tranmissions. --- trunk-recorder/call_concluder/call_concluder.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk-recorder/call_concluder/call_concluder.cc b/trunk-recorder/call_concluder/call_concluder.cc index ad7f59ffb..b8de0e51a 100644 --- a/trunk-recorder/call_concluder/call_concluder.cc +++ b/trunk-recorder/call_concluder/call_concluder.cc @@ -321,11 +321,11 @@ void Call_Concluder::conclude_call(Call *call, System *sys, Config config) { std::string talkgroup_display = boost::lexical_cast(formattedTalkgroup); if (call_info.transmission_list.size() == 0 && call_info.min_transmissions_removed == 0) { - BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmission were recorded!"; + BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmissions were recorded!"; return; } else if (call_info.transmission_list.size() == 0 && call_info.min_transmissions_removed > 0) { - BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmission were recorded! " << call_info.min_transmissions_removed << " tranmissions less than " << sys->get_min_tx_duration() << " seconds were removed."; + BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\t Freq: " << call_info.freq << "\tNo Transmissions were recorded! " << call_info.min_transmissions_removed << " tranmissions less than " << sys->get_min_tx_duration() << " seconds were removed."; return; }