From 855e3853b6f141c5e158711acee7e96ff754e216 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 18 Feb 2025 16:02:10 -0600 Subject: [PATCH] check status --- monitarr/monitarr/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monitarr/monitarr/main.cpp b/monitarr/monitarr/main.cpp index a5c2030..7ed0195 100644 --- a/monitarr/monitarr/main.cpp +++ b/monitarr/monitarr/main.cpp @@ -111,6 +111,8 @@ static void check_server(const server_cfg &server, data_db &state_db) { : std::uint64_t{0U}; auto size_left = record.at("sizeleft").get(); auto title = record.at("title").get(); + auto is_downloading = utils::string::contains( + record.at("status").get(), "downloading"); auto data = state_db.get(download_id); const auto update_entry = [&download_id, &now, &size_left, &state_db, @@ -135,13 +137,15 @@ static void check_server(const server_cfg &server, data_db &state_db) { if (size_left == data->size_left) { remove_stalled(download_id, title, episode_id, movie_id, server, state_db); + } else if (not is_downloading) { + state_db.remove(download_id); } else { update_entry(); } - } else if (size_left == 0U) { + } else if (size_left == 0U || not is_downloading) { state_db.remove(download_id); } - } else { + } else if (is_downloading) { update_entry(); } }