Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Let admins edit podcast show info, bulk-select episodes, and delete missing books

Barnabas5a59a708d991
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 7d190ded..24ae47df 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -1909,6 +1909,69 @@
"adminLibraryFolders": "folders",
"adminLibrarySize": "size",
"adminLibraryDuration": "duration",
+ "adminLibraryIssues": "{count, plural, =1{1 missing or invalid item} other{{count} missing or invalid items}}",
+ "@adminLibraryIssues": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "adminLibraryReview": "Review",
+ "adminMissingTitle": "Missing Items",
+ "adminMissingSubtitle": "Entries in {library} whose files are missing or unreadable",
+ "@adminMissingSubtitle": {
+ "placeholders": {
+ "library": {
+ "type": "String"
+ }
+ }
+ },
+ "adminMissingNone": "No missing or invalid items",
+ "adminMissingBadge": "Missing",
+ "adminInvalidBadge": "Invalid",
+ "adminMissingDeleteTitle": "Remove entry",
+ "adminMissingDeleteOneContent": "Remove \"{title}\" from Audiobookshelf? The files on disk are not deleted.",
+ "@adminMissingDeleteOneContent": {
+ "placeholders": {
+ "title": {
+ "type": "String"
+ }
+ }
+ },
+ "adminMissingDeleteManyContent": "Remove {count} entries from Audiobookshelf? The files on disk are not deleted.",
+ "@adminMissingDeleteManyContent": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "adminMissingDeleteCount": "Delete {count}",
+ "@adminMissingDeleteCount": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "adminMissingRemovedOne": "Removed {title}",
+ "@adminMissingRemovedOne": {
+ "placeholders": {
+ "title": {
+ "type": "String"
+ }
+ }
+ },
+ "adminMissingRemovedMany": "{count, plural, =1{Removed 1 entry} other{Removed {count} entries}}",
+ "@adminMissingRemovedMany": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "adminMissingDeleteFailed": "Failed to delete entry",
"adminMatchAction": "Match",
"adminMatchingStarted": "Matching started for {name}",
"@adminMatchingStarted": {
@@ -2323,6 +2386,14 @@
"adminPodcastsNoResults": "No results",
"adminPodcastsPodcastMatched": "Podcast matched and updated",
"adminPodcastsFailedMatch": "Failed to match podcast",
+ "adminPodcastsSelectAll": "Select all",
+ "adminPodcastsSelectAllNew": "New only",
+ "adminPodcastsEditInfo": "Edit Info",
+ "adminPodcastsEditInfoSubtitle": "Change title, description, cover and more",
+ "adminPodcastsEditTitle": "Edit Podcast",
+ "adminPodcastsReleaseDate": "Release date",
+ "adminPodcastsExplicit": "Explicit",
+ "adminPodcastsExplicitSubtitle": "Mark this podcast as explicit",
"episodeListEpisodeFallback": "Episode",
"episodeListUnknownPodcast": "Unknown Podcast",
"episodeListMarkedFinished": "{count, plural, =1{1 episode marked as finished} other{{count} episodes marked as finished}}",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 4f05b8f2..a6121b05 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -6494,6 +6494,90 @@ abstract class AppLocalizations {
/// **'duration'**
String get adminLibraryDuration;
+ /// No description provided for @adminLibraryIssues.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 missing or invalid item} other{{count} missing or invalid items}}'**
+ String adminLibraryIssues(int count);
+
+ /// No description provided for @adminLibraryReview.
+ ///
+ /// In en, this message translates to:
+ /// **'Review'**
+ String get adminLibraryReview;
+
+ /// No description provided for @adminMissingTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Missing Items'**
+ String get adminMissingTitle;
+
+ /// No description provided for @adminMissingSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Entries in {library} whose files are missing or unreadable'**
+ String adminMissingSubtitle(String library);
+
+ /// No description provided for @adminMissingNone.
+ ///
+ /// In en, this message translates to:
+ /// **'No missing or invalid items'**
+ String get adminMissingNone;
+
+ /// No description provided for @adminMissingBadge.
+ ///
+ /// In en, this message translates to:
+ /// **'Missing'**
+ String get adminMissingBadge;
+
+ /// No description provided for @adminInvalidBadge.
+ ///
+ /// In en, this message translates to:
+ /// **'Invalid'**
+ String get adminInvalidBadge;
+
+ /// No description provided for @adminMissingDeleteTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove entry'**
+ String get adminMissingDeleteTitle;
+
+ /// No description provided for @adminMissingDeleteOneContent.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove \"{title}\" from Audiobookshelf? The files on disk are not deleted.'**
+ String adminMissingDeleteOneContent(String title);
+
+ /// No description provided for @adminMissingDeleteManyContent.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove {count} entries from Audiobookshelf? The files on disk are not deleted.'**
+ String adminMissingDeleteManyContent(int count);
+
+ /// No description provided for @adminMissingDeleteCount.
+ ///
+ /// In en, this message translates to:
+ /// **'Delete {count}'**
+ String adminMissingDeleteCount(int count);
+
+ /// No description provided for @adminMissingRemovedOne.
+ ///
+ /// In en, this message translates to:
+ /// **'Removed {title}'**
+ String adminMissingRemovedOne(String title);
+
+ /// No description provided for @adminMissingRemovedMany.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{Removed 1 entry} other{Removed {count} entries}}'**
+ String adminMissingRemovedMany(int count);
+
+ /// No description provided for @adminMissingDeleteFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Failed to delete entry'**
+ String get adminMissingDeleteFailed;
+
/// No description provided for @adminMatchAction.
///
/// In en, this message translates to:
@@ -7634,6 +7718,54 @@ abstract class AppLocalizations {
/// **'Failed to match podcast'**
String get adminPodcastsFailedMatch;
+ /// No description provided for @adminPodcastsSelectAll.
+ ///
+ /// In en, this message translates to:
+ /// **'Select all'**
+ String get adminPodcastsSelectAll;
+
+ /// No description provided for @adminPodcastsSelectAllNew.
+ ///
+ /// In en, this message translates to:
+ /// **'New only'**
+ String get adminPodcastsSelectAllNew;
+
+ /// No description provided for @adminPodcastsEditInfo.
+ ///
+ /// In en, this message translates to:
+ /// **'Edit Info'**
+ String get adminPodcastsEditInfo;
+
+ /// No description provided for @adminPodcastsEditInfoSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Change title, description, cover and more'**
+ String get adminPodcastsEditInfoSubtitle;
+
+ /// No description provided for @adminPodcastsEditTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Edit Podcast'**
+ String get adminPodcastsEditTitle;
+
+ /// No description provided for @adminPodcastsReleaseDate.
+ ///
+ /// In en, this message translates to:
+ /// **'Release date'**
+ String get adminPodcastsReleaseDate;
+
+ /// No description provided for @adminPodcastsExplicit.
+ ///
+ /// In en, this message translates to:
+ /// **'Explicit'**
+ String get adminPodcastsExplicit;
+
+ /// No description provided for @adminPodcastsExplicitSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Mark this podcast as explicit'**
+ String get adminPodcastsExplicitSubtitle;
+
/// No description provided for @episodeListEpisodeFallback.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index ad182bd3..c6ef3678 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -3612,6 +3612,74 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get adminLibraryDuration => 'Dauer';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Abgleichen';
@@ -4264,6 +4332,31 @@ class AppLocalizationsDe extends AppLocalizations {
String get adminPodcastsFailedMatch =>
'Podcast konnte nicht zugeordnet werden';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index f8e358a6..ffd80528 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index d5a5e469..009668c9 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 8569907c..72e8ba7b 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 6a639839..deb579b5 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -3581,6 +3581,74 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4223,6 +4291,31 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index 5ccf125e..1287b634 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index e6820324..2d34c2c4 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index b8125927..44ae896b 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 15fc7317..8fe85d36 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index cf326d03..4c618e6d 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -3579,6 +3579,74 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4221,6 +4289,31 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index 0decaa37..ee9ed962 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -3582,6 +3582,74 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4224,6 +4292,31 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 35d5292b..10f5bae2 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -3505,6 +3505,74 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get adminLibraryDuration => 'duration';
+ @override
+ String adminLibraryIssues(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing or invalid items',
+ one: '1 missing or invalid item',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminLibraryReview => 'Review';
+
+ @override
+ String get adminMissingTitle => 'Missing Items';
+
+ @override
+ String adminMissingSubtitle(String library) {
+ return 'Entries in $library whose files are missing or unreadable';
+ }
+
+ @override
+ String get adminMissingNone => 'No missing or invalid items';
+
+ @override
+ String get adminMissingBadge => 'Missing';
+
+ @override
+ String get adminInvalidBadge => 'Invalid';
+
+ @override
+ String get adminMissingDeleteTitle => 'Remove entry';
+
+ @override
+ String adminMissingDeleteOneContent(String title) {
+ return 'Remove \"$title\" from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteManyContent(int count) {
+ return 'Remove $count entries from Audiobookshelf? The files on disk are not deleted.';
+ }
+
+ @override
+ String adminMissingDeleteCount(int count) {
+ return 'Delete $count';
+ }
+
+ @override
+ String adminMissingRemovedOne(String title) {
+ return 'Removed $title';
+ }
+
+ @override
+ String adminMissingRemovedMany(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Removed $count entries',
+ one: 'Removed 1 entry',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get adminMissingDeleteFailed => 'Failed to delete entry';
+
@override
String get adminMatchAction => 'Match';
@@ -4147,6 +4215,31 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get adminPodcastsFailedMatch => 'Failed to match podcast';
+ @override
+ String get adminPodcastsSelectAll => 'Select all';
+
+ @override
+ String get adminPodcastsSelectAllNew => 'New only';
+
+ @override
+ String get adminPodcastsEditInfo => 'Edit Info';
+
+ @override
+ String get adminPodcastsEditInfoSubtitle =>
+ 'Change title, description, cover and more';
+
+ @override
+ String get adminPodcastsEditTitle => 'Edit Podcast';
+
+ @override
+ String get adminPodcastsReleaseDate => 'Release date';
+
+ @override
+ String get adminPodcastsExplicit => 'Explicit';
+
+ @override
+ String get adminPodcastsExplicitSubtitle => 'Mark this podcast as explicit';
+
@override
String get episodeListEpisodeFallback => 'Episode';
diff --git a/lib/screens/admin_missing_items_screen.dart b/lib/screens/admin_missing_items_screen.dart
new file mode 100644
index 00000000..8513746c
--- /dev/null
+++ b/lib/screens/admin_missing_items_screen.dart
@@ -0,0 +1,350 @@
+import 'package:flutter/material.dart';
+import 'package:provider/provider.dart';
+import 'package:cached_network_image/cached_network_image.dart';
+import '../l10n/app_localizations.dart';
+import '../providers/auth_provider.dart';
+import '../widgets/absorb_page_header.dart';
+
+/// Admin cleanup screen: lists the items a library has flagged as "issues" -
+/// missing (files removed from disk) or invalid (present but unparseable) - and
+/// lets an admin delete the stale entries. Delete is the plain soft delete
+/// (DELETE /api/items/:id, no hard flag), so it removes the Audiobookshelf entry
+/// only and never touches files on disk. That's what makes it safe for the
+/// staging-library workflow where the audio has already been moved elsewhere.
+class AdminMissingItemsScreen extends StatefulWidget {
+ final Map<String, dynamic> library;
+ const AdminMissingItemsScreen({super.key, required this.library});
+
+ @override
+ State<AdminMissingItemsScreen> createState() => _AdminMissingItemsScreenState();
+}
+
+class _AdminMissingItemsScreenState extends State<AdminMissingItemsScreen> {
+ bool _loading = true;
+ List<dynamic> _items = [];
+ final Set<String> _deleting = {};
+ final Set<String> _selected = {};
+
+ String get _libraryId => widget.library['id'] as String? ?? '';
+ String get _libraryName => widget.library['name'] as String? ?? '';
+ bool get _selecting => _selected.isNotEmpty;
+
+ @override
+ void initState() {
+ super.initState();
+ _load();
+ }
+
+ Future<void> _load() async {
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ setState(() => _loading = true);
+ final items = await api.getIssueItems(_libraryId);
+ if (!mounted) return;
+ setState(() {
+ _items = items;
+ _selected.removeWhere((id) => !items.any((it) => (it as Map)['id'] == id));
+ _loading = false;
+ });
+ }
+
+ void _msg(String s) => ScaffoldMessenger.of(context)
+ ..clearSnackBars()
+ ..showSnackBar(SnackBar(
+ content: Text(s),
+ behavior: SnackBarBehavior.floating,
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
+ ));
+
+ String _titleOf(Map<String, dynamic> item) =>
+ ((item['media'] as Map?)?['metadata'] as Map?)?['title'] as String? ??
+ AppLocalizations.of(context)!.unknown;
+
+ String _authorOf(Map<String, dynamic> item) =>
+ ((item['media'] as Map?)?['metadata'] as Map?)?['authorName'] as String? ?? '';
+
+ void _toggle(String id) {
+ setState(() {
+ if (_selected.contains(id)) {
+ _selected.remove(id);
+ } else {
+ _selected.add(id);
+ }
+ });
+ }
+
+ void _selectAll() {
+ setState(() {
+ _selected
+ ..clear()
+ ..addAll(_items.map((it) => (it as Map)['id'] as String? ?? '').where((id) => id.isNotEmpty));
+ });
+ }
+
+ Future<void> _deleteOne(Map<String, dynamic> item) async {
+ final l = AppLocalizations.of(context)!;
+ final title = _titleOf(item);
+ final yes = await _confirm(l.adminMissingDeleteTitle, l.adminMissingDeleteOneContent(title));
+ if (yes != true) return;
+ final id = item['id'] as String? ?? '';
+ if (id.isEmpty) return;
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ setState(() => _deleting.add(id));
+ final status = await api.deleteLibraryItem(id);
+ if (!mounted) return;
+ setState(() => _deleting.remove(id));
+ if (status == 200) {
+ setState(() {
+ _items.removeWhere((it) => (it as Map)['id'] == id);
+ _selected.remove(id);
+ });
+ _msg(l.adminMissingRemovedOne(title));
+ } else if (status == 403) {
+ _msg(l.deletePermissionRequired);
+ } else {
+ _msg(l.adminMissingDeleteFailed);
+ }
+ }
+
+ Future<void> _deleteSelected() async {
+ if (_selected.isEmpty) return;
+ final l = AppLocalizations.of(context)!;
+ final count = _selected.length;
+ final yes = await _confirm(l.adminMissingDeleteTitle, l.adminMissingDeleteManyContent(count));
+ if (yes != true) return;
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ final ids = Set<String>.from(_selected);
+ setState(() {
+ _deleting.addAll(ids);
+ _selected.clear();
+ });
+ int deleted = 0;
+ bool forbidden = false;
+ for (final id in ids) {
+ final status = await api.deleteLibraryItem(id);
+ if (status == 200) {
+ deleted++;
+ _items.removeWhere((it) => (it as Map)['id'] == id);
+ } else if (status == 403) {
+ forbidden = true;
+ break;
+ }
+ }
+ if (!mounted) return;
+ setState(() => _deleting.removeAll(ids));
+ if (forbidden && deleted == 0) {
+ _msg(l.deletePermissionRequired);
+ } else {
+ _msg(l.adminMissingRemovedMany(deleted));
+ }
+ }
+
+ Future<bool?> _confirm(String title, String content) => showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: Text(title),
+ content: Text(content),
+ actions: [
+ TextButton(onPressed: () => Navigator.pop(ctx, false), child: Text(AppLocalizations.of(context)!.cancel)),
+ TextButton(
+ onPressed: () => Navigator.pop(ctx, true),
+ child: Text(AppLocalizations.of(context)!.delete, style: TextStyle(color: Colors.red.shade300)),
+ ),
+ ],
+ ),
+ );
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+
+ return Scaffold(
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
+ body: SafeArea(
+ child: Column(children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(4, 4, 8, 0),
+ child: Row(children: [
+ IconButton(
+ icon: Icon(Icons.arrow_back_rounded, color: cs.onSurfaceVariant),
+ onPressed: () => Navigator.pop(context),
+ ),
+ Expanded(child: AbsorbPageHeader(title: l.adminMissingTitle, padding: EdgeInsets.zero)),
+ if (_items.isNotEmpty)
+ IconButton(
+ icon: Icon(Icons.checklist_rounded, color: _selecting ? cs.primary : cs.onSurface.withValues(alpha: 0.3), size: 22),
+ tooltip: l.adminPodcastsSelectMultipleTooltip,
+ onPressed: () => _selecting ? setState(_selected.clear) : _selectAll(),
+ ),
+ ]),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(l.adminMissingSubtitle(_libraryName), style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ ),
+ ),
+ Expanded(child: _body(cs, tt, l)),
+ ]),
+ ),
+ );
+ }
+
+ Widget _body(ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ if (_loading) return const Center(child: CircularProgressIndicator(strokeWidth: 2));
+ if (_items.isEmpty) {
+ return Center(
+ child: Column(mainAxisSize: MainAxisSize.min, children: [
+ Icon(Icons.check_circle_outline_rounded, size: 44, color: cs.onSurface.withValues(alpha: 0.12)),
+ const SizedBox(height: 10),
+ Text(l.adminMissingNone, style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.4))),
+ ]),
+ );
+ }
+
+ return Stack(children: [
+ RefreshIndicator(
+ onRefresh: _load,
+ child: ListView.builder(
+ padding: EdgeInsets.fromLTRB(16, 4, 16, _selecting ? 88 : 16),
+ itemCount: _items.length,
+ itemBuilder: (_, i) => _itemRow(_items[i] as Map<String, dynamic>, cs, tt, l),
+ ),
+ ),
+ if (_selecting)
+ Positioned(
+ left: 16,
+ right: 16,
+ bottom: 16,
+ child: Row(children: [
+ GestureDetector(
+ onTap: () => setState(_selected.clear),
+ child: Container(
+ padding: const EdgeInsets.all(14),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHigh,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.15), blurRadius: 12, offset: const Offset(0, 4))],
+ ),
+ child: Icon(Icons.close_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.6)),
+ ),
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: GestureDetector(
+ onTap: _deleteSelected,
+ child: Container(
+ padding: const EdgeInsets.symmetric(vertical: 14),
+ decoration: BoxDecoration(
+ color: Colors.red.shade400,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: [BoxShadow(color: Colors.red.withValues(alpha: 0.3), blurRadius: 12, offset: const Offset(0, 4))],
+ ),
+ child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
+ const Icon(Icons.delete_outline_rounded, size: 18, color: Colors.white),
+ const SizedBox(width: 8),
+ Text(l.adminMissingDeleteCount(_selected.length),
+ style: tt.bodySmall?.copyWith(color: Colors.white, fontWeight: FontWeight.w700)),
+ ]),
+ ),
+ ),
+ ),
+ ]),
+ ),
+ ]);
+ }
+
+ Widget _itemRow(Map<String, dynamic> item, ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ final api = context.read<AuthProvider>().apiService;
+ final id = item['id'] as String? ?? '';
+ final title = _titleOf(item);
+ final author = _authorOf(item);
+ final isMissing = item['isMissing'] == true;
+ final selected = _selected.contains(id);
+ final busy = _deleting.contains(id);
+
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 6),
+ child: GestureDetector(
+ onTap: _selecting ? () => _toggle(id) : null,
+ onLongPress: () => _toggle(id),
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ decoration: BoxDecoration(
+ color: selected ? Colors.red.withValues(alpha: 0.08) : cs.surfaceContainerHigh,
+ borderRadius: BorderRadius.circular(12),
+ border: selected ? Border.all(color: Colors.red.withValues(alpha: 0.2)) : null,
+ ),
+ child: Row(children: [
+ if (_selecting) ...[
+ Icon(selected ? Icons.check_circle_rounded : Icons.circle_outlined,
+ size: 20, color: selected ? Colors.red.shade300 : cs.onSurface.withValues(alpha: 0.2)),
+ const SizedBox(width: 10),
+ ],
+ ClipRRect(
+ borderRadius: BorderRadius.circular(6),
+ child: SizedBox(
+ width: 40,
+ height: 40,
+ child: api == null
+ ? _coverPlaceholder(cs)
+ : CachedNetworkImage(
+ imageUrl: api.getCoverUrl(id, width: 120),
+ httpHeaders: api.mediaHeaders,
+ fit: BoxFit.cover,
+ placeholder: (_, __) => _coverPlaceholder(cs),
+ errorWidget: (_, __, ___) => _coverPlaceholder(cs),
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(title, style: tt.bodySmall?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface),
+ maxLines: 1, overflow: TextOverflow.ellipsis),
+ const SizedBox(height: 3),
+ Row(children: [
+ _badge(cs, tt, isMissing ? l.adminMissingBadge : l.adminInvalidBadge, isMissing ? Colors.red : Colors.orange),
+ if (author.isNotEmpty) ...[
+ const SizedBox(width: 8),
+ Flexible(
+ child: Text(author,
+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6), fontSize: 11),
+ maxLines: 1, overflow: TextOverflow.ellipsis),
+ ),
+ ],
+ ]),
+ ]),
+ ),
+ if (!_selecting) ...[
+ const SizedBox(width: 8),
+ busy
+ ? SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurfaceVariant.withValues(alpha: 0.4)))
+ : IconButton(
+ icon: Icon(Icons.delete_outline_rounded, size: 20, color: Colors.red.shade300),
+ tooltip: l.delete,
+ onPressed: () => _deleteOne(item),
+ ),
+ ],
+ ]),
+ ),
+ ),
+ );
+ }
+
+ Widget _badge(ColorScheme cs, TextTheme tt, String label, Color color) => Container(
+ padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2),
+ decoration: BoxDecoration(color: color.withValues(alpha: 0.14), borderRadius: BorderRadius.circular(6)),
+ child: Text(label, style: tt.labelSmall?.copyWith(color: color, fontWeight: FontWeight.w700, fontSize: 10)),
+ );
+
+ Widget _coverPlaceholder(ColorScheme cs) => Container(
+ color: cs.surfaceContainerHighest,
+ child: Icon(Icons.book_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.3)),
+ );
+}
diff --git a/lib/screens/admin_podcasts_screen.dart b/lib/screens/admin_podcasts_screen.dart
index 7c78921a..9300ecbf 100644
--- a/lib/screens/admin_podcasts_screen.dart
+++ b/lib/screens/admin_podcasts_screen.dart
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
+import 'podcast_edit_screen.dart';
import '../widgets/absorb_page_header.dart';
import '../widgets/html_description.dart';
import '../l10n/app_localizations.dart';
@@ -1376,7 +1377,9 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
bool get _isSelecting => _selectedFeedIndices.isNotEmpty;
void _enterFeedSelectMode() {
- // Select the first non-downloaded episode to kick off select mode
+ // Prefer the first not-yet-downloaded episode so the common "grab the new
+ // ones" case starts pre-populated; fall back to the first episode so select
+ // mode still engages when everything is already downloaded.
final dlTitles = _episodes.map((e) => (e['title'] as String? ?? '').toLowerCase()).toSet();
for (var i = 0; i < _feedEpisodes.length; i++) {
final ep = _feedEpisodes[i] as Map<String, dynamic>;
@@ -1386,6 +1389,7 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
return;
}
}
+ if (_feedEpisodes.isNotEmpty) setState(() => _selectedFeedIndices.add(0));
}
void _toggleFeedSelection(int index) {
@@ -1398,6 +1402,26 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
});
}
+ void _selectAllFeed() {
+ setState(() {
+ _selectedFeedIndices
+ ..clear()
+ ..addAll(List.generate(_feedEpisodes.length, (i) => i));
+ });
+ }
+
+ void _selectAllNewFeed() {
+ final dlTitles = _episodes.map((e) => (e['title'] as String? ?? '').toLowerCase()).toSet();
+ setState(() {
+ _selectedFeedIndices.clear();
+ for (var i = 0; i < _feedEpisodes.length; i++) {
+ final ep = _feedEpisodes[i] as Map<String, dynamic>;
+ final title = (ep['title'] as String? ?? '').toLowerCase();
+ if (!dlTitles.contains(title)) _selectedFeedIndices.add(i);
+ }
+ });
+ }
+
Future<void> _downloadSelected() async {
if (_selectedFeedIndices.isEmpty) return;
final eps = _selectedFeedIndices
@@ -1416,6 +1440,25 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
widget.onChanged();
}
+ Widget _feedQuickSelectChip(ColorScheme cs, TextTheme tt, IconData icon, String label, VoidCallback onTap) {
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 9),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHighest,
+ borderRadius: BorderRadius.circular(20),
+ boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.12), blurRadius: 8, offset: const Offset(0, 2))],
+ ),
+ child: Row(mainAxisSize: MainAxisSize.min, children: [
+ Icon(icon, size: 15, color: cs.primary),
+ const SizedBox(width: 6),
+ Text(label, style: tt.labelSmall?.copyWith(color: cs.onSurface, fontWeight: FontWeight.w600)),
+ ]),
+ ),
+ );
+ }
+
Widget _buildFeedTab(ColorScheme cs, TextTheme tt) {
final l = AppLocalizations.of(context)!;
if (_loadingFeed) return const Center(child: CircularProgressIndicator(strokeWidth: 2));
@@ -1485,37 +1528,46 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
// Download selected bar
if (_isSelecting)
Positioned(left: 16, right: 16, bottom: 16,
- child: Row(children: [
- GestureDetector(
- onTap: () => setState(() => _selectedFeedIndices.clear()),
- child: Container(
- padding: const EdgeInsets.all(14),
- decoration: BoxDecoration(
- color: cs.surfaceContainerHigh,
- borderRadius: BorderRadius.circular(14),
- boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.15), blurRadius: 12, offset: const Offset(0, 4))],
+ child: Column(mainAxisSize: MainAxisSize.min, children: [
+ // Quick-select helpers
+ Row(children: [
+ _feedQuickSelectChip(cs, tt, Icons.playlist_add_check_rounded, l.adminPodcastsSelectAllNew, _selectAllNewFeed),
+ const SizedBox(width: 8),
+ _feedQuickSelectChip(cs, tt, Icons.done_all_rounded, l.adminPodcastsSelectAll, _selectAllFeed),
+ ]),
+ const SizedBox(height: 10),
+ Row(children: [
+ GestureDetector(
+ onTap: () => setState(() => _selectedFeedIndices.clear()),
+ child: Container(
+ padding: const EdgeInsets.all(14),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHigh,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.15), blurRadius: 12, offset: const Offset(0, 4))],
+ ),
+ child: Icon(Icons.close_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.6)),
),
- child: Icon(Icons.close_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.6)),
),
- ),
- const SizedBox(width: 10),
- Expanded(child: GestureDetector(
- onTap: _downloadSelected,
- child: Container(
- padding: const EdgeInsets.symmetric(vertical: 14),
- decoration: BoxDecoration(
- color: cs.primary,
- borderRadius: BorderRadius.circular(14),
- boxShadow: [BoxShadow(color: cs.primary.withValues(alpha: 0.3), blurRadius: 12, offset: const Offset(0, 4))],
+ const SizedBox(width: 10),
+ Expanded(child: GestureDetector(
+ onTap: _downloadSelected,
+ child: Container(
+ padding: const EdgeInsets.symmetric(vertical: 14),
+ decoration: BoxDecoration(
+ color: cs.primary,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: [BoxShadow(color: cs.primary.withValues(alpha: 0.3), blurRadius: 12, offset: const Offset(0, 4))],
+ ),
+ child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
+ Icon(Icons.download_rounded, size: 18, color: cs.onPrimary),
+ const SizedBox(width: 8),
+ Text(l.adminPodcastsDownloadEpisodesCount(_selectedFeedIndices.length),
+ style: tt.bodySmall?.copyWith(color: cs.onPrimary, fontWeight: FontWeight.w700)),
+ ]),
),
- child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
- Icon(Icons.download_rounded, size: 18, color: cs.onPrimary),
- const SizedBox(width: 8),
- Text(l.adminPodcastsDownloadEpisodesCount(_selectedFeedIndices.length),
- style: tt.bodySmall?.copyWith(color: cs.onPrimary, fontWeight: FontWeight.w700)),
- ]),
- ),
- )),
+ )),
+ ]),
]),
),
]);
@@ -1646,6 +1698,27 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
);
}),
+ // Edit show info
+ if (context.read<AuthProvider>().isAdmin)
+ GestureDetector(
+ onTap: _openEditInfo,
+ child: Container(
+ margin: const EdgeInsets.only(bottom: 10),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
+ decoration: BoxDecoration(color: cs.surfaceContainerHigh, borderRadius: BorderRadius.circular(14)),
+ child: Row(children: [
+ Icon(Icons.edit_note_rounded, size: 20, color: cs.onSurfaceVariant),
+ const SizedBox(width: 12),
+ Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(l.adminPodcastsEditInfo, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
+ const SizedBox(height: 2),
+ Text(l.adminPodcastsEditInfoSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ ])),
+ Icon(Icons.chevron_right_rounded, size: 20, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ ]),
+ ),
+ ),
+
// Match podcast metadata
GestureDetector(
onTap: () => _showMatchSheet(cs, tt),
@@ -1846,6 +1919,21 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
]);
}
+ void _openEditInfo() {
+ final tags = (_media['tags'] as List<dynamic>?)?.whereType<String>().toList() ?? <String>[];
+ Navigator.push(context, MaterialPageRoute(
+ builder: (_) => PodcastEditScreen(
+ itemId: _podcastId,
+ metadata: Map<String, dynamic>.from(_metadata),
+ tags: tags,
+ onSaved: () {
+ _reloadItem();
+ widget.onChanged();
+ },
+ ),
+ ));
+ }
+
void _showMatchSheet(ColorScheme cs, TextTheme tt) {
showModalBottomSheet(
context: context,
diff --git a/lib/screens/admin_screen.dart b/lib/screens/admin_screen.dart
index 2ccf1e01..7265e3c8 100644
--- a/lib/screens/admin_screen.dart
+++ b/lib/screens/admin_screen.dart
@@ -7,6 +7,7 @@ import '../widgets/rmab_config_sheet.dart';
import '../l10n/app_localizations.dart';
import 'admin_users_screen.dart';
import 'admin_podcasts_screen.dart';
+import 'admin_missing_items_screen.dart';
import 'admin_email_screen.dart';
import 'admin_api_keys_screen.dart';
import 'admin_libraries_screen.dart';
@@ -27,6 +28,7 @@ class _AdminScreenState extends State<AdminScreen> {
List<dynamic> _backups = [];
List<dynamic> _sessions = [];
final Map<String, Map<String, dynamic>> _libraryStats = {};
+ final Map<String, int> _libraryIssues = {};
String? _serverVersion;
String? _rmabBaseUrl;
String? _rmabApiToken;
@@ -59,6 +61,7 @@ class _AdminScreenState extends State<AdminScreen> {
if (id.isNotEmpty) {
final stats = await api.getLibraryStats(id);
if (stats != null) _libraryStats[id] = stats;
+ _libraryIssues[id] = await api.getIssueItemCount(id);
}
}
_rmabBaseUrl = await ScopedPrefs.getString(kRmabBaseUrlKey);
@@ -378,9 +381,41 @@ class _AdminScreenState extends State<AdminScreen> {
const SizedBox(width: 8),
Expanded(child: _libAct(cs, tt, Icons.auto_fix_high_rounded, isMatching ? l.adminMatching : l.adminMatchAll, isMatching, () => _matchLib(id, name))),
]),
+ if ((_libraryIssues[id] ?? 0) > 0) ...[
+ const SizedBox(height: 8),
+ _issuesRow(cs, tt, lib, _libraryIssues[id]!),
+ ],
])));
}
+ Widget _issuesRow(ColorScheme cs, TextTheme tt, dynamic lib, int count) {
+ final l = AppLocalizations.of(context)!;
+ return GestureDetector(
+ onTap: () async {
+ await Navigator.push(context, MaterialPageRoute(
+ builder: (_) => AdminMissingItemsScreen(library: Map<String, dynamic>.from(lib as Map))));
+ _loadAll();
+ },
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ decoration: BoxDecoration(
+ color: Colors.orange.withValues(alpha: 0.1),
+ borderRadius: BorderRadius.circular(10),
+ border: Border.all(color: Colors.orange.withValues(alpha: 0.25)),
+ ),
+ child: Row(children: [
+ Icon(Icons.report_problem_rounded, size: 16, color: Colors.orange.shade700),
+ const SizedBox(width: 8),
+ Expanded(child: Text(l.adminLibraryIssues(count),
+ style: tt.labelMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.7), fontWeight: FontWeight.w600))),
+ Text(l.adminLibraryReview, style: tt.labelSmall?.copyWith(color: Colors.orange.shade700, fontWeight: FontWeight.w700)),
+ const SizedBox(width: 2),
+ Icon(Icons.chevron_right_rounded, size: 16, color: Colors.orange.shade700),
+ ]),
+ ),
+ );
+ }
+
Widget _mini(ColorScheme cs, TextTheme tt, String v, String l) => Padding(padding: const EdgeInsets.only(right: 20), child: Column(
crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(v, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface, fontSize: 13)),
diff --git a/lib/screens/podcast_edit_screen.dart b/lib/screens/podcast_edit_screen.dart
new file mode 100644
index 00000000..bcf5e6b3
--- /dev/null
+++ b/lib/screens/podcast_edit_screen.dart
@@ -0,0 +1,340 @@
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:provider/provider.dart';
+import 'package:file_picker/file_picker.dart';
+import 'package:cached_network_image/cached_network_image.dart';
+import '../l10n/app_localizations.dart';
+import '../providers/auth_provider.dart';
+import '../providers/library_provider.dart';
+
+/// Full-screen editor for a podcast show's info (title, author, description,
+/// genres, tags, language, release date, explicit flag and cover art).
+/// Admin-only; saves via [ApiService.updateItemMedia], which PATCHes
+/// /api/items/:id/media. ABS merges the metadata partially, so only the fields
+/// edited here are sent - feedUrl, itunes ids etc. are left untouched.
+class PodcastEditScreen extends StatefulWidget {
+ final String itemId;
+ final Map<String, dynamic> metadata;
+ final List<String> tags;
+ final VoidCallback? onSaved;
+
+ const PodcastEditScreen({
+ super.key,
+ required this.itemId,
+ required this.metadata,
+ this.tags = const [],
+ this.onSaved,
+ });
+
+ @override
+ State<PodcastEditScreen> createState() => _PodcastEditScreenState();
+}
+
+class _PodcastEditScreenState extends State<PodcastEditScreen> {
+ late final TextEditingController _titleCtrl;
+ late final TextEditingController _authorCtrl;
+ late final TextEditingController _descCtrl;
+ late final TextEditingController _genresCtrl;
+ late final TextEditingController _tagsCtrl;
+ late final TextEditingController _languageCtrl;
+ late final TextEditingController _releaseDateCtrl;
+ late final TextEditingController _coverUrlCtrl;
+ late final TextEditingController _coverSearchCtrl;
+
+ bool _explicit = false;
+ bool _saving = false;
+ String? _coverFilePath;
+ int _coverVersion = 0;
+ List<String> _coverResults = [];
+ bool _coverSearching = false;
+
+ @override
+ void initState() {
+ super.initState();
+ final m = widget.metadata;
+ _titleCtrl = TextEditingController(text: m['title'] as String? ?? '');
+ _authorCtrl = TextEditingController(text: m['author'] as String? ?? '');
+ _descCtrl = TextEditingController(text: m['description'] as String? ?? '');
+ final genres = (m['genres'] as List<dynamic>?)?.whereType<String>() ?? const [];
+ _genresCtrl = TextEditingController(text: genres.join(', '));
+ _tagsCtrl = TextEditingController(text: widget.tags.join(', '));
+ _languageCtrl = TextEditingController(text: m['language'] as String? ?? '');
+ _releaseDateCtrl = TextEditingController(text: m['releaseDate'] as String? ?? '');
+ _coverUrlCtrl = TextEditingController();
+ _coverSearchCtrl = TextEditingController(text: m['title'] as String? ?? '');
+ _explicit = m['explicit'] == true;
+ }
+
+ @override
+ void dispose() {
+ _titleCtrl.dispose();
+ _authorCtrl.dispose();
+ _descCtrl.dispose();
+ _genresCtrl.dispose();
+ _tagsCtrl.dispose();
+ _languageCtrl.dispose();
+ _releaseDateCtrl.dispose();
+ _coverUrlCtrl.dispose();
+ _coverSearchCtrl.dispose();
+ super.dispose();
+ }
+
+ void _msg(String s) => ScaffoldMessenger.of(context)
+ ..clearSnackBars()
+ ..showSnackBar(SnackBar(
+ content: Text(s),
+ behavior: SnackBarBehavior.floating,
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
+ ));
+
+ List<String> _splitList(String text) => text.trim().isEmpty
+ ? <String>[]
+ : text.split(',').map((e) => e.trim()).where((e) => e.isNotEmpty).toList();
+
+ Future<void> _pickCover() async {
+ final result = await FilePicker.platform.pickFiles(type: FileType.image, allowMultiple: false);
+ if (result != null && result.files.single.path != null) {
+ setState(() {
+ _coverFilePath = result.files.single.path;
+ _coverUrlCtrl.clear();
+ });
+ }
+ }
+
+ Future<void> _searchCovers() async {
+ final api = context.read<AuthProvider>().apiService;
+ final query = _coverSearchCtrl.text.trim();
+ if (api == null || query.isEmpty) return;
+ setState(() => _coverSearching = true);
+ final results = await api.searchCovers(query, author: _authorCtrl.text.trim(), provider: 'itunes');
+ if (!mounted) return;
+ setState(() {
+ _coverResults = results;
+ _coverSearching = false;
+ });
+ }
+
+ Future<void> _save() async {
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ setState(() => _saving = true);
+
+ final metadata = <String, dynamic>{
+ 'title': _titleCtrl.text.trim(),
+ 'author': _authorCtrl.text.trim(),
+ 'description': _descCtrl.text.trim(),
+ 'releaseDate': _releaseDateCtrl.text.trim(),
+ 'language': _languageCtrl.text.trim(),
+ 'explicit': _explicit,
+ 'genres': _splitList(_genresCtrl.text),
+ };
+
+ bool ok = await api.updateItemMedia(widget.itemId, metadata, tags: _splitList(_tagsCtrl.text));
+ if (ok && _coverFilePath != null) {
+ ok = await api.uploadItemCover(widget.itemId, _coverFilePath!);
+ } else if (ok && _coverUrlCtrl.text.trim().isNotEmpty) {
+ ok = await api.updateItemCoverUrl(widget.itemId, _coverUrlCtrl.text.trim());
+ }
+
+ if (!mounted) return;
+ final l = AppLocalizations.of(context)!;
+ setState(() {
+ _saving = false;
+ if (ok) {
+ _coverVersion++;
+ _coverFilePath = null;
+ _coverResults = [];
+ }
+ });
+ _msg(ok ? l.metadataUpdated : l.failedToUpdateMetadata);
+ if (ok) {
+ context.read<LibraryProvider>().refresh();
+ widget.onSaved?.call();
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+ final auth = context.read<AuthProvider>();
+ final serverCover = '${auth.serverUrl}/api/items/${widget.itemId}/cover';
+
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(l.adminPodcastsEditTitle),
+ actions: [
+ Padding(
+ padding: const EdgeInsets.only(right: 8),
+ child: FilledButton.icon(
+ onPressed: _saving ? null : _save,
+ icon: _saving
+ ? SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: cs.onPrimary))
+ : const Icon(Icons.check_rounded, size: 18),
+ label: Text(l.save),
+ style: FilledButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
+ ),
+ ),
+ ],
+ ),
+ body: ListView(
+ padding: EdgeInsets.fromLTRB(20, 12, 20, 32 + MediaQuery.of(context).viewInsets.bottom),
+ children: [
+ // Cover
+ Center(
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(12),
+ child: SizedBox(
+ width: 160,
+ height: 160,
+ child: _coverPreview(cs, serverCover),
+ ),
+ ),
+ ),
+ const SizedBox(height: 12),
+ Row(children: [
+ Expanded(child: OutlinedButton.icon(
+ onPressed: _pickCover,
+ icon: const Icon(Icons.image_rounded, size: 18),
+ label: Text(l.file),
+ style: OutlinedButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
+ )),
+ ]),
+ const SizedBox(height: 8),
+ TextField(
+ controller: _coverUrlCtrl,
+ decoration: InputDecoration(
+ labelText: l.coverUrlLabel,
+ hintText: l.coverUrlHint,
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
+ contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ isDense: true,
+ ),
+ style: tt.bodyMedium,
+ onChanged: (_) => setState(() => _coverFilePath = null),
+ ),
+ const SizedBox(height: 8),
+ // Cover search (iTunes)
+ Row(children: [
+ Expanded(child: TextField(
+ controller: _coverSearchCtrl,
+ decoration: InputDecoration(
+ labelText: l.coverSearchTitle,
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
+ contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ isDense: true,
+ ),
+ style: tt.bodyMedium,
+ onSubmitted: (_) => _searchCovers(),
+ )),
+ const SizedBox(width: 8),
+ FilledButton.tonalIcon(
+ onPressed: _coverSearching ? null : _searchCovers,
+ icon: _coverSearching
+ ? const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2))
+ : const Icon(Icons.search_rounded, size: 18),
+ label: Text(l.search),
+ ),
+ ]),
+ if (_coverResults.isNotEmpty) ...[
+ const SizedBox(height: 12),
+ GridView.count(
+ shrinkWrap: true,
+ physics: const NeverScrollableScrollPhysics(),
+ crossAxisCount: 3,
+ mainAxisSpacing: 8,
+ crossAxisSpacing: 8,
+ children: [
+ for (final url in _coverResults)
+ GestureDetector(
+ onTap: () => setState(() {
+ _coverUrlCtrl.text = url;
+ _coverFilePath = null;
+ }),
+ child: Container(
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHighest,
+ borderRadius: BorderRadius.circular(8),
+ border: _coverUrlCtrl.text == url ? Border.all(color: cs.primary, width: 2) : null,
+ ),
+ clipBehavior: Clip.antiAlias,
+ child: CachedNetworkImage(imageUrl: url, fit: BoxFit.cover),
+ ),
+ ),
+ ],
+ ),
+ ],
+ const SizedBox(height: 24),
+
+ // Text fields
+ _field(l.titleLabel, _titleCtrl, tt),
+ _field(l.authorLabel, _authorCtrl, tt),
+ _field(l.descriptionLabel, _descCtrl, tt, maxLines: 6),
+ _field(l.genresLabel, _genresCtrl, tt, hint: l.commaSeparated),
+ _field(l.tagsLabel, _tagsCtrl, tt, hint: l.commaSeparated),
+ Row(children: [
+ Expanded(child: _field(l.languageLabel, _languageCtrl, tt)),
+ const SizedBox(width: 12),
+ Expanded(child: _field(l.adminPodcastsReleaseDate, _releaseDateCtrl, tt)),
+ ]),
+ const SizedBox(height: 4),
+ // Explicit
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
+ decoration: BoxDecoration(color: cs.surfaceContainerHigh, borderRadius: BorderRadius.circular(12)),
+ child: SwitchListTile(
+ contentPadding: EdgeInsets.zero,
+ title: Text(l.adminPodcastsExplicit, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
+ subtitle: Text(l.adminPodcastsExplicitSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ value: _explicit,
+ onChanged: (v) => setState(() => _explicit = v),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _coverPreview(ColorScheme cs, String serverCover) {
+ if (_coverFilePath != null) {
+ return Image.file(File(_coverFilePath!), fit: BoxFit.cover, errorBuilder: (_, __, ___) => _coverPlaceholder(cs));
+ }
+ final url = _coverUrlCtrl.text.trim();
+ final headers = context.read<AuthProvider>().apiService?.mediaHeaders;
+ if (url.isNotEmpty) {
+ return CachedNetworkImage(imageUrl: url, fit: BoxFit.cover,
+ placeholder: (_, __) => _coverPlaceholder(cs), errorWidget: (_, __, ___) => _coverPlaceholder(cs));
+ }
+ return CachedNetworkImage(
+ imageUrl: '$serverCover?v=$_coverVersion',
+ httpHeaders: headers,
+ fit: BoxFit.cover,
+ placeholder: (_, __) => _coverPlaceholder(cs),
+ errorWidget: (_, __, ___) => _coverPlaceholder(cs),
+ );
+ }
+
+ Widget _coverPlaceholder(ColorScheme cs) => Container(
+ color: cs.surfaceContainerHighest,
+ child: Icon(Icons.podcasts_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.3), size: 32),
+ );
+
+ Widget _field(String label, TextEditingController ctrl, TextTheme tt, {int maxLines = 1, String? hint}) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 12),
+ child: TextField(
+ controller: ctrl,
+ maxLines: maxLines,
+ decoration: InputDecoration(
+ labelText: label,
+ hintText: hint,
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
+ contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ isDense: true,
+ ),
+ style: tt.bodyMedium,
+ ),
+ );
+ }
+}
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 13d6a439..9d763fde 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -158,6 +158,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
String? _rmabBaseUrl;
String? _rmabApiToken;
bool _loaded = false;
+ int _adminIssueCount = 0;
String _downloadLocationLabel = 'App Internal Storage (Default)';
bool _canPickDownloadLocation = false;
int _totalDownloadSizeBytes = 0;
@@ -196,9 +197,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
super.initState();
_localServerController = TextEditingController();
_loadSettings();
+ _loadAdminIssueCount();
PlayerSettings.settingsChanged.addListener(_onExternalSettingsChange);
}
+ /// Sum missing/invalid item counts across all libraries so the Server Admin
+ /// button can show a badge when there's cleanup to do, without opening admin.
+ Future<void> _loadAdminIssueCount() async {
+ final auth = context.read<AuthProvider>();
+ if (!auth.isAdmin) return;
+ final api = auth.apiService;
+ if (api == null) return;
+ final ids = context
+ .read<LibraryProvider>()
+ .libraries
+ .map((l) => (l as Map)['id'] as String? ?? '')
+ .where((s) => s.isNotEmpty)
+ .toList();
+ if (ids.isEmpty) return;
+ final counts = await Future.wait(ids.map(api.getIssueItemCount));
+ if (!mounted) return;
+ setState(() => _adminIssueCount = counts.fold<int>(0, (a, b) => a + b));
+ }
+
@override
void dispose() {
PlayerSettings.settingsChanged.removeListener(_onExternalSettingsChange);
@@ -1185,10 +1206,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(14),
- onTap: () {
- Navigator.push(context, MaterialPageRoute(
+ onTap: () async {
+ await Navigator.push(context, MaterialPageRoute(
builder: (_) => const AdminScreen(),
));
+ _loadAdminIssueCount();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
@@ -1205,6 +1227,22 @@ class _SettingsScreenState extends State<SettingsScreen> {
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
],
)),
+ if (_adminIssueCount > 0) ...[
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
+ decoration: BoxDecoration(
+ color: Colors.orange.withValues(alpha: 0.15),
+ borderRadius: BorderRadius.circular(10),
+ ),
+ child: Row(mainAxisSize: MainAxisSize.min, children: [
+ Icon(Icons.report_problem_rounded, size: 12, color: Colors.orange.shade700),
+ const SizedBox(width: 4),
+ Text('$_adminIssueCount', style: tt.labelSmall?.copyWith(
+ color: Colors.orange.shade700, fontWeight: FontWeight.w700)),
+ ]),
+ ),
+ const SizedBox(width: 10),
+ ],
Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
],
),
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index 74e164dc..30be5ea5 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -447,6 +447,38 @@ class ApiService {
return null;
}
+ /// Fetch every library item the server has flagged with an issue - missing
+ /// (files gone from disk) or invalid (present but unparseable). ABS exposes
+ /// both under the plain `filter=issues` param. Each result carries the
+ /// `isMissing` / `isInvalid` booleans so the caller can tell them apart.
+ Future<List<dynamic>> getIssueItems(String libraryId) async {
+ final all = <dynamic>[];
+ var page = 0;
+ while (page < 100) {
+ final data = await getLibraryItems(
+ libraryId,
+ filter: 'issues',
+ page: page,
+ limit: 100,
+ sort: 'media.metadata.title',
+ desc: 0,
+ );
+ final results = data?['results'] as List? ?? const [];
+ all.addAll(results);
+ final total = data?['total'] as int?;
+ page++;
+ if (results.isEmpty || (total != null && all.length >= total)) break;
+ }
+ return all;
+ }
+
+ /// Count of issue items in a library (missing + invalid), fetched cheaply by
+ /// reading `total` from a single-item issues query. Returns 0 on any failure.
+ Future<int> getIssueItemCount(String libraryId) async {
+ final data = await getLibraryItems(libraryId, filter: 'issues', limit: 1);
+ return data?['total'] as int? ?? 0;
+ }
+
/// Build a cover image URL for a library item.
String getCoverUrl(String itemId, {int? width = 400, int? updatedAt}) {
var url = '$_cleanBaseUrl/api/items/$itemId/cover?token=$token';