api enable
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ services:
|
|||||||
# Grimmory bookdrop — set the host path to Grimmory's bookdrop directory
|
# Grimmory bookdrop — set the host path to Grimmory's bookdrop directory
|
||||||
- /path/to/grimmory/bookdrop:/bookdrop
|
- /path/to/grimmory/bookdrop:/bookdrop
|
||||||
# Local import folder — set the host path to your epub/pdf directory
|
# Local import folder — set the host path to your epub/pdf directory
|
||||||
- /path/to/local-books:/local-books
|
- /path/to/local-books:/local_books
|
||||||
# Optional: mount your SSH private key read-only instead of pasting it in the UI
|
# Optional: mount your SSH private key read-only instead of pasting it in the UI
|
||||||
# - ~/.ssh/id_rsa:/run/secrets/ssh_key:ro
|
# - ~/.ssh/id_rsa:/run/secrets/ssh_key:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
+3
-3
@@ -21,16 +21,16 @@ def _is_in_grimmory(filename: str, url: str, user: str, password: str) -> bool:
|
|||||||
stem = Path(filename).stem
|
stem = Path(filename).stem
|
||||||
try:
|
try:
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
url.rstrip("/") + "/komga/api/v1/books",
|
url.rstrip("/") + "/api/v1/books",
|
||||||
params={"search": stem},
|
params={"search": stem},
|
||||||
auth=(user, password),
|
auth=(user, password),
|
||||||
timeout=10,
|
timeout=10,
|
||||||
)
|
)
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
return r.json().get("totalElements", 0) > 0
|
return r.json().get("totalElements", 0) > 0
|
||||||
log.warning("Grimmory search returned HTTP %s for '%s'", r.status_code, stem)
|
log.debug("Grimmory search returned HTTP %s for '%s' — skipping API check", r.status_code, stem)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning("Grimmory duplicate check failed for '%s': %s", filename, e)
|
log.debug("Grimmory duplicate check unavailable for '%s': %s", filename, e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user