Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Show downloaded book covers in CarPlay browse list when offline

Barnabase7f8b1efebca
diff --git a/lib/services/carplay_service.dart b/lib/services/carplay_service.dart
index 00732aaf..23f49c5d 100644
--- a/lib/services/carplay_service.dart
+++ b/lib/services/carplay_service.dart
@@ -415,7 +415,15 @@ class CarPlayService {
/// drills into the show's episodes.
CPListItem _playableListItem(AutoBookEntry entry, ApiService? api) {
final coverItemId = entry.showId ?? entry.id;
- final coverUrl = api?.getCoverUrl(coverItemId);
+ // Prefer the entry's own coverUrl when it's a local file:// path so
+ // downloaded books still show artwork in the CarPlay browse list when
+ // the server is unreachable. AndroidAutoService.refresh() populates
+ // file:// for downloads on iOS; the server URL from api.getCoverUrl is
+ // only useful when we can actually reach the server.
+ final entryUrl = entry.coverUrl;
+ final coverUrl = (entryUrl != null && entryUrl.startsWith('file://'))
+ ? entryUrl
+ : api?.getCoverUrl(coverItemId);
final isPodcastShow = entry.mediaType == 'podcast' &&
entry.episodeId == null &&