mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
feat: Add Folder ID support for Audiobookshelf integration in settings and configuration
This commit is contained in:
@@ -22,6 +22,7 @@ class AudiobookshelfConfig:
|
||||
api_token: str
|
||||
library_id: str
|
||||
collection_id: Optional[str] = None
|
||||
folder_id: Optional[str] = None
|
||||
verify_ssl: bool = True
|
||||
send_cover: bool = True
|
||||
send_chapters: bool = True
|
||||
|
||||
@@ -2129,6 +2129,7 @@ def _integration_defaults() -> Dict[str, Dict[str, Any]]:
|
||||
"api_token": "",
|
||||
"library_id": "",
|
||||
"collection_id": "",
|
||||
"folder_id": "",
|
||||
"verify_ssl": True,
|
||||
"send_cover": True,
|
||||
"send_chapters": True,
|
||||
@@ -2433,6 +2434,12 @@ def _audiobookshelf_settings_from_payload(payload: Mapping[str, Any]) -> Dict[st
|
||||
or stored.get("collection_id")
|
||||
or ""
|
||||
).strip()
|
||||
folder_id = str(
|
||||
payload.get("folder_id")
|
||||
or payload.get("audiobookshelf_folder_id")
|
||||
or stored.get("folder_id")
|
||||
or ""
|
||||
).strip()
|
||||
token_input = str(
|
||||
payload.get("api_token")
|
||||
or payload.get("audiobookshelf_api_token")
|
||||
@@ -2502,6 +2509,7 @@ def _audiobookshelf_settings_from_payload(payload: Mapping[str, Any]) -> Dict[st
|
||||
"base_url": base_url,
|
||||
"library_id": library_id,
|
||||
"collection_id": collection_id,
|
||||
"folder_id": folder_id,
|
||||
"api_token": api_token,
|
||||
"verify_ssl": verify_ssl,
|
||||
"send_cover": send_cover,
|
||||
@@ -2527,6 +2535,7 @@ def _build_audiobookshelf_config(settings: Mapping[str, Any]) -> Optional[Audiob
|
||||
api_token=api_token,
|
||||
library_id=library_id,
|
||||
collection_id=(str(settings.get("collection_id") or "").strip() or None),
|
||||
folder_id=(str(settings.get("folder_id") or "").strip() or None),
|
||||
verify_ssl=_coerce_bool(settings.get("verify_ssl"), True),
|
||||
send_cover=_coerce_bool(settings.get("send_cover"), True),
|
||||
send_chapters=_coerce_bool(settings.get("send_chapters"), True),
|
||||
@@ -2608,6 +2617,7 @@ def _apply_integration_form(cfg: Dict[str, Any], form: Mapping[str, Any]) -> Non
|
||||
abs_base = str(form.get("audiobookshelf_base_url") or current_abs.get("base_url") or "").strip()
|
||||
abs_library = str(form.get("audiobookshelf_library_id") or current_abs.get("library_id") or "").strip()
|
||||
abs_collection = str(form.get("audiobookshelf_collection_id") or current_abs.get("collection_id") or "").strip()
|
||||
abs_folder = str(form.get("audiobookshelf_folder_id") or current_abs.get("folder_id") or "").strip()
|
||||
abs_token_input = str(form.get("audiobookshelf_api_token") or "")
|
||||
abs_token_clear = _coerce_bool(form.get("audiobookshelf_api_token_clear"), False)
|
||||
if abs_token_input:
|
||||
@@ -2632,6 +2642,7 @@ def _apply_integration_form(cfg: Dict[str, Any], form: Mapping[str, Any]) -> Non
|
||||
"api_token": abs_token,
|
||||
"library_id": abs_library,
|
||||
"collection_id": abs_collection,
|
||||
"folder_id": abs_folder,
|
||||
"verify_ssl": abs_verify,
|
||||
"send_cover": abs_send_cover,
|
||||
"send_chapters": abs_send_chapters,
|
||||
@@ -3095,6 +3106,7 @@ def test_audiobookshelf() -> ResponseReturnValue:
|
||||
"message": f"Connected to Audiobookshelf library '{library_name}'.",
|
||||
"library_id": library_id,
|
||||
"collection_id": collection_id or None,
|
||||
"folder_id": settings.get("folder_id") or None,
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -956,6 +956,7 @@ class ConversionService:
|
||||
api_token=api_token,
|
||||
library_id=library_id,
|
||||
collection_id=(str(integration_cfg.get("collection_id") or "").strip() or None),
|
||||
folder_id=(str(integration_cfg.get("folder_id") or "").strip() or None),
|
||||
verify_ssl=self._coerce_bool(integration_cfg.get("verify_ssl"), True),
|
||||
send_cover=self._coerce_bool(integration_cfg.get("send_cover"), True),
|
||||
send_chapters=self._coerce_bool(integration_cfg.get("send_chapters"), True),
|
||||
|
||||
@@ -305,6 +305,7 @@ function collectAudiobookshelfFields() {
|
||||
const baseUrl = form.querySelector('#audiobookshelf_base_url')?.value?.trim() || '';
|
||||
const libraryId = form.querySelector('#audiobookshelf_library_id')?.value?.trim() || '';
|
||||
const collectionId = form.querySelector('#audiobookshelf_collection_id')?.value?.trim() || '';
|
||||
const folderId = form.querySelector('#audiobookshelf_folder_id')?.value?.trim() || '';
|
||||
const tokenInput = form.querySelector('#audiobookshelf_api_token');
|
||||
const apiToken = tokenInput?.value?.trim() || '';
|
||||
const hasSecret = tokenInput?.dataset.hasSecret === 'true';
|
||||
@@ -319,6 +320,7 @@ function collectAudiobookshelfFields() {
|
||||
base_url: baseUrl,
|
||||
library_id: libraryId,
|
||||
collection_id: collectionId,
|
||||
folder_id: folderId,
|
||||
api_token: apiToken,
|
||||
use_saved_token: useSavedToken,
|
||||
clear_saved_token: clearToken,
|
||||
|
||||
@@ -444,6 +444,10 @@
|
||||
<label for="audiobookshelf_collection_id">Collection ID (optional)</label>
|
||||
<input type="text" id="audiobookshelf_collection_id" name="audiobookshelf_collection_id" value="{{ integrations.audiobookshelf.collection_id }}">
|
||||
</div>
|
||||
<div class="field__group">
|
||||
<label for="audiobookshelf_folder_id">Folder ID (optional)</label>
|
||||
<input type="text" id="audiobookshelf_folder_id" name="audiobookshelf_folder_id" value="{{ integrations.audiobookshelf.folder_id }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field field--inline">
|
||||
<div class="field__group">
|
||||
|
||||
Reference in New Issue
Block a user