Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Fix podcasts switching to audiobooks at end of episode

Barnabas170a8a5a9e9d
diff --git a/lib/providers/_lp_absorbing.dart b/lib/providers/_lp_absorbing.dart
index 097c8484..12e4315f 100644
--- a/lib/providers/_lp_absorbing.dart
+++ b/lib/providers/_lp_absorbing.dart
@@ -606,6 +606,10 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
final finishedCached = _absorbingItemCache[finishedKey];
final finishedLibId = finishedCached?['libraryId'] as String?;
+ // GH #241: queue mode is per-media-type (podcastQueueMode vs bookQueueMode),
+ // so a podcast finishing must only advance to another podcast — never a book
+ // (whose own queue mode might be "off").
+ final finishedIsPodcast = finishedKey.length > 36;
final finishedIdx = _absorbingBookIds.indexOf(finishedKey);
final startIdx = finishedIdx >= 0 ? finishedIdx + 1 : 0;
@@ -614,6 +618,9 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
final key = _absorbingBookIds[i];
if ((this as LibraryProvider).isItemFinishedByKey(key)) continue;
+ final candidateIsPodcast = key.length > 36;
+ if (candidateIsPodcast != finishedIsPodcast) continue;
+
final cached = _absorbingItemCache[key];
if (cached == null) continue;
@@ -1181,6 +1188,8 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
for (var i = start; i < _absorbingBookIds.length; i++) {
final key = _absorbingBookIds[i];
if (self.isItemFinishedByKey(key)) continue;
+ // Match _manualQueueAdvance: only same-type items are eligible.
+ if ((key.length > 36) != isPodCurrent) continue;
final cached = _absorbingItemCache[key];
if (cached == null) continue;
return _entryTitle(cached);