-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface_with_komga.py
More file actions
33 lines (26 loc) · 1.11 KB
/
interface_with_komga.py
File metadata and controls
33 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import importlib.util
import os
from typing import List
from dotenv import load_dotenv
from httpx import BasicAuth
import komga_api_client as komga_client
import komga_api_client.api.library_controller.get_all_2 as get_libraries
import komga_api_client.api.book_controller.get_all_books as find_book
from komga_api_client.models import LibraryDto, BookDto
load_dotenv()
client = komga_client.Client(base_url=os.getenv("KOMGA_HOST"),
httpx_args={
'auth': BasicAuth(os.getenv('KOMGA_USER'), os.getenv('KOMGA_PASS'))
}
)
library_list: List["LibraryDto"] = get_libraries.sync(client=client)
correct_library_path = "/mnt/Storage/Comics_Library"
correct_library_id = None
for library in library_list:
if library.root == correct_library_path:
correct_library_id = correct_library_path
if correct_library_id is None:
print("Could not find library")
exit()
book_to_find = "2000AD 2352 (2023) (Digital-Empire)" # Don't use extension.
book_options = find_book.sync(client=client, search=book_to_find)