feat(metadata): initial implementation of Apple Books source (#1780)

This commit is contained in:
James Ward
2026-09-12 14:10:20 -04:00
committed by GitHub
parent 828806a4aa
commit 0660e1d6dc
70 changed files with 1132 additions and 51 deletions
@@ -86,6 +86,8 @@ export type RuleField =
| 'contentRating'
| 'audibleRating'
| 'audibleReviewCount'
| 'applebooksRating'
| 'applebooksReviewCount'
| 'abridged'
| 'audiobookDuration'
| 'audiobookCodec'
@@ -181,6 +183,8 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
contentRating: {label: 'contentRating'},
audibleRating: {label: 'audibleRating', type: 'decimal', max: 5},
audibleReviewCount: {label: 'audibleReviewCount', type: 'number'},
applebooksRating: {label: 'applebooksRating', type: 'decimal', max: 5},
applebooksReviewCount: {label: 'applebooksReviewCount', type: 'number'},
abridged: {label: 'abridged', type: 'boolean'},
audiobookDuration: {label: 'audiobookDuration', type: 'number'},
audiobookCodec: {label: 'audiobookCodec'},
@@ -204,7 +208,7 @@ const FIELD_GROUPS: FieldGroup[] = [
{ translationKey: 'bookInfo', fields: ['title', 'subtitle', 'description', 'authors', 'categories', 'publisher', 'language', 'pageCount', 'ageRating', 'contentRating'] },
{ translationKey: 'series', fields: ['seriesName', 'seriesNumber', 'seriesTotal', 'seriesStatus', 'seriesGaps', 'seriesPosition'] },
{ translationKey: 'dates', fields: ['publishedDate', 'dateFinished', 'lastReadTime', 'addedOn'] },
{ translationKey: 'ratingsReviews', fields: ['personalRating', 'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'hardcoverRating', 'hardcoverReviewCount', 'ranobedbRating', 'lubimyczytacRating', 'audibleRating', 'audibleReviewCount'] },
{ translationKey: 'ratingsReviews', fields: ['personalRating', 'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'hardcoverRating', 'hardcoverReviewCount', 'ranobedbRating', 'lubimyczytacRating', 'audibleRating', 'audibleReviewCount', 'applebooksRating', 'applebooksReviewCount'] },
{ translationKey: 'qualityMetadata', fields: ['metadataScore', 'metadataPresence'] },
{ translationKey: 'tagsMoods', fields: ['moods', 'tags'] },
{ translationKey: 'audiobook', fields: ['narrator', 'abridged', 'audiobookDuration', 'audiobookCodec', 'audiobookChapterCount', 'audiobookBitrate'] },
@@ -388,12 +392,14 @@ export class MagicShelfComponent implements OnInit {
{label: this.t.translate('magicShelf.metadataFields.ranobedbRating'), value: 'ranobedbRating'},
{label: this.t.translate('magicShelf.metadataFields.lubimyczytacRating'), value: 'lubimyczytacRating'},
{label: this.t.translate('magicShelf.metadataFields.audibleRating'), value: 'audibleRating'},
{label: this.t.translate('magicShelf.metadataFields.applebooksRating'), value: 'applebooksRating'},
]},
{ label: this.t.translate('magicShelf.metadataFieldGroups.reviewCounts'), items: [
{label: this.t.translate('magicShelf.metadataFields.amazonReviewCount'), value: 'amazonReviewCount'},
{label: this.t.translate('magicShelf.metadataFields.goodreadsReviewCount'), value: 'goodreadsReviewCount'},
{label: this.t.translate('magicShelf.metadataFields.hardcoverReviewCount'), value: 'hardcoverReviewCount'},
{label: this.t.translate('magicShelf.metadataFields.audibleReviewCount'), value: 'audibleReviewCount'},
{label: this.t.translate('magicShelf.metadataFields.applebooksReviewCount'), value: 'applebooksReviewCount'},
]},
{ label: this.t.translate('magicShelf.metadataFieldGroups.externalIds'), items: [
{label: this.t.translate('magicShelf.metadataFields.goodreadsId'), value: 'goodreadsId'},
@@ -403,6 +409,7 @@ export class MagicShelfComponent implements OnInit {
{label: this.t.translate('magicShelf.metadataFields.lubimyczytacId'), value: 'lubimyczytacId'},
{label: this.t.translate('magicShelf.metadataFields.ranobedbId'), value: 'ranobedbId'},
{label: this.t.translate('magicShelf.metadataFields.comicvineId'), value: 'comicvineId'},
{label: this.t.translate('magicShelf.metadataFields.applebooksId'), value: 'applebooksId'},
]},
{ label: this.t.translate('magicShelf.metadataFieldGroups.audiobook'), items: [
{label: this.t.translate('magicShelf.metadataFields.narrator'), value: 'narrator'},
@@ -349,6 +349,10 @@ export class BookRuleEvaluatorService {
return book.metadata?.audibleRating;
case 'audibleReviewCount':
return book.metadata?.audibleReviewCount;
case 'applebooksRating':
return book.metadata?.applebooksRating;
case 'applebooksReviewCount':
return book.metadata?.applebooksReviewCount;
case 'abridged':
return book.metadata?.abridged;
case 'audiobookDuration':
@@ -536,14 +540,17 @@ export class BookRuleEvaluatorService {
case 'ranobedbRating': return book.metadata?.ranobedbRating;
case 'lubimyczytacRating': return book.metadata?.lubimyczytacRating;
case 'audibleRating': return book.metadata?.audibleRating;
case 'applebooksRating': return book.metadata?.applebooksRating;
case 'amazonReviewCount': return book.metadata?.amazonReviewCount;
case 'goodreadsReviewCount': return book.metadata?.goodreadsReviewCount;
case 'hardcoverReviewCount': return book.metadata?.hardcoverReviewCount;
case 'audibleReviewCount': return book.metadata?.audibleReviewCount;
case 'applebooksReviewCount': return book.metadata?.applebooksReviewCount;
case 'goodreadsId': return book.metadata?.goodreadsId;
case 'hardcoverId': return book.metadata?.hardcoverId;
case 'googleId': return book.metadata?.googleId;
case 'audibleId': return book.metadata?.audibleId;
case 'applebooksId': return book.metadata?.applebooksId;
case 'lubimyczytacId': return book.metadata?.lubimyczytacId;
case 'ranobedbId': return book.metadata?.ranobedbId;
case 'comicvineId': return book.metadata?.comicvineId;