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

Fix logging when all transmissions are removed. #735

Merged
merged 2 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions trunk-recorder/call_concluder/call_concluder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<std::string>(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);
Expand Down Expand Up @@ -317,8 +320,12 @@ 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<std::string>(formattedTalkgroup);

if (call_info.transmission_list.size() == 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!";
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 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 Transmissions were recorded! " << call_info.min_transmissions_removed << " tranmissions less than " << sys->get_min_tx_duration() << " seconds were removed.";
return;
}

Expand Down
1 change: 1 addition & 0 deletions trunk-recorder/global_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down