added logging

This commit is contained in:
Scott E. Graves 2025-02-20 07:03:34 -06:00
parent e56927eeb3
commit 6d1da0a9da

View File

@ -200,28 +200,34 @@ void remove_stalled(std::string_view download_id, std::string_view title,
std::optional<nlohmann::json> data; std::optional<nlohmann::json> data;
std::uint64_t search_id{};
if (utils::string::contains("radarr", server.id)) { if (utils::string::contains("radarr", server.id)) {
data = nlohmann::json({ data = nlohmann::json({
{"name", "MoviesSearch"}, {"name", "MoviesSearch"},
{"movieIds", {movie_id}}, {"movieIds", {movie_id}},
}); });
search_id = movie_id;
} else if (utils::string::contains("sonarr", server.id)) { } else if (utils::string::contains("sonarr", server.id)) {
data = nlohmann::json({ data = nlohmann::json({
{"name", "EpisodeSearch"}, {"name", "EpisodeSearch"},
{"episodeIds", {episode_id}}, {"episodeIds", {episode_id}},
}); });
search_id = episode_id;
} }
if (not data.has_value()) { if (not data.has_value()) {
return; return;
} }
utils::error::handle_info(
function_name, fmt::format("searching release {}|{}|{}|{}|{}", server.id,
server.url, title, download_id, search_id));
response = cli.Post(fmt::format("/api/{}/command", server.api_version), response = cli.Post(fmt::format("/api/{}/command", server.api_version),
data->dump(), "application/json"); data->dump(), "application/json");
if (not response) { if (not response) {
utils::error::handle_error( utils::error::handle_error(
function_name, fmt::format("failed to search|{}|{}|{}|{}|no response", function_name, fmt::format("failed to search|{}|{}|{}|{}|no response",
server.id, server.url, title, movie_id)); server.id, server.url, title, search_id));
return; return;
} }
@ -231,7 +237,7 @@ void remove_stalled(std::string_view download_id, std::string_view title,
utils::error::handle_error(function_name, utils::error::handle_error(function_name,
fmt::format("failed to search|{}|{}|{}|{}|{}", fmt::format("failed to search|{}|{}|{}|{}|{}",
server.id, server.url, title, movie_id, server.id, server.url, title,
response->status)); search_id, response->status));
} }
} // namespace monitarr } // namespace monitarr