Skip to content

Commit

Permalink
Bringing BCFY Upload Messages up to standard (#936)
Browse files Browse the repository at this point in the history
* Bringing BCFY Upload confirmations up to standard

BCFY Upload confirmations are missing the call number, TG name, etc that are present on other upload confirmations. This just brings them up to standard.

* typo fix

Marked upload successes as an error instead of info. Fixing that
  • Loading branch information
decoy4fun committed Mar 14, 2024
1 parent 98aa781 commit fbe8719
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugins/broadcastify_uploader/broadcastify_uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,44 +262,44 @@ class Broadcastify_Uploader : public Plugin_Api {
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);

if (res != CURLM_OK || response_code != 200) {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << response_buffer;
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << response_buffer;
return 1;
}

std::size_t spacepos = response_buffer.find(' ');
if (spacepos < 1) {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << response_buffer;
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << response_buffer;
return 1;
}

std::string code = response_buffer.substr(0, spacepos);
std::string message = response_buffer.substr(spacepos + 1);

if (code == "1" && (message.rfind("SKIPPED", 0) == 0)) {
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload Skipped: " << message;
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload Skipped: " << message;
return 0;
}
if (code == "1" && (message.rfind("REJECTED", 0) == 0)) {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload REJECTED: " << message;
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload REJECTED: " << message;
return 0;
}

if (code != "0") {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << message;
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Metadata Upload Error: " << message;
return 1;
}

CURLcode audio_error = this->upload_audio_file(call_info.converted, message);

if (audio_error) {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Audio Upload Error: " << curl_easy_strerror(audio_error);
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Audio Upload Error: " << curl_easy_strerror(audio_error);
return 1;
}

struct stat file_info;
stat(call_info.converted, &file_info);

BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\tTG: " << call_info.talkgroup << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload Success - file size: " << file_info.st_size;
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tBroadcastify Upload Success - file size: " << file_info.st_size;
return 0;
} else {
return 1;
Expand Down

0 comments on commit fbe8719

Please sign in to comment.