Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Let each library use its own cover shape and skip amounts

Barnabas98f087a3f427
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 653b7a57..bad2bb0f 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -584,6 +584,19 @@
"longSkipButtonsOffSubtitle": "Off - just the regular skip buttons",
"longSkipBack": "Long skip back",
"longSkipForward": "Long skip forward",
+ "coverShapeDefault": "Default",
+ "coverShapeSquare": "Square",
+ "coverShapeRectangle": "Rectangle",
+ "coverShapeLabel": "Cover shape",
+ "currentLibrarySettingsTitle": "Current library: {name}",
+ "@currentLibrarySettingsTitle": {
+ "placeholders": { "name": { "type": "String" } }
+ },
+ "currentLibrarySkipOverride": "Custom skip amounts",
+ "currentLibrarySkipOverrideOnSubtitle": "On - this library uses its own skip amounts",
+ "currentLibrarySkipOverrideOffSubtitle": "Off - this library uses the global skip amounts",
+ "currentLibrarySkipBack": "Skip back",
+ "currentLibrarySkipForward": "Skip forward",
"chapterProgressInNotification": "Chapter progress in notification & Android Auto",
"chapterProgressOnSubtitle": "On - notification & Android Auto show chapter progress",
"chapterProgressOffSubtitle": "Off - they show full book progress",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 2bc401ac..199f9784 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -2344,6 +2344,66 @@ abstract class AppLocalizations {
/// **'Long skip forward'**
String get longSkipForward;
+ /// No description provided for @coverShapeDefault.
+ ///
+ /// In en, this message translates to:
+ /// **'Default'**
+ String get coverShapeDefault;
+
+ /// No description provided for @coverShapeSquare.
+ ///
+ /// In en, this message translates to:
+ /// **'Square'**
+ String get coverShapeSquare;
+
+ /// No description provided for @coverShapeRectangle.
+ ///
+ /// In en, this message translates to:
+ /// **'Rectangle'**
+ String get coverShapeRectangle;
+
+ /// No description provided for @coverShapeLabel.
+ ///
+ /// In en, this message translates to:
+ /// **'Cover shape'**
+ String get coverShapeLabel;
+
+ /// No description provided for @currentLibrarySettingsTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Current library: {name}'**
+ String currentLibrarySettingsTitle(String name);
+
+ /// No description provided for @currentLibrarySkipOverride.
+ ///
+ /// In en, this message translates to:
+ /// **'Custom skip amounts'**
+ String get currentLibrarySkipOverride;
+
+ /// No description provided for @currentLibrarySkipOverrideOnSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'On - this library uses its own skip amounts'**
+ String get currentLibrarySkipOverrideOnSubtitle;
+
+ /// No description provided for @currentLibrarySkipOverrideOffSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Off - this library uses the global skip amounts'**
+ String get currentLibrarySkipOverrideOffSubtitle;
+
+ /// No description provided for @currentLibrarySkipBack.
+ ///
+ /// In en, this message translates to:
+ /// **'Skip back'**
+ String get currentLibrarySkipBack;
+
+ /// No description provided for @currentLibrarySkipForward.
+ ///
+ /// In en, this message translates to:
+ /// **'Skip forward'**
+ String get currentLibrarySkipForward;
+
/// No description provided for @chapterProgressInNotification.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index 239b96ae..a29a0014 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -1238,6 +1238,40 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Kapitelfortschritt in der Benachrichtigung';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index f3f1d157..acc1b684 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 5ee63d87..4746bd2a 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index d217e45d..10ba4925 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 6d1295ca..652a21b5 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -1232,6 +1232,40 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index 9791b0a1..304a0291 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index 78f06540..f8d083bc 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index d107777c..2a32796c 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index c8624394..80380d22 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index ace78f39..559b172e 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -1230,6 +1230,40 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index d20f53ae..af9e8053 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -1233,6 +1233,40 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification =>
'Chapter progress in notification & Android Auto';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 5124bfbc..3a7c08e1 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -1206,6 +1206,40 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get longSkipForward => 'Long skip forward';
+ @override
+ String get coverShapeDefault => 'Default';
+
+ @override
+ String get coverShapeSquare => 'Square';
+
+ @override
+ String get coverShapeRectangle => 'Rectangle';
+
+ @override
+ String get coverShapeLabel => 'Cover shape';
+
+ @override
+ String currentLibrarySettingsTitle(String name) {
+ return 'Current library: $name';
+ }
+
+ @override
+ String get currentLibrarySkipOverride => 'Custom skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOnSubtitle =>
+ 'On - this library uses its own skip amounts';
+
+ @override
+ String get currentLibrarySkipOverrideOffSubtitle =>
+ 'Off - this library uses the global skip amounts';
+
+ @override
+ String get currentLibrarySkipBack => 'Skip back';
+
+ @override
+ String get currentLibrarySkipForward => 'Skip forward';
+
@override
String get chapterProgressInNotification => '通知中显示章节进度';
diff --git a/lib/providers/_lp_absorbing.dart b/lib/providers/_lp_absorbing.dart
index 15ee0bf5..80f8ad34 100644
--- a/lib/providers/_lp_absorbing.dart
+++ b/lib/providers/_lp_absorbing.dart
@@ -185,6 +185,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
coverUrl: getCoverUrl(actualNextKey),
totalDuration: duration,
chapters: chapters,
+ libraryId: cached['libraryId'] as String?,
);
});
}
@@ -611,6 +612,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
chapters: [],
episodeId: nextEpId,
episodeTitle: nextEp['title'] as String?,
+ libraryId: fullItem['libraryId'] as String?,
startTime: startTime,
);
}
@@ -698,6 +700,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
chapters: [],
episodeId: epId,
episodeTitle: ep?['title'] as String?,
+ libraryId: cached['libraryId'] as String?,
);
} else {
final duration = (media['duration'] as num?)?.toDouble() ?? 0;
@@ -710,6 +713,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
coverUrl: getCoverUrl(key),
totalDuration: duration,
chapters: chapters,
+ libraryId: cached['libraryId'] as String?,
);
}
debugPrint('[AutoAdvance] Manual queue: starting next item $key');
@@ -835,6 +839,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
coverUrl: getCoverUrl(nextKey),
totalDuration: (media['duration'] as num?)?.toDouble() ?? 0,
chapters: media['chapters'] as List<dynamic>? ?? [],
+ libraryId: nextData['libraryId'] as String?,
);
}
@@ -901,6 +906,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
coverUrl: getCoverUrl(nextKey),
totalDuration: (nextMedia['duration'] as num?)?.toDouble() ?? 0,
chapters: nextMedia['chapters'] as List<dynamic>? ?? [],
+ libraryId: nextData['libraryId'] as String?,
);
});
}
@@ -972,6 +978,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
chapters: [],
episodeId: nextEpId,
episodeTitle: ep['title'] as String?,
+ libraryId: nextData['libraryId'] as String?,
);
});
}
@@ -1047,6 +1054,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
chapters: const [],
episodeId: episodeId,
episodeTitle: episode?['title'] as String?,
+ libraryId: libraryItem['libraryId'] as String?,
);
} else {
final duration = (media['duration'] as num?)?.toDouble() ?? 0;
@@ -1059,6 +1067,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
coverUrl: getCoverUrl(libraryItemId),
totalDuration: duration,
chapters: chapters,
+ libraryId: libraryItem['libraryId'] as String?,
);
}
return true;
@@ -1358,6 +1367,7 @@ mixin _AbsorbingMixin on ChangeNotifier, _StateMixin, _CoreMixin {
return {
'itemId': itemIdRaw,
'episodeId': episodeIdRaw,
+ 'libraryId': cached['libraryId'] as String?,
'title': title,
'author': author,
'coverUrl': getCoverUrl(itemIdRaw),
diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dart
index 014bbefa..2f12af46 100644
--- a/lib/screens/absorbing_screen.dart
+++ b/lib/screens/absorbing_screen.dart
@@ -1667,6 +1667,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {
chapters: const [],
episodeId: epId,
episodeTitle: epTitle,
+ libraryId: book['libraryId'] as String? ?? widget.lib.selectedLibraryId,
);
} else {
AudioPlayerService().playItem(
@@ -1677,6 +1678,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {
coverUrl: widget.lib.getCoverUrl(key),
totalDuration: (media['duration'] as num?)?.toDouble() ?? 0,
chapters: media['chapters'] as List<dynamic>? ?? const [],
+ libraryId: book['libraryId'] as String? ?? widget.lib.selectedLibraryId,
);
}
},
diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dart
index 9f13fc8f..b1085ec2 100644
--- a/lib/screens/app_shell.dart
+++ b/lib/screens/app_shell.dart
@@ -459,6 +459,7 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Ticker
// Fallback: synthesize from player data
item ??= {
'id': itemId,
+ 'libraryId': _player.currentLibraryId,
'media': {
'metadata': {
'title': _player.currentTitle ?? 'Unknown',
diff --git a/lib/screens/bookmarks_screen.dart b/lib/screens/bookmarks_screen.dart
index 846a307c..49d7e367 100644
--- a/lib/screens/bookmarks_screen.dart
+++ b/lib/screens/bookmarks_screen.dart
@@ -350,6 +350,7 @@ class _BookmarksScreenState extends State<BookmarksScreen> {
chapters: chapters,
startTime: position,
forceStartTime: true,
+ libraryId: fullItem['libraryId'] as String?,
);
if (error != null && mounted) showErrorSnackBar(context, error);
diff --git a/lib/screens/car_mode_screen.dart b/lib/screens/car_mode_screen.dart
index 4434fae9..23353b9e 100644
--- a/lib/screens/car_mode_screen.dart
+++ b/lib/screens/car_mode_screen.dart
@@ -72,11 +72,15 @@ class _CarModeScreenState extends State<CarModeScreen>
]);
}
+ String? _lastLibraryId;
+
void _loadSkipSettings() {
- PlayerSettings.getBackSkip().then((v) {
+ final libraryId = widget.player.currentLibraryId;
+ _lastLibraryId = libraryId;
+ PlayerSettings.getEffectiveBackSkip(libraryId: libraryId).then((v) {
if (mounted && v != _backSkip) setState(() => _backSkip = v);
});
- PlayerSettings.getForwardSkip().then((v) {
+ PlayerSettings.getEffectiveForwardSkip(libraryId: libraryId).then((v) {
if (mounted && v != _forwardSkip) setState(() => _forwardSkip = v);
});
PlayerSettings.getNotificationChapterProgress().then((v) {
@@ -85,6 +89,8 @@ class _CarModeScreenState extends State<CarModeScreen>
}
void _onPlayerChanged() {
+ // Reload skips when the playing item's library changes.
+ if (widget.player.currentLibraryId != _lastLibraryId) _loadSkipSettings();
if (mounted) setState(() {});
}
@@ -124,6 +130,7 @@ class _CarModeScreenState extends State<CarModeScreen>
chapters: widget.fallbackChapters,
episodeId: widget.episodeId,
episodeTitle: widget.episodeTitle,
+ libraryId: context.read<LibraryProvider>().selectedLibraryId,
);
if (mounted) setState(() => _isStarting = false);
}
diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart
index c6a5b0f2..6bf00624 100644
--- a/lib/screens/home_screen.dart
+++ b/lib/screens/home_screen.dart
@@ -82,10 +82,16 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi
});
}
+ // Which library the cover shape was resolved for; re-resolved when the
+ // selected library changes (see build) or settings change.
+ String? _coversLibraryId;
+
Future<void> _loadSettings() async {
+ final libId = mounted ? context.read<LibraryProvider>().selectedLibraryId : null;
+ _coversLibraryId = libId;
final results = await Future.wait([
PlayerSettings.getHideEbookOnly(),
- PlayerSettings.getRectangleCovers(),
+ PlayerSettings.getRectangleCoversFor(libId),
]);
if (mounted) setState(() {
_hideEbookOnly = results[0];
@@ -292,6 +298,13 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi
final lib = context.watch<LibraryProvider>();
final allLibraries = lib.libraries;
final libraryName = lib.selectedLibrary?['name'] as String? ?? l.libraryFallback;
+ // Cover shape can differ per library; re-resolve after a library switch.
+ if (lib.selectedLibraryId != _coversLibraryId) {
+ _coversLibraryId = lib.selectedLibraryId;
+ PlayerSettings.getRectangleCoversFor(_coversLibraryId).then((v) {
+ if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
+ });
+ }
if (lib.isLoading) {
// Reset cache so stale data isn't shown after a user switch
// (where the new user may have the same number of sections).
@@ -1042,6 +1055,7 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {
chapters: [],
episodeId: episodeId,
episodeTitle: episodeTitle,
+ libraryId: widget.item['libraryId'] as String?,
);
if (mounted) {
if (error != null) showErrorSnackBar(context, error);
@@ -1076,6 +1090,7 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {
coverUrl: coverUrl,
totalDuration: duration,
chapters: chapters,
+ libraryId: fullItem['libraryId'] as String?,
);
if (error != null && mounted) showErrorSnackBar(context, error);
diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dart
index cf9531e1..1570421b 100644
--- a/lib/screens/library_screen.dart
+++ b/lib/screens/library_screen.dart
@@ -307,6 +307,10 @@ class LibraryScreenState extends State<LibraryScreen> with TickerProviderStateMi
if (lib.selectedLibraryId != _lastLibraryId && lib.selectedLibraryId != null) {
_lastLibraryId = lib.selectedLibraryId;
_loadGeneration++;
+ // Cover shape can differ per library.
+ PlayerSettings.getRectangleCoversFor(lib.selectedLibraryId).then((v) {
+ if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
+ });
// Rebuild tab controller if library type changed
final needsTabs = !lib.isPodcastLibrary;
@@ -370,7 +374,7 @@ class LibraryScreenState extends State<LibraryScreen> with TickerProviderStateMi
PlayerSettings.getCollapseSeries().then((v) {
if (mounted) setState(() => _collapseSeries = v);
});
- PlayerSettings.getRectangleCovers().then((v) {
+ PlayerSettings.getRectangleCoversFor(lib.selectedLibraryId).then((v) {
if (mounted) setState(() => _rectangleCovers = v);
});
_restoreSortFilter().then((_) {
@@ -518,7 +522,8 @@ class LibraryScreenState extends State<LibraryScreen> with TickerProviderStateMi
Future.wait([
PlayerSettings.getHideEbookOnly(),
PlayerSettings.getCollapseSeries(),
- PlayerSettings.getRectangleCovers(),
+ PlayerSettings.getRectangleCoversFor(
+ context.read<LibraryProvider>().selectedLibraryId),
]).then((values) {
final newHideEbook = values[0];
final newCollapse = values[1];
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 0e4fbaa2..13d6a439 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -117,6 +117,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool _snappyTransitions = false;
bool _classicWording = false;
bool _rectangleCovers = false;
+ // Per-library overrides shown in the Library section, scoped to whichever
+ // library is currently selected (scales to accounts with many libraries -
+ // no giant list, just "whatever you're browsing right now").
+ String? _curLibId;
+ String _curLibCoverShape = 'default'; // 'default' | 'square' | 'rect'
+ bool _curLibSkipOverride = false;
+ int _curLibSkipForward = 30;
+ int _curLibSkipBack = 10;
bool _coverPlayButton = false;
String _cardBackground = 'blurred';
double _progressTextScale = 1.0;
@@ -797,6 +805,92 @@ class _SettingsScreenState extends State<SettingsScreen> {
_loaded = true;
});
+ final libId = mounted ? context.read<LibraryProvider>().selectedLibraryId : null;
+ if (libId != null) _loadCurrentLibraryOverrides(libId);
+ }
+
+ /// (Re)loads the cover-shape + skip overrides for whichever library is
+ /// currently selected. Called on load and again whenever the user picks a
+ /// different library from the list in this same section.
+ Future<void> _loadCurrentLibraryOverrides(String libraryId) async {
+ final shape = await PlayerSettings.getRectangleCoversOverride(libraryId);
+ final skip = await PlayerSettings.getSkipOverride(libraryId);
+ if (mounted) setState(() {
+ _curLibId = libraryId;
+ _curLibCoverShape = shape ?? 'default';
+ _curLibSkipOverride = skip != null;
+ _curLibSkipForward = skip?.forward ?? 30;
+ _curLibSkipBack = skip?.back ?? 10;
+ });
+ }
+
+ String _coverShapeValueLabel(AppLocalizations l, String value) {
+ switch (value) {
+ case 'rect': return l.coverShapeRectangle;
+ case 'square': return l.coverShapeSquare;
+ default: return l.coverShapeDefault;
+ }
+ }
+
+ /// Default/Square/Rectangle picker for the currently selected library,
+ /// same bottom-sheet pattern as the language picker.
+ Future<void> _pickCurrentLibraryCoverShape() async {
+ final libId = _curLibId;
+ if (libId == null) return;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+
+ final picked = await showModalBottomSheet<String>(
+ context: context,
+ isScrollControlled: true,
+ useSafeArea: true,
+ backgroundColor: cs.surfaceContainerLow,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ builder: (ctx) => SafeArea(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const SizedBox(height: 8),
+ Container(
+ width: 40, height: 4,
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.24),
+ borderRadius: BorderRadius.circular(2),
+ ),
+ ),
+ const SizedBox(height: 16),
+ Text(l.coverShapeLabel, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
+ const SizedBox(height: 8),
+ RadioListTile<String>(
+ value: 'default',
+ groupValue: _curLibCoverShape,
+ onChanged: (v) => Navigator.pop(ctx, v),
+ title: Text(l.coverShapeDefault),
+ subtitle: Text(_rectangleCovers ? l.coverShapeRectangle : l.coverShapeSquare),
+ ),
+ RadioListTile<String>(
+ value: 'square',
+ groupValue: _curLibCoverShape,
+ onChanged: (v) => Navigator.pop(ctx, v),
+ title: Text(l.coverShapeSquare),
+ ),
+ RadioListTile<String>(
+ value: 'rect',
+ groupValue: _curLibCoverShape,
+ onChanged: (v) => Navigator.pop(ctx, v),
+ title: Text(l.coverShapeRectangle),
+ ),
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
+ );
+ if (picked == null || picked == _curLibCoverShape) return;
+ setState(() => _curLibCoverShape = picked);
+ await PlayerSettings.setRectangleCoversOverride(libId, picked == 'default' ? null : picked);
}
static const _shakeSensitivityKeys = ['veryLow', 'low', 'medium', 'high', 'veryHigh'];
@@ -954,6 +1048,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
final auth = context.watch<AuthProvider>();
final lib = context.watch<LibraryProvider>();
final l = AppLocalizations.of(context)!;
+ if (lib.selectedLibraryId != null && lib.selectedLibraryId != _curLibId) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted) _loadCurrentLibraryOverrides(lib.selectedLibraryId!);
+ });
+ }
return Scaffold(
body: Container(
@@ -2822,6 +2921,91 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}),
],
+ if (_curLibId != null) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 2),
+ child: Text(
+ l.currentLibrarySettingsTitle(lib.selectedLibrary?['name'] as String? ?? l.libraryFallback),
+ style: tt.titleSmall,
+ ),
+ ),
+ InkWell(
+ onTap: _loaded ? () => _pickCurrentLibraryCoverShape() : null,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
+ child: Row(children: [
+ Expanded(child: Text(l.coverShapeLabel)),
+ Text(_coverShapeValueLabel(l, _curLibCoverShape),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Icon(Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ ]),
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.currentLibrarySkipOverride),
+ subtitle: Text(
+ _curLibSkipOverride
+ ? l.currentLibrarySkipOverrideOnSubtitle
+ : l.currentLibrarySkipOverrideOffSubtitle,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ ),
+ value: _curLibSkipOverride,
+ onChanged: _loaded ? (v) {
+ setState(() => _curLibSkipOverride = v);
+ if (v) {
+ PlayerSettings.setSkipOverride(_curLibId!,
+ forward: _curLibSkipForward, back: _curLibSkipBack);
+ } else {
+ PlayerSettings.setSkipOverride(_curLibId!, forward: null, back: null);
+ }
+ } : null,
+ ),
+ if (_curLibSkipOverride) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(l.currentLibrarySkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.secondsValue(_curLibSkipBack.toString()), style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600, color: cs.primary)),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _curLibSkipBack.toDouble(),
+ min: 5, max: 60, divisions: 11,
+ onChanged: _loaded ? (v) {
+ setState(() => _curLibSkipBack = v.round());
+ PlayerSettings.setSkipOverride(_curLibId!,
+ forward: _curLibSkipForward, back: v.round());
+ } : null,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(l.currentLibrarySkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.secondsValue(_curLibSkipForward.toString()), style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600, color: cs.primary)),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _curLibSkipForward.toDouble(),
+ min: 5, max: 60, divisions: 11,
+ onChanged: _loaded ? (v) {
+ setState(() => _curLibSkipForward = v.round());
+ PlayerSettings.setSkipOverride(_curLibId!,
+ forward: v.round(), back: _curLibSkipBack);
+ } : null,
+ ),
+ ],
+ ],
],
),
const SizedBox(height: 16),
diff --git a/lib/screens/stats_screen.dart b/lib/screens/stats_screen.dart
index 3fc3c857..4e3d071e 100644
--- a/lib/screens/stats_screen.dart
+++ b/lib/screens/stats_screen.dart
@@ -2028,6 +2028,7 @@ class SessionDetailsSheetState extends State<SessionDetailsSheet> {
forceStartTime: true,
episodeId: episodeId,
episodeTitle: episodeTitle,
+ libraryId: sessionLibraryId ?? fullItem['libraryId'] as String?,
);
if (!mounted) return;
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 7d3dbd65..938957ca 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -459,11 +459,11 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
@override
Future<void> fastForward() async {
debugPrint('[Handler] fastForward() - seeking forward');
+ final skipAmount = await PlayerSettings.getEffectiveForwardSkip(
+ libraryId: _service?.currentLibraryId);
if (_service != null) {
- final skipAmount = await PlayerSettings.getForwardSkip();
await _service!.skipForward(skipAmount);
} else {
- final skipAmount = await PlayerSettings.getForwardSkip();
final adjusted = (skipAmount * _player.speed).round();
await _player.seek(_player.position + Duration(seconds: adjusted));
}
@@ -472,11 +472,11 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
@override
Future<void> rewind() async {
debugPrint('[Handler] rewind() - seeking back');
+ final skipAmount = await PlayerSettings.getEffectiveBackSkip(
+ libraryId: _service?.currentLibraryId);
if (_service != null) {
- final skipAmount = await PlayerSettings.getBackSkip();
await _service!.skipBackward(skipAmount);
} else {
- final skipAmount = await PlayerSettings.getBackSkip();
final adjusted = (skipAmount * _player.speed).round();
var pos = _player.position - Duration(seconds: adjusted);
if (pos < Duration.zero) pos = Duration.zero;
@@ -926,6 +926,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
chapters: chapters,
episodeId: episodeId,
showId: showId,
+ libraryId: dl.libraryId,
);
}
}
@@ -956,6 +957,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
chapters: ep['chapters'] as List<dynamic>? ?? [],
episodeId: episodeId,
showId: showId,
+ libraryId: response['libraryId'] as String?,
);
}
} else {
@@ -966,6 +968,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
duration: (media?['duration'] as num?)?.toDouble() ?? 0,
coverUrl: AndroidAutoService.localCoverUri(absId),
chapters: media?['chapters'] as List<dynamic>? ?? [],
+ libraryId: response['libraryId'] as String?,
);
}
}
@@ -997,6 +1000,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
startTime: entry.currentTime ?? 0,
episodeId: entry.episodeId,
episodeTitle: entry.episodeId != null ? entry.title : null,
+ libraryId: entry.libraryId,
);
}
}
@@ -1232,18 +1236,7 @@ class AudioPlayerService extends ChangeNotifier {
}
});
// Update cached skip amounts so notification icons stay in sync
- PlayerSettings.getForwardSkip().then((v) {
- if (_handler != null && v != _handler!._cachedForwardSkip) {
- _handler!._cachedForwardSkip = v;
- _handler!.refreshPlaybackState();
- }
- });
- PlayerSettings.getBackSkip().then((v) {
- if (_handler != null && v != _handler!._cachedBackSkip) {
- _handler!._cachedBackSkip = v;
- _handler!.refreshPlaybackState();
- }
- });
+ _syncNotifSkipCache();
PlayerSettings.getMediaControlsSpeedBookmark().then((v) {
if (_handler != null && v != _handler!._cachedNotifSpeedBookmark) {
_handler!._cachedNotifSpeedBookmark = v;
@@ -1258,6 +1251,25 @@ class AudioPlayerService extends ChangeNotifier {
});
}
+ /// Refresh the notification's cached skip labels with the amounts for the
+ /// current library. Called on settings changes and whenever the loaded
+ /// item changes.
+ void _syncNotifSkipCache() {
+ final libId = _currentLibraryId;
+ PlayerSettings.getEffectiveForwardSkip(libraryId: libId).then((v) {
+ if (_handler != null && v != _handler!._cachedForwardSkip) {
+ _handler!._cachedForwardSkip = v;
+ _handler!.refreshPlaybackState();
+ }
+ });
+ PlayerSettings.getEffectiveBackSkip(libraryId: libId).then((v) {
+ if (_handler != null && v != _handler!._cachedBackSkip) {
+ _handler!._cachedBackSkip = v;
+ _handler!.refreshPlaybackState();
+ }
+ });
+ }
+
/// The last seek target in seconds (absolute book position).
/// UI can use this to immediately snap to the target before stream catches up.
double? _lastSeekTargetSeconds;
@@ -1558,6 +1570,8 @@ class AudioPlayerService extends ChangeNotifier {
// Promote next book's metadata to current state
_currentItemId = next['itemId'] as String?;
_currentEpisodeId = next['episodeId'] as String?;
+ _currentLibraryId = next['libraryId'] as String?;
+ _syncNotifSkipCache();
_currentTitle = next['title'] as String?;
_currentAuthor = next['author'] as String?;
_currentCoverUrl = next['coverUrl'] as String?;
@@ -1668,6 +1682,7 @@ class AudioPlayerService extends ChangeNotifier {
startTime: startS,
forceStartTime: true,
episodeId: _currentEpisodeId,
+ libraryId: _currentLibraryId,
);
} catch (e) {
debugPrint('[QueueAdvance] resync playItem failed: $e');
@@ -2346,6 +2361,13 @@ class AudioPlayerService extends ChangeNotifier {
String? _currentEpisodeId;
String? get currentEpisodeId => _currentEpisodeId;
+ // Which ABS library the currently-loaded item belongs to, so per-library
+ // skip overrides (see PlayerSettings.getSkipOverride) can resolve. Set
+ // wherever _currentItemId/_currentEpisodeId are (playItem + queue advance);
+ // null when the caller didn't have it available (falls back to global skip).
+ String? _currentLibraryId;
+ String? get currentLibraryId => _currentLibraryId;
+
/// MediaSession / AA item id. Podcast episodes use the compound
/// `parentId-episodeId` key so AA doesn't treat them as a separate item
/// from the initial load. Books use the plain itemId.
@@ -2368,6 +2390,7 @@ class AudioPlayerService extends ChangeNotifier {
bool forceStartTime = false,
String? episodeId,
String? episodeTitle,
+ String? libraryId,
}) async {
if (_handler == null) {
debugPrint('[Player] Handler not yet initialized, waiting…');
@@ -2413,6 +2436,8 @@ class AudioPlayerService extends ChangeNotifier {
_api = api;
_currentItemId = itemId;
_currentEpisodeId = episodeId;
+ _currentLibraryId = libraryId;
+ _syncNotifSkipCache();
// Reset local-session mode for every new play; _playFromLocal re-enables it
// for downloaded items. Without this it leaks from a prior downloaded play
// into a following streaming play and misroutes the listening time.
@@ -3553,6 +3578,7 @@ class AudioPlayerService extends ChangeNotifier {
void _clearState() {
_currentItemId = null;
_currentEpisodeId = null;
+ _currentLibraryId = null;
_currentEpisodeTitle = null;
_currentTitle = null;
_currentAuthor = null;
@@ -3623,6 +3649,7 @@ class AudioPlayerService extends ChangeNotifier {
final chapters = List<dynamic>.from(_chapters);
final episodeId = _currentEpisodeId;
final episodeTitle = _currentEpisodeTitle;
+ final libraryId = _currentLibraryId;
final api = _api!;
final retryPos = _lastKnownPositionSec;
@@ -3643,6 +3670,7 @@ class AudioPlayerService extends ChangeNotifier {
startTime: retryPos,
episodeId: episodeId,
episodeTitle: episodeTitle,
+ libraryId: libraryId,
);
_retryInProgress = false;
@@ -4579,6 +4607,7 @@ class AudioPlayerService extends ChangeNotifier {
chapters: _chapters,
episodeId: _currentEpisodeId,
episodeTitle: _currentEpisodeTitle,
+ libraryId: _currentLibraryId,
);
return;
}
diff --git a/lib/services/home_widget_service.dart b/lib/services/home_widget_service.dart
index b2886ef5..e71481ff 100644
--- a/lib/services/home_widget_service.dart
+++ b/lib/services/home_widget_service.dart
@@ -297,6 +297,7 @@ class HomeWidgetService {
chapters: const [],
episodeId: episodeId,
episodeTitle: epTitle,
+ libraryId: fullItem['libraryId'] as String?,
);
} else {
await player.playItem(
@@ -307,6 +308,7 @@ class HomeWidgetService {
coverUrl: coverUrl,
totalDuration: duration,
chapters: chapters,
+ libraryId: fullItem['libraryId'] as String?,
);
}
} catch (e) {
@@ -405,6 +407,7 @@ class HomeWidgetService {
chapters: [],
episodeId: episodeId,
episodeTitle: epTitle,
+ libraryId: fullItem['libraryId'] as String?,
);
} else {
await player.playItem(
@@ -415,6 +418,7 @@ class HomeWidgetService {
coverUrl: coverUrl,
totalDuration: duration,
chapters: chapters,
+ libraryId: fullItem['libraryId'] as String?,
);
}
} catch (e) {
@@ -462,8 +466,8 @@ class HomeWidgetService {
await HomeWidget.saveWidgetData<bool>('widget_has_book', hasBook);
// Push user's skip durations so the widget shows them on the buttons.
- final skipBack = await PlayerSettings.getBackSkip();
- final skipForward = await PlayerSettings.getForwardSkip();
+ final skipBack = await PlayerSettings.getEffectiveBackSkip(libraryId: player.currentLibraryId);
+ final skipForward = await PlayerSettings.getEffectiveForwardSkip(libraryId: player.currentLibraryId);
await HomeWidget.saveWidgetData<int>('widget_skip_back', skipBack);
await HomeWidget.saveWidgetData<int>('widget_skip_forward', skipForward);
diff --git a/lib/services/player_settings.dart b/lib/services/player_settings.dart
index ea448511..b9673ac0 100644
--- a/lib/services/player_settings.dart
+++ b/lib/services/player_settings.dart
@@ -355,6 +355,44 @@ class PlayerSettings {
static Future<bool> getSkipChapterBarrier() => _get('skipChapterBarrier', true);
static Future<void> setSkipChapterBarrier(bool value) => _set('skipChapterBarrier', value);
+ /// Per-library skip override: a library (podcast or book) can use its own
+ /// forward/back amounts instead of the global ones. Both are set together;
+ /// null = no override for that library.
+ static Future<({int forward, int back})?> getSkipOverride(String libraryId) async {
+ final fwd = await ScopedPrefs.getInt('skipOverrideForward_$libraryId');
+ final back = await ScopedPrefs.getInt('skipOverrideBack_$libraryId');
+ if (fwd == null || back == null) return null;
+ return (forward: fwd, back: back);
+ }
+
+ static Future<void> setSkipOverride(String libraryId, {int? forward, int? back}) async {
+ if (forward == null || back == null) {
+ await ScopedPrefs.remove('skipOverrideForward_$libraryId');
+ await ScopedPrefs.remove('skipOverrideBack_$libraryId');
+ } else {
+ await ScopedPrefs.setInt('skipOverrideForward_$libraryId', forward);
+ await ScopedPrefs.setInt('skipOverrideBack_$libraryId', back);
+ }
+ _notify();
+ }
+
+ /// Skip amounts that respect a library's override, if it has one.
+ static Future<int> getEffectiveForwardSkip({String? libraryId}) async {
+ if (libraryId != null) {
+ final o = await getSkipOverride(libraryId);
+ if (o != null) return o.forward;
+ }
+ return getForwardSkip();
+ }
+
+ static Future<int> getEffectiveBackSkip({String? libraryId}) async {
+ if (libraryId != null) {
+ final o = await getSkipOverride(libraryId);
+ if (o != null) return o.back;
+ }
+ return getBackSkip();
+ }
+
// Optional second, bigger skip pair on the player card (GH #242).
static Future<bool> getLongSkipButtons() => _get('longSkipButtons', false);
static Future<void> setLongSkipButtons(bool value) => _set('longSkipButtons', value, notify: true);
@@ -550,6 +588,32 @@ class PlayerSettings {
static Future<bool> getRectangleCovers() => _get('rectangleCovers', false);
static Future<void> setRectangleCovers(bool value) => _set('rectangleCovers', value, notify: true);
+ /// Per-library cover-shape override: 'rect', 'square', or null (= follow
+ /// the global toggle). Lets an ebook library run tall covers while the
+ /// audiobook libraries stay square.
+ static Future<String?> getRectangleCoversOverride(String libraryId) async {
+ final v = await ScopedPrefs.getString('rectangleCovers_$libraryId');
+ return (v == 'rect' || v == 'square') ? v : null;
+ }
+
+ static Future<void> setRectangleCoversOverride(String libraryId, String? value) async {
+ if (value == null) {
+ await ScopedPrefs.remove('rectangleCovers_$libraryId');
+ } else {
+ await ScopedPrefs.setString('rectangleCovers_$libraryId', value);
+ }
+ _notify();
+ }
+
+ /// Cover shape for a library: its override if set, else the global toggle.
+ static Future<bool> getRectangleCoversFor(String? libraryId) async {
+ if (libraryId != null) {
+ final v = await getRectangleCoversOverride(libraryId);
+ if (v != null) return v == 'rect';
+ }
+ return getRectangleCovers();
+ }
+
static Future<bool> getSectionGridView() => _get('sectionGridView', false);
static Future<void> setSectionGridView(bool value) => _set('sectionGridView', value);
diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dart
index 78c0a4b0..c3fbf94f 100644
--- a/lib/widgets/absorbing_card.dart
+++ b/lib/widgets/absorbing_card.dart
@@ -165,6 +165,29 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
void _onSpeedMaybeChanged() => _loadSavedSpeed();
+ /// Which library this card's item belongs to, for the per-library cover
+ /// shape. The absorbing shelf item can be a lean/synthetic map without a
+ /// libraryId (especially with merge on, where podcast items are pulled from
+ /// other libraries), so fall back to the cached absorbing entry and then to
+ /// the player when this is the item currently playing.
+ String? _resolveLibraryId() {
+ final direct = widget.item['libraryId'] as String?;
+ if (direct != null && direct.isNotEmpty) return direct;
+ final lib = context.read<LibraryProvider>();
+ final epId = _episodeId;
+ final key = epId != null ? '$_itemId-$epId' : _itemId;
+ final cached = lib.absorbingItemCache[key]?['libraryId'] as String?;
+ if (cached != null && cached.isNotEmpty) return cached;
+ if (_itemId == widget.player.currentItemId) return widget.player.currentLibraryId;
+ return null;
+ }
+
+ void _reloadCoverShape() {
+ PlayerSettings.getRectangleCoversFor(_resolveLibraryId()).then((v) {
+ if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
+ });
+ }
+
Future<void> _loadSavedSpeed() async {
final bookSpeed = await PlayerSettings.getBookSpeed(_itemId);
final speed = bookSpeed ?? await PlayerSettings.getDefaultSpeed();
@@ -195,9 +218,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
});
}
});
- PlayerSettings.getRectangleCovers().then((v) {
- if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
- });
+ _reloadCoverShape();
PlayerSettings.getCoverPlayButton().then((v) {
if (mounted && v != _coverPlayButton) setState(() => _coverPlayButton = v);
});
@@ -368,6 +389,9 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
_lastSeenUpdatedAt = context.read<LibraryProvider>().itemUpdatedAt(_itemId);
_fetchChaptersIfNeeded();
}
+ // Re-resolve the cover shape: the item (or its libraryId) may have changed,
+ // or the player may now know the library for the item that just started.
+ _reloadCoverShape();
if (oldWidget.player != widget.player) _startChapterTracking();
}
@@ -894,6 +918,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
onStart: _startPlayback,
itemId: _itemId,
showPlayButton: !_coverPlayButton,
+ libraryId: _resolveLibraryId(),
),
);
@@ -1099,6 +1124,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
coverUrl: _coverUrl, totalDuration: _effectiveDuration, chapters: _chapters,
episodeId: _episodeId,
episodeTitle: _recentEpisode?['title'] as String?,
+ libraryId: widget.item['libraryId'] as String?,
);
if (mounted) {
if (error != null) showErrorSnackBar(context, error);
diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dart
index 9b06f800..7a8a4f8c 100644
--- a/lib/widgets/book_detail_sheet.dart
+++ b/lib/widgets/book_detail_sheet.dart
@@ -1815,7 +1815,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
rootNav.popUntil((route) => route.isFirst);
AppShell.goToAbsorbingGlobal();
- final error = await player.playItem(api: api, itemId: widget.itemId, title: title, author: author, coverUrl: coverUrl, totalDuration: duration, chapters: chapters);
+ final error = await player.playItem(api: api, itemId: widget.itemId, title: title, author: author, coverUrl: coverUrl, totalDuration: duration, chapters: chapters, libraryId: _item?['libraryId'] as String?);
if (error != null) {
final ctx = rootNavigatorKey.currentContext;
if (ctx != null) showErrorSnackBar(ctx, error);
diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dart
index 79f5165f..31e383dd 100644
--- a/lib/widgets/card_buttons.dart
+++ b/lib/widgets/card_buttons.dart
@@ -966,6 +966,7 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
title: title, author: author, coverUrl: coverUrl,
totalDuration: duration, chapters: chapters,
startTime: positionSeconds, forceStartTime: true,
+ libraryId: fullItem['libraryId'] as String?,
);
AppShell.goToAbsorbingGlobal();
}
diff --git a/lib/widgets/card_chapters_sheet.dart b/lib/widgets/card_chapters_sheet.dart
index 84f15f28..908471dc 100644
--- a/lib/widgets/card_chapters_sheet.dart
+++ b/lib/widgets/card_chapters_sheet.dart
@@ -126,6 +126,7 @@ void showChaptersSheet({
title: title, author: author, coverUrl: coverUrl,
totalDuration: dur, chapters: chs,
startTime: start, forceStartTime: true,
+ libraryId: fullItem['libraryId'] as String?,
);
AppShell.goToAbsorbingGlobal();
}
diff --git a/lib/widgets/card_playback_controls.dart b/lib/widgets/card_playback_controls.dart
index dc23fa12..edb88886 100644
--- a/lib/widgets/card_playback_controls.dart
+++ b/lib/widgets/card_playback_controls.dart
@@ -14,7 +14,8 @@ class CardPlaybackControls extends StatefulWidget {
final String? itemId;
final bool showPlayButton;
final double playButtonSize;
- const CardPlaybackControls({super.key, required this.player, required this.accent, required this.isActive, required this.isStarting, required this.onStart, this.itemId, this.showPlayButton = false, this.playButtonSize = 65});
+ final String? libraryId;
+ const CardPlaybackControls({super.key, required this.player, required this.accent, required this.isActive, required this.isStarting, required this.onStart, this.itemId, this.showPlayButton = false, this.playButtonSize = 65, this.libraryId});
@override State<CardPlaybackControls> createState() => _CardPlaybackControlsState();
}
@@ -32,13 +33,18 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> {
}
void _loadSkipSettings() {
- PlayerSettings.getBackSkip().then((v) { if (mounted && v != _backSkip) setState(() => _backSkip = v); });
- PlayerSettings.getForwardSkip().then((v) { if (mounted && v != _forwardSkip) setState(() => _forwardSkip = v); });
+ PlayerSettings.getEffectiveBackSkip(libraryId: widget.libraryId).then((v) { if (mounted && v != _backSkip) setState(() => _backSkip = v); });
+ PlayerSettings.getEffectiveForwardSkip(libraryId: widget.libraryId).then((v) { if (mounted && v != _forwardSkip) setState(() => _forwardSkip = v); });
PlayerSettings.getLongSkipButtons().then((v) { if (mounted && v != _longSkip) setState(() => _longSkip = v); });
PlayerSettings.getLongBackSkip().then((v) { if (mounted && v != _longBackSkip) setState(() => _longBackSkip = v); });
PlayerSettings.getLongForwardSkip().then((v) { if (mounted && v != _longForwardSkip) setState(() => _longForwardSkip = v); });
}
+ @override void didUpdateWidget(CardPlaybackControls old) {
+ super.didUpdateWidget(old);
+ if (old.libraryId != widget.libraryId) _loadSkipSettings();
+ }
+
@override void dispose() {
PlayerSettings.settingsChanged.removeListener(_loadSkipSettings);
super.dispose();
diff --git a/lib/widgets/ebook_reader_view.dart b/lib/widgets/ebook_reader_view.dart
index f90f6df7..b25f26b5 100644
--- a/lib/widgets/ebook_reader_view.dart
+++ b/lib/widgets/ebook_reader_view.dart
@@ -229,6 +229,7 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObs
coverUrl: _audioCoverUrl,
totalDuration: _audioDuration,
chapters: _audioChapters,
+ libraryId: lib.selectedLibraryId,
);
if (mounted) setState(() => _startingAudio = false);
}
diff --git a/lib/widgets/episode_detail_sheet.dart b/lib/widgets/episode_detail_sheet.dart
index fe4902ea..074aebc0 100644
--- a/lib/widgets/episode_detail_sheet.dart
+++ b/lib/widgets/episode_detail_sheet.dart
@@ -134,6 +134,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
coverUrl: api.getCoverUrl(_itemId), totalDuration: _duration, chapters: _chapters,
episodeId: _episodeId,
episodeTitle: _episodeTitle,
+ libraryId: context.read<LibraryProvider>().selectedLibraryId,
);
debugPrint('[PodcastPlay] playItem returned in ${DateTime.now().difference(t0).inMilliseconds}ms (error=${error ?? 'none'})');
if (error != null && rootContext.mounted) {
diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dart
index 00098d9d..caa20fe4 100644
--- a/lib/widgets/episode_list_sheet.dart
+++ b/lib/widgets/episode_list_sheet.dart
@@ -295,6 +295,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
chapters: chapters,
episodeId: episodeId,
episodeTitle: episodeTitle,
+ libraryId: context.read<LibraryProvider>().selectedLibraryId,
);
if (mounted) {
if (error != null) showErrorSnackBar(context, error);
diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dart
index d82d76c5..751f4296 100644
--- a/lib/widgets/expanded_card.dart
+++ b/lib/widgets/expanded_card.dart
@@ -200,6 +200,27 @@ class _ExpandedCardState extends State<ExpandedCard> {
setState(() {});
}
+ /// Which library the live [_item] belongs to, for the per-library cover
+ /// shape. [_item] can be a synthetic fallback without a libraryId, so fall
+ /// back to the cached absorbing entry and then the player.
+ String? _resolveLibraryId() {
+ final direct = _item['libraryId'] as String?;
+ if (direct != null && direct.isNotEmpty) return direct;
+ final lib = context.read<LibraryProvider>();
+ final epId = _episodeId;
+ final key = epId != null ? '$_itemId-$epId' : _itemId;
+ final cached = lib.absorbingItemCache[key]?['libraryId'] as String?;
+ if (cached != null && cached.isNotEmpty) return cached;
+ if (_itemId == widget.player.currentItemId) return widget.player.currentLibraryId;
+ return null;
+ }
+
+ void _reloadCoverShape() {
+ PlayerSettings.getRectangleCoversFor(_resolveLibraryId()).then((v) {
+ if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
+ });
+ }
+
void _reloadButtonOrder() {
PlayerSettings.getCardButtonOrder().then((o) {
if (mounted && o.join(',') != _buttonOrder.join(',')) setState(() => _buttonOrder = o);
@@ -224,9 +245,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
});
}
});
- PlayerSettings.getRectangleCovers().then((v) {
- if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);
- });
+ _reloadCoverShape();
PlayerSettings.getCoverPlayButton().then((v) {
if (mounted && v != _coverPlayButton) setState(() => _coverPlayButton = v);
});
@@ -325,6 +344,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
final fallbackTitle = mounted ? AppLocalizations.of(context)!.unknown : 'Unknown';
newItem ??= {
'id': newItemId,
+ 'libraryId': widget.player.currentLibraryId,
'media': {
'metadata': {
'title': widget.player.currentTitle ?? fallbackTitle,
@@ -357,6 +377,8 @@ class _ExpandedCardState extends State<ExpandedCard> {
_generateBlur();
_fetchChaptersIfNeeded();
_startChapterTracking();
+ // The new item may belong to a different library (per-library cover shape).
+ _reloadCoverShape();
}
void _startChapterTracking() {
@@ -858,6 +880,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
itemId: _itemId,
showPlayButton: !_coverPlayButton,
playButtonSize: 70,
+ libraryId: _resolveLibraryId(),
),
SizedBox(height: compact ? 8 : 24),
..._buildButtonGrid(accent, tt),
@@ -1067,6 +1090,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
coverUrl: _coverUrl, totalDuration: _effectiveDuration, chapters: _chapters,
episodeId: _episodeId,
episodeTitle: _recentEpisode?['title'] as String?,
+ libraryId: _item['libraryId'] as String?,
);
if (mounted) {
if (error != null) showErrorSnackBar(context, error);