refactor
This commit is contained in:
parent
f91e826e36
commit
8b06509084
@ -17,17 +17,23 @@
|
||||
#include "utils/windows.hpp"
|
||||
|
||||
namespace monitarr {
|
||||
[[nodiscard]] static auto create_client(const server_cfg &server)
|
||||
-> httplib::Client {
|
||||
httplib::Client cli{server.url};
|
||||
cli.set_default_headers({
|
||||
{"X-Api-Key", server.api_key},
|
||||
});
|
||||
|
||||
return cli;
|
||||
}
|
||||
|
||||
static void remove_stalled(std::string_view download_id, std::string_view title,
|
||||
std::uint64_t episode_id, std::uint64_t movie_id,
|
||||
const server_cfg &server, data_db &state_db) {
|
||||
fmt::println("remove and block {}|{}", download_id, title);
|
||||
state_db.remove(download_id);
|
||||
|
||||
httplib::Client cli{server.url};
|
||||
cli.set_default_headers({
|
||||
{"X-Api-Key", server.api_key},
|
||||
});
|
||||
|
||||
auto cli = create_client(server);
|
||||
auto response = cli.Delete(
|
||||
fmt::format("/api/{}/queue/{}?blocklist=true&skipRedownload=false",
|
||||
server.api_version,
|
||||
@ -69,10 +75,7 @@ static void remove_stalled(std::string_view download_id, std::string_view title,
|
||||
static void check_server(const server_cfg &server, data_db &state_db) {
|
||||
fmt::println("checking server|{}|{}", server.id, server.url);
|
||||
|
||||
httplib::Client cli{server.url};
|
||||
cli.set_default_headers({
|
||||
{"X-Api-Key", server.api_key},
|
||||
});
|
||||
auto cli = create_client(server);
|
||||
|
||||
std::uint16_t page{0U};
|
||||
while (++page != 0U) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user