A cross platform Audiobookshelf client for Android and iOS
Dart
Offer all the Audible regions when picking a metadata provider
Barnabas046e0408f46a
diff --git a/lib/screens/admin_library_edit_screen.dart b/lib/screens/admin_library_edit_screen.dartindex 3fa0509d..81989eaa 100644--- a/lib/screens/admin_library_edit_screen.dart+++ b/lib/screens/admin_library_edit_screen.dart@@ -133,9 +133,18 @@ class _AdminLibraryEditScreenState extends State<AdminLibraryEditScreen> {_LibraryEditorSection _selectedSection = _LibraryEditorSection.details;List<String> _providers = const ['google',- 'audible','openlibrary','itunes',+ 'audible',+ 'audible.ca',+ 'audible.uk',+ 'audible.au',+ 'audible.fr',+ 'audible.de',+ 'audible.jp',+ 'audible.it',+ 'audible.in',+ 'audible.es','audnexus','fantlab',];diff --git a/lib/screens/admin_server_settings_screen.dart b/lib/screens/admin_server_settings_screen.dartindex 237a7ebf..56daf051 100644--- a/lib/screens/admin_server_settings_screen.dart+++ b/lib/screens/admin_server_settings_screen.dart@@ -18,7 +18,12 @@ class AdminServerSettingsScreen extends StatefulWidget {}class _AdminServerSettingsScreenState extends State<AdminServerSettingsScreen> {- static const _coverProviders = ['google', 'audible', 'openlibrary', 'itunes', 'fantlab'];+ static const _coverProviders = [+ 'google', 'openlibrary', 'itunes',+ 'audible', 'audible.ca', 'audible.uk', 'audible.au', 'audible.fr',+ 'audible.de', 'audible.jp', 'audible.it', 'audible.in', 'audible.es',+ 'fantlab', 'audiobookcovers',+ ];static const _metadataFormats = ['json', 'abs'];bool _saving = false;diff --git a/lib/services/api_service.dart b/lib/services/api_service.dartindex 493673c2..af0aa099 100644--- a/lib/services/api_service.dart+++ b/lib/services/api_service.dart@@ -3282,25 +3282,30 @@ class ApiService {return false;}- /// GET /api/search/providers — metadata provider ids for the library editor.- /// Response shape is { books: [{text,value}], podcasts: [...], booksCovers: [...] }.- /// Returns book + podcast provider values (deduped); falls back to built-ins.+ /// Metadata provider ids for the library editor. The server has no endpoint+ /// for these - the ABS web UI hardcodes them client-side - so this is the+ /// same fixed set, plus any custom metadata providers configured on the+ /// server (GET /api/custom-metadata-providers, dropdown value custom-<id>).Future<List<String>> getMetadataProviders() async {- try {- final r = await _authGet(Uri.parse('$_cleanBaseUrl/api/search/providers'));+ final out = <String>[+ 'google', 'openlibrary', 'itunes',+ 'audible', 'audible.ca', 'audible.uk', 'audible.au', 'audible.fr',+ 'audible.de', 'audible.jp', 'audible.it', 'audible.in', 'audible.es',+ 'audnexus', 'fantlab',+ ];+ try {+ final r = await _authGet(Uri.parse('$_cleanBaseUrl/api/custom-metadata-providers'));if (r.statusCode == 200) {final data = jsonDecode(r.body);- final out = <String>[];- for (final key in ['books', 'podcasts']) {- for (final p in (data[key] as List?) ?? []) {- final v = p is Map ? p['value']?.toString() : p?.toString();- if (v != null && v.isNotEmpty && !out.contains(v)) out.add(v);+ for (final p in (data['providers'] as List?) ?? []) {+ if (p is Map && p['id'] != null) {+ final v = 'custom-${p['id']}';+ if (!out.contains(v)) out.add(v);}}- if (out.isNotEmpty) return out;}} catch (e) { debugPrint('[API] getMetadataProviders error: $e'); }- return const ['google', 'audible', 'openlibrary', 'itunes', 'audnexus', 'fantlab'];+ return out;}/// PATCH /api/settings — update server settings (admin only).