Skip to content

Commit

Permalink
fixed not cycling through all media servers at other errors than 404,…
Browse files Browse the repository at this point in the history
… now cycles through all if response is not ok
  • Loading branch information
9FS committed Oct 8, 2024
1 parent 2fe1f56 commit d2ff55a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "nhentai_archivist"
readme = "readme.md"
repository = "https://github.com/9-FS/nhentai_archivist"
version = "3.4.0"
version = "3.4.1"

[dependencies]
chrono = { version = "^0.4.0", features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
nhentai_archivist:
container_name: "nhentai_archivist"
image: "ghcr.io/9-fs/nhentai_archivist:3.4.0"
image: "ghcr.io/9-fs/nhentai_archivist:3.4.1"
environment:
HOST_OS: "Unraid"
PGID: 100
Expand Down
4 changes: 2 additions & 2 deletions src/hentai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ impl Hentai


let mut r: reqwest::Response = http_client.get(image_url).send().await?; // tag search on general media server, page
if r.status() == reqwest::StatusCode::NOT_FOUND // if status not found: retry with other media servers
if r.status() != reqwest::StatusCode::OK // if status not ok: retry with other media servers
{
for media_server in MEDIA_SERVERS // try all media servers
{
log::debug!("{}", image_url.replace("i.nhentai.net", format!("i{media_server}.nhentai.net").as_str()));
r = http_client.get(image_url.replace("i.nhentai.net", format!("i{media_server}.nhentai.net").as_str())).send().await?; // tag search, page, insert media server
log::debug!("{}", r.status());
if r.status() != reqwest::StatusCode::NOT_FOUND {break;} // if not found: try again
if r.status() == reqwest::StatusCode::OK {break;} // if not ok: try again
}
}
if r.status() != reqwest::StatusCode::OK {return Err(HentaiDownloadImageError::ReqwestStatus {url: image_url.to_owned(), status: r.status()});} // if status still not ok: something went wrong
Expand Down

0 comments on commit d2ff55a

Please sign in to comment.