feat(metadata): initial implementation of Apple Books source (#1780)
This commit is contained in:
+3
@@ -44,6 +44,9 @@ export const LOCK_FIELDS = [
|
||||
'audibleIdLocked',
|
||||
'audibleRatingLocked',
|
||||
'audibleReviewCountLocked',
|
||||
'applebooksIdLocked',
|
||||
'applebooksRatingLocked',
|
||||
'applebooksReviewCountLocked',
|
||||
'authorsLocked',
|
||||
'categoriesLocked',
|
||||
'moodsLocked',
|
||||
|
||||
+4
@@ -39,6 +39,7 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
|
||||
'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked', 'moodsLocked', 'tagsLocked',
|
||||
'amazonRatingLocked', 'amazonReviewCountLocked', 'goodreadsRatingLocked', 'goodreadsReviewCountLocked',
|
||||
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'hardcoverBookIdLocked', 'googleIdLocked', 'comicvineIdLocked',
|
||||
'applebooksIdLocked', 'applebooksRatingLocked', 'applebooksReviewCountLocked',
|
||||
'ranobedbIdLocked', 'ranobedbRatingLocked'
|
||||
];
|
||||
|
||||
@@ -75,6 +76,9 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
|
||||
comicvineIdLocked: 'Comicvine ID',
|
||||
ranobedbIdLocked: 'Ranobedb ID',
|
||||
ranobedbRatingLocked: 'Ranobedb ★',
|
||||
applebooksIdLocked: 'Apple Books ID',
|
||||
applebooksRatingLocked: 'Apple Books Rating',
|
||||
applebooksReviewCountLocked: 'Apple Books Reviews',
|
||||
};
|
||||
|
||||
isSaving = false;
|
||||
|
||||
@@ -260,6 +260,9 @@ export interface BookDetailMetadata extends BookMetadataFields {
|
||||
lubimyczytacRating?: number;
|
||||
audibleRating?: number;
|
||||
audibleReviewCount?: number;
|
||||
applebooksId?: string;
|
||||
applebooksRating?: number;
|
||||
applebooksReviewCount?: number;
|
||||
abridged?: boolean;
|
||||
audiobookMetadata?: BookDetailAudiobookMetadata;
|
||||
comicMetadata?: BookDetailComicMetadata;
|
||||
@@ -300,6 +303,9 @@ export interface BookDetailMetadata extends BookMetadataFields {
|
||||
audibleIdLocked?: boolean;
|
||||
audibleRatingLocked?: boolean;
|
||||
audibleReviewCountLocked?: boolean;
|
||||
applebooksIdLocked?: boolean;
|
||||
applebooksRatingLocked?: boolean;
|
||||
applebooksReviewCountLocked?: boolean;
|
||||
externalUrlLocked?: boolean;
|
||||
coverLocked?: boolean;
|
||||
audiobookCoverLocked?: boolean;
|
||||
|
||||
@@ -190,6 +190,9 @@ export interface BookMetadata {
|
||||
audibleId?: string;
|
||||
audibleRating?: number | null;
|
||||
audibleReviewCount?: number | null;
|
||||
applebooksId?: string;
|
||||
applebooksRating?: number | null;
|
||||
applebooksReviewCount?: number | null;
|
||||
narrator?: string;
|
||||
abridged?: boolean | null;
|
||||
narratorLocked?: boolean;
|
||||
@@ -238,6 +241,9 @@ export interface BookMetadata {
|
||||
audibleIdLocked?: boolean;
|
||||
audibleRatingLocked?: boolean;
|
||||
audibleReviewCountLocked?: boolean;
|
||||
applebooksIdLocked?: boolean;
|
||||
applebooksRatingLocked?: boolean;
|
||||
applebooksReviewCountLocked?: boolean;
|
||||
coverUpdatedOnLocked?: boolean;
|
||||
authorsLocked?: boolean;
|
||||
categoriesLocked?: boolean;
|
||||
@@ -287,6 +293,9 @@ export interface MetadataClearFlags {
|
||||
audibleId?: boolean;
|
||||
audibleRating?: boolean;
|
||||
audibleReviewCount?: boolean;
|
||||
applebooksId?: boolean;
|
||||
applebooksRating?: boolean;
|
||||
applebooksReviewCount?: boolean;
|
||||
narrator?: boolean;
|
||||
abridged?: boolean;
|
||||
authors?: boolean;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+42
@@ -930,6 +930,48 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (isFieldVisible('applebooksId')) {
|
||||
<div class="field-group metadata-id-field">
|
||||
<label for="applebooksId">{{ t('applebooksId') }} @if (isEmbeddable('applebooksId', book)) { <i class="pi pi-file-export embeddable-indicator" [pTooltip]="t('writtenToFileTooltip')" tooltipPosition="top"></i> }</label>
|
||||
<div class="field-with-lock">
|
||||
<input pSize="small" pInputText id="applebooksId" formControlName="applebooksId"/>
|
||||
@if (!book.metadata!['applebooksIdLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('applebooksId')" severity="success"></p-button>
|
||||
}
|
||||
@if (book.metadata!['applebooksIdLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('applebooksId')" severity="warn"></p-button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (isFieldVisible('applebooksRating')) {
|
||||
<div class="field-group metadata-id-field">
|
||||
<label for="applebooksRating">{{ t('applebooksRating') }} @if (isEmbeddable('applebooksRating', book)) { <i class="pi pi-file-export embeddable-indicator" [pTooltip]="t('writtenToFileTooltip')" tooltipPosition="top"></i> }</label>
|
||||
<div class="field-with-lock">
|
||||
<input pSize="small" pInputText id="applebooksRating" formControlName="applebooksRating"/>
|
||||
@if (!book.metadata!['applebooksRatingLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('applebooksRating')" severity="success"></p-button>
|
||||
}
|
||||
@if (book.metadata!['applebooksRatingLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('applebooksRating')" severity="warn"></p-button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (isFieldVisible('applebooksReviewCount')) {
|
||||
<div class="field-group metadata-id-field">
|
||||
<label for="applebooksReviewCount">{{ t('applebooksReviewCount') }} @if (isEmbeddable('applebooksReviewCount', book)) { <i class="pi pi-file-export embeddable-indicator" [pTooltip]="t('writtenToFileTooltip')" tooltipPosition="top"></i> }</label>
|
||||
<div class="field-with-lock">
|
||||
<input pSize="small" pInputText id="applebooksReviewCount" formControlName="applebooksReviewCount"/>
|
||||
@if (!book.metadata!['applebooksReviewCountLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('applebooksReviewCount')" severity="success"></p-button>
|
||||
}
|
||||
@if (book.metadata!['applebooksReviewCountLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('applebooksReviewCount')" severity="warn"></p-button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
+27
@@ -167,6 +167,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleId: true,
|
||||
audibleRating: true,
|
||||
audibleReviewCount: true,
|
||||
applebooksId: true,
|
||||
applebooksRating: true,
|
||||
applebooksReviewCount: true,
|
||||
};
|
||||
|
||||
private syncProviderFieldsEffect!: EffectRef;
|
||||
@@ -294,6 +297,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleId: new FormControl(""),
|
||||
audibleRating: new FormControl(""),
|
||||
audibleReviewCount: new FormControl(""),
|
||||
applebooksId: new FormControl(""),
|
||||
applebooksRating: new FormControl(""),
|
||||
applebooksReviewCount: new FormControl(""),
|
||||
seriesName: new FormControl(""),
|
||||
seriesNumber: new FormControl(""),
|
||||
seriesTotal: new FormControl(""),
|
||||
@@ -332,6 +338,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleIdLocked: new FormControl(false),
|
||||
audibleRatingLocked: new FormControl(false),
|
||||
audibleReviewCountLocked: new FormControl(false),
|
||||
applebooksIdLocked: new FormControl(false),
|
||||
applebooksRatingLocked: new FormControl(false),
|
||||
applebooksReviewCountLocked: new FormControl(false),
|
||||
seriesNameLocked: new FormControl(false),
|
||||
seriesNumberLocked: new FormControl(false),
|
||||
seriesTotalLocked: new FormControl(false),
|
||||
@@ -434,6 +443,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleId: metadata.audibleId ?? null,
|
||||
audibleRating: metadata.audibleRating ?? null,
|
||||
audibleReviewCount: metadata.audibleReviewCount ?? null,
|
||||
applebooksId: metadata.applebooksId ?? null,
|
||||
applebooksRating: metadata.applebooksRating ?? null,
|
||||
applebooksReviewCount: metadata.applebooksReviewCount ?? null,
|
||||
seriesName: metadata.seriesName ?? null,
|
||||
seriesNumber: metadata.seriesNumber ?? null,
|
||||
seriesTotal: metadata.seriesTotal ?? null,
|
||||
@@ -469,6 +481,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleIdLocked: metadata.audibleIdLocked ?? false,
|
||||
audibleRatingLocked: metadata.audibleRatingLocked ?? false,
|
||||
audibleReviewCountLocked: metadata.audibleReviewCountLocked ?? false,
|
||||
applebooksIdLocked: metadata.applebooksIdLocked ?? false,
|
||||
applebooksRatingLocked: metadata.applebooksRatingLocked ?? false,
|
||||
applebooksReviewCountLocked: metadata.applebooksReviewCountLocked ?? false,
|
||||
seriesNameLocked: metadata.seriesNameLocked ?? false,
|
||||
seriesNumberLocked: metadata.seriesNumberLocked ?? false,
|
||||
seriesTotalLocked: metadata.seriesTotalLocked ?? false,
|
||||
@@ -540,6 +555,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
{key: "audibleIdLocked", control: "audibleId"},
|
||||
{key: "audibleRatingLocked", control: "audibleRating"},
|
||||
{key: "audibleReviewCountLocked", control: "audibleReviewCount"},
|
||||
{key: "applebooksIdLocked", control: "applebooksId"},
|
||||
{key: "applebooksRatingLocked", control: "applebooksRating"},
|
||||
{key: "applebooksReviewCountLocked", control: "applebooksReviewCount"},
|
||||
{key: "pageCountLocked", control: "pageCount"},
|
||||
{key: "descriptionLocked", control: "description"},
|
||||
{key: "seriesNameLocked", control: "seriesName"},
|
||||
@@ -730,6 +748,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleId: form.get("audibleId")?.value,
|
||||
audibleRating: form.get("audibleRating")?.value,
|
||||
audibleReviewCount: form.get("audibleReviewCount")?.value,
|
||||
applebooksId: form.get("applebooksId")?.value,
|
||||
applebooksRating: form.get("applebooksRating")?.value,
|
||||
applebooksReviewCount: form.get("applebooksReviewCount")?.value,
|
||||
language: form.get("language")?.value,
|
||||
seriesName: form.get("seriesName")?.value,
|
||||
seriesNumber: form.get("seriesNumber")?.value,
|
||||
@@ -776,6 +797,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleIdLocked: form.get("audibleIdLocked")?.value,
|
||||
audibleRatingLocked: form.get("audibleRatingLocked")?.value,
|
||||
audibleReviewCountLocked: form.get("audibleReviewCountLocked")?.value,
|
||||
applebooksIdLocked: form.get("applebooksIdLocked")?.value,
|
||||
applebooksRatingLocked: form.get("applebooksRatingLocked")?.value,
|
||||
applebooksReviewCountLocked: form.get("applebooksReviewCountLocked")?.value,
|
||||
seriesNameLocked: form.get("seriesNameLocked")?.value,
|
||||
seriesNumberLocked: form.get("seriesNumberLocked")?.value,
|
||||
seriesTotalLocked: form.get("seriesTotalLocked")?.value,
|
||||
@@ -866,6 +890,9 @@ export class MetadataEditorComponent implements OnInit {
|
||||
audibleId: wasCleared("audibleId"),
|
||||
audibleRating: wasCleared("audibleRating"),
|
||||
audibleReviewCount: wasCleared("audibleReviewCount"),
|
||||
applebooksId: wasCleared("applebooksId"),
|
||||
applebooksRating: wasCleared("applebooksRating"),
|
||||
applebooksReviewCount: wasCleared("applebooksReviewCount"),
|
||||
seriesName: wasCleared("seriesName"),
|
||||
seriesNumber: wasCleared("seriesNumber"),
|
||||
seriesTotal: wasCleared("seriesTotal"),
|
||||
|
||||
+34
-14
@@ -36,7 +36,7 @@ import {CoverComponent} from '../../../../../shared/components/cover/cover.compo
|
||||
export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
form: FormGroup;
|
||||
providers: string[] = [];
|
||||
|
||||
|
||||
bookId!: number;
|
||||
loading = signal(false);
|
||||
searchTriggered = signal(false);
|
||||
@@ -65,7 +65,7 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
|
||||
private subscription: Subscription = new Subscription();
|
||||
private cancelRequest$ = new Subject<void>();
|
||||
|
||||
|
||||
// Signals for state
|
||||
allFetchedMetadata: WritableSignal<BookMetadata[]> = signal([]);
|
||||
metadataByProvider = signal<Map<string, BookMetadata[]>>(new Map());
|
||||
@@ -120,7 +120,7 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
filteredMetadata = computed(() => {
|
||||
const all = this.interleavedMetadata();
|
||||
const filters = this.selectedProviderFilters();
|
||||
|
||||
|
||||
if (filters.has('all')) {
|
||||
return all;
|
||||
} else {
|
||||
@@ -134,7 +134,7 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
providerFilterOptions = computed(() => {
|
||||
const allCount = this.interleavedMetadata().length;
|
||||
const counts = this.providerCounts();
|
||||
|
||||
|
||||
return [
|
||||
{label: `All (${allCount})`, value: 'all'},
|
||||
...Array.from(counts.entries())
|
||||
@@ -196,12 +196,12 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
this.detailLoading.set(false);
|
||||
this.selectedFetchedMetadata.set(null);
|
||||
this.allFetchedMetadata.set([]);
|
||||
|
||||
|
||||
this.providerCounts.set(new Map());
|
||||
this.providerLoading.set(new Map());
|
||||
this.providerCompletionStatus.set(new Map());
|
||||
this.metadataByProvider.set(new Map());
|
||||
|
||||
|
||||
this.selectedProviderFilters.set(new Set(['all']));
|
||||
this.bookId = book.id;
|
||||
|
||||
@@ -256,12 +256,12 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
|
||||
this.loading.set(true);
|
||||
this.allFetchedMetadata.set([]);
|
||||
|
||||
|
||||
const initialCounts = new Map<string, number>();
|
||||
const initialLoading = new Map<string, boolean>();
|
||||
const initialCompletion = new Map<string, boolean>();
|
||||
const initialByProvider = new Map<string, BookMetadata[]>();
|
||||
|
||||
|
||||
providerKeys.forEach((provider: string) => {
|
||||
const providerLower = provider.toLowerCase();
|
||||
initialCounts.set(providerLower, 0);
|
||||
@@ -269,12 +269,12 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
initialCompletion.set(providerLower, false);
|
||||
initialByProvider.set(providerLower, []);
|
||||
});
|
||||
|
||||
|
||||
this.providerCounts.set(initialCounts);
|
||||
this.providerLoading.set(initialLoading);
|
||||
this.providerCompletionStatus.set(initialCompletion);
|
||||
this.metadataByProvider.set(initialByProvider);
|
||||
|
||||
|
||||
this.selectedProviderFilters.set(new Set(['all']));
|
||||
this.cancelRequest$.next();
|
||||
|
||||
@@ -301,7 +301,7 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
this.providerCompletionStatus.update(map => new Map(map).set(provider, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.allFetchedMetadata.update(all => [...all, metadata]);
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -325,7 +325,8 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
}
|
||||
|
||||
private getProviderFromMetadata(metadata: BookMetadata): string | null {
|
||||
if (metadata.audibleId) return 'audible';
|
||||
if (metadata.audibleId) return 'audible';
|
||||
if (metadata.applebooksId) return 'applebooks';
|
||||
if (metadata.asin) return 'amazon';
|
||||
if (metadata.goodreadsId) return 'goodreads';
|
||||
if (metadata.googleId) return 'google';
|
||||
@@ -345,7 +346,7 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
const providerLower = provider.toLowerCase();
|
||||
|
||||
const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey);
|
||||
|
||||
|
||||
this.selectedProviderFilters.update(filters => {
|
||||
const newFilters = new Set(filters);
|
||||
if (isModifierClick) {
|
||||
@@ -471,6 +472,20 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
return `https://www.audible.com/pd/${metadata.audibleId}`;
|
||||
}
|
||||
|
||||
if (metadata.applebooksId) {
|
||||
if (!metadata.applebooksId.includes(":")) {
|
||||
return `https://books.apple.com/us/book/id${metadata.applebooksId}`;
|
||||
}
|
||||
|
||||
const [ wrapperType, itemId ] = metadata.applebooksId.split(":", 2)
|
||||
|
||||
if (wrapperType.toLowerCase() == "audiobook") {
|
||||
return `https://books.apple.com/us/audiobook/id${itemId}`;
|
||||
} else {
|
||||
return `https://books.apple.com/us/book/id${itemId}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata.asin) {
|
||||
return `https://www.amazon.com/dp/${metadata.asin}`;
|
||||
}
|
||||
@@ -516,6 +531,10 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
return 'Audible';
|
||||
}
|
||||
|
||||
if (metadata.applebooksId) {
|
||||
return 'Apple Books';
|
||||
}
|
||||
|
||||
if (metadata.asin) {
|
||||
return 'Amazon';
|
||||
}
|
||||
@@ -553,7 +572,8 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
|
||||
trackByMetadata(index: number, metadata: BookMetadata): string {
|
||||
return metadata.googleId || metadata.goodreadsId || metadata.asin ||
|
||||
metadata.hardcoverId || metadata.comicvineId || metadata.audibleId || index.toString();
|
||||
metadata.hardcoverId || metadata.comicvineId || metadata.audibleId ||
|
||||
metadata.applebooksId || index.toString();
|
||||
}
|
||||
|
||||
onProviderClick(event: Event) {
|
||||
|
||||
+11
-3
@@ -37,7 +37,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'comicvineId',
|
||||
'lubimyczytacId', 'lubimyczytacRating',
|
||||
'ranobedbId', 'ranobedbRating',
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount'
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount',
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
];
|
||||
|
||||
providerSpecificFields: (keyof FieldOptions)[] = [
|
||||
@@ -49,6 +50,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'lubimyczytacId', 'lubimyczytacRating',
|
||||
'ranobedbId', 'ranobedbRating',
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount',
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
];
|
||||
|
||||
nonProviderSpecificFields: (keyof FieldOptions)[] = [
|
||||
@@ -57,8 +59,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'language', 'categories', 'cover', 'pageCount',
|
||||
];
|
||||
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb', 'Audible'];
|
||||
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb', 'Audible'];
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb', 'Audible', 'AppleBooks'];
|
||||
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb', 'Audible', 'AppleBooks'];
|
||||
|
||||
refreshCovers: boolean = false;
|
||||
mergeCategories: boolean = false;
|
||||
@@ -111,6 +113,9 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
// Audible
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount',
|
||||
|
||||
// Apple Books
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
|
||||
// Generic provider-specific
|
||||
'moods', 'tags'
|
||||
];
|
||||
@@ -287,6 +292,9 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'audibleId': 'Audible ID',
|
||||
'audibleRating': 'Audible Rating',
|
||||
'audibleReviewCount': 'Audible Review Count',
|
||||
'applebooksId': 'Apple Books ID',
|
||||
'applebooksRating': 'Apple Books Rating',
|
||||
'applebooksReviewCount': 'Apple Books Review Count',
|
||||
'moods': 'Moods (Hardcover)',
|
||||
'tags': 'Tags (Hardcover)'
|
||||
};
|
||||
|
||||
+3
-1
@@ -24,6 +24,7 @@ export class MetadataProviderFieldSelectorComponent {
|
||||
{labelKey: 'goodreads', fields: ['goodreadsId', 'goodreadsRating', 'goodreadsReviewCount']},
|
||||
{labelKey: 'hardcover', fields: ['hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount']},
|
||||
{labelKey: 'audible', fields: ['audibleId', 'audibleRating', 'audibleReviewCount']},
|
||||
{labelKey: 'applebooks', fields: ['applebooksId', 'applebooksRating', 'applebooksReviewCount']},
|
||||
{labelKey: 'comicvine', fields: ['comicvineId']},
|
||||
{labelKey: 'lubimyczytac', fields: ['lubimyczytacId', 'lubimyczytacRating']},
|
||||
{labelKey: 'ranobedb', fields: ['ranobedbId', 'ranobedbRating']}
|
||||
@@ -45,7 +46,8 @@ export class MetadataProviderFieldSelectorComponent {
|
||||
'comicvineId',
|
||||
'lubimyczytacId', 'lubimyczytacRating',
|
||||
'ranobedbId', 'ranobedbRating',
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount'
|
||||
'audibleId', 'audibleRating', 'audibleReviewCount',
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
];
|
||||
|
||||
private readonly syncSettingsEffect = effect(() => {
|
||||
|
||||
+6
@@ -51,6 +51,9 @@ describe('metadata-refresh-options.model', () => {
|
||||
audibleId: provider('audible'),
|
||||
audibleRating: provider('audible'),
|
||||
audibleReviewCount: provider('audible'),
|
||||
applebooksId: provider('applebooks'),
|
||||
applebooksRating: provider('applebooks'),
|
||||
applebooksReviewCount: provider('applebooks'),
|
||||
moods: provider('google'),
|
||||
tags: provider('google')
|
||||
};
|
||||
@@ -97,6 +100,9 @@ describe('metadata-refresh-options.model', () => {
|
||||
audibleId: true,
|
||||
audibleRating: true,
|
||||
audibleReviewCount: true,
|
||||
applebooksId: true,
|
||||
applebooksRating: true,
|
||||
applebooksReviewCount: true,
|
||||
moods: true,
|
||||
tags: true
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ export interface FieldOptions {
|
||||
audibleId: FieldProvider;
|
||||
audibleRating: FieldProvider;
|
||||
audibleReviewCount: FieldProvider;
|
||||
applebooksId: FieldProvider;
|
||||
applebooksRating: FieldProvider;
|
||||
applebooksReviewCount: FieldProvider;
|
||||
moods: FieldProvider;
|
||||
tags: FieldProvider;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface SidecarIdentifiers {
|
||||
lubimyczytacId?: string;
|
||||
ranobedbId?: string;
|
||||
audibleId?: string;
|
||||
applebooksId?: string;
|
||||
}
|
||||
|
||||
export interface SidecarRating {
|
||||
@@ -37,6 +38,7 @@ export interface SidecarRatings {
|
||||
lubimyczytac?: SidecarRating;
|
||||
ranobedb?: SidecarRating;
|
||||
audible?: SidecarRating;
|
||||
applebooks?: SidecarRating;
|
||||
}
|
||||
|
||||
export interface SidecarBookMetadata {
|
||||
|
||||
+27
-6
@@ -155,15 +155,36 @@
|
||||
<span class="setting-label">RanobeDB</span>
|
||||
</div>
|
||||
@if (ranobedbEnabled) {
|
||||
<div class="setting-options">
|
||||
<div class="config-field">
|
||||
<div class="config-label-row">
|
||||
<p-toggleswitch [(ngModel)]="ranobedbPreferRomaji"></p-toggleswitch>
|
||||
<span class="config-label">{{ t('ranobedbPreferRomajiLabel') }}</span>
|
||||
<div class="setting-options">
|
||||
<div class="config-field">
|
||||
<div class="config-label-row">
|
||||
<p-toggleswitch [(ngModel)]="ranobedbPreferRomaji"></p-toggleswitch>
|
||||
<span class="config-label">{{ t('ranobedbPreferRomajiLabel') }}</span>
|
||||
</div>
|
||||
<p class="config-description">{{ t('ranobedbPreferRomajiDesc') }}</p>
|
||||
</div>
|
||||
<p class="config-description">{{ t('ranobedbPreferRomajiDesc') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-header">
|
||||
|
||||
<p-toggleswitch [(ngModel)]="appleBooksEnabled"></p-toggleswitch>
|
||||
<span class="setting-label">Apple Books</span>
|
||||
</div>
|
||||
@if (appleBooksEnabled) {
|
||||
<div class="setting-options">
|
||||
<div class="config-field">
|
||||
<span class="config-label">{{ t('region') }}</span>
|
||||
<p-select
|
||||
[options]="appleBooksCountries"
|
||||
[(ngModel)]="selectedAppleBooksCountry"
|
||||
[placeholder]="t('selectCountry')"
|
||||
class="config-select">
|
||||
</p-select>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+22
-1
@@ -82,6 +82,20 @@ export class MetadataProviderSettingsComponent {
|
||||
{label: 'audible.in', value: 'in'}
|
||||
];
|
||||
|
||||
appleBooksCountries = [
|
||||
{label: 'US', value: 'US'},
|
||||
{label: 'CA', value: 'CA'},
|
||||
{label: 'GB', value: 'GB'},
|
||||
{label: 'DE', value: 'DE'},
|
||||
{label: 'FR', value: 'FR'},
|
||||
{label: 'PL', value: 'PL'},
|
||||
{label: 'JP', value: 'JP'},
|
||||
{label: 'AU', value: 'AU'},
|
||||
{label: 'IT', value: 'IT'},
|
||||
{label: 'ES', value: 'ES'},
|
||||
]
|
||||
|
||||
selectedAppleBooksCountry = 'US';
|
||||
selectedAudibleDomain = 'com';
|
||||
audibleEnabled: boolean = false;
|
||||
|
||||
@@ -98,6 +112,7 @@ export class MetadataProviderSettingsComponent {
|
||||
ranobedbEnabled: boolean = false;
|
||||
ranobedbPreferRomaji: boolean = false;
|
||||
googleApiKey: string = '';
|
||||
appleBooksEnabled: boolean = false;
|
||||
|
||||
private appSettingsService = inject(AppSettingsService);
|
||||
private messageService = inject(MessageService);
|
||||
@@ -130,6 +145,8 @@ export class MetadataProviderSettingsComponent {
|
||||
this.ranobedbPreferRomaji = metadataProviderSettings?.ranobedb?.preferRomaji ?? false;
|
||||
this.audibleEnabled = metadataProviderSettings?.audible?.enabled ?? false;
|
||||
this.selectedAudibleDomain = metadataProviderSettings?.audible?.domain ?? 'com';
|
||||
this.appleBooksEnabled = metadataProviderSettings?.appleBooks?.enabled ?? false;
|
||||
this.selectedAppleBooksCountry = metadataProviderSettings?.appleBooks?.country ?? 'US';
|
||||
}
|
||||
|
||||
onTokenChange(newToken: string): void {
|
||||
@@ -180,7 +197,11 @@ export class MetadataProviderSettingsComponent {
|
||||
audible: {
|
||||
enabled: this.audibleEnabled,
|
||||
domain: this.selectedAudibleDomain
|
||||
}
|
||||
},
|
||||
appleBooks: {
|
||||
enabled: this.appleBooksEnabled,
|
||||
country: this.selectedAppleBooksCountry,
|
||||
},
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
+3
@@ -240,6 +240,9 @@ export class LibraryMetadataSettingsComponent {
|
||||
audibleId: {p1: null, p2: null, p3: null, p4: null},
|
||||
audibleRating: {p1: null, p2: null, p3: null, p4: null},
|
||||
audibleReviewCount: {p1: null, p2: null, p3: null, p4: null},
|
||||
applebooksId: {p1: null, p2: null, p3: null, p4: null},
|
||||
applebooksRating: {p1: null, p2: null, p3: null, p4: null},
|
||||
applebooksReviewCount: {p1: null, p2: null, p3: null, p4: null},
|
||||
moods: {p1: null, p2: null, p3: null, p4: null},
|
||||
tags: {p1: null, p2: null, p3: null, p4: null}
|
||||
}
|
||||
|
||||
+3
-1
@@ -99,7 +99,9 @@ function buildMetadataRefreshOptions(): MetadataRefreshOptions {
|
||||
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
|
||||
'ranobedbId', 'ranobedbRating', 'audibleId', 'audibleRating',
|
||||
'audibleReviewCount', 'moods', 'tags',
|
||||
'audibleReviewCount',
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
'moods', 'tags',
|
||||
] as const;
|
||||
|
||||
const fieldOptions = Object.fromEntries(
|
||||
|
||||
@@ -6,6 +6,7 @@ const EBOOK_EMBEDDABLE: ReadonlySet<string> = new Set([
|
||||
'categories', 'description', 'seriesName', 'seriesNumber', 'seriesTotal',
|
||||
'isbn10', 'isbn13', 'moods', 'tags', 'ageRating', 'contentRating', 'pageCount',
|
||||
'asin', 'amazonRating', 'amazonReviewCount', 'googleId',
|
||||
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
|
||||
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
|
||||
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
|
||||
'lubimyczytacId', 'lubimyczytacRating',
|
||||
|
||||
@@ -59,7 +59,10 @@ describe('metadata-field.config', () => {
|
||||
ranobedbRating: false,
|
||||
audibleId: false,
|
||||
audibleRating: false,
|
||||
audibleReviewCount: false
|
||||
audibleReviewCount: false,
|
||||
applebooksId: false,
|
||||
applebooksRating: false,
|
||||
applebooksReviewCount: false,
|
||||
};
|
||||
|
||||
expect(getProviderFields(enabledFields).map((field) => field.controlName)).toEqual(['googleId']);
|
||||
|
||||
@@ -46,7 +46,10 @@ export const ALL_METADATA_FIELDS: MetadataFieldConfig[] = [
|
||||
{ label: 'Ranobedb ★', controlName: 'ranobedbRating', lockedKey: 'ranobedbRatingLocked', fetchedKey: 'ranobedbRating', type: 'number', providerKey: 'ranobedbRating' },
|
||||
{ label: 'Audible ID', controlName: 'audibleId', lockedKey: 'audibleIdLocked', fetchedKey: 'audibleId', type: 'string', providerKey: 'audibleId' },
|
||||
{ label: 'Audible ★', controlName: 'audibleRating', lockedKey: 'audibleRatingLocked', fetchedKey: 'audibleRating', type: 'number', providerKey: 'audibleRating' },
|
||||
{ label: 'Audible #', controlName: 'audibleReviewCount', lockedKey: 'audibleReviewCountLocked', fetchedKey: 'audibleReviewCount', type: 'number', providerKey: 'audibleReviewCount' }
|
||||
{ label: 'Audible #', controlName: 'audibleReviewCount', lockedKey: 'audibleReviewCountLocked', fetchedKey: 'audibleReviewCount', type: 'number', providerKey: 'audibleReviewCount' },
|
||||
{ label: 'Apple Books ID', controlName: 'applebooksId', lockedKey: 'applebooksIdLocked', fetchedKey: 'applebooksId', type: 'string', providerKey: 'applebooksId' },
|
||||
{ label: 'Apple Books ★', controlName: 'applebooksRating', lockedKey: 'applebooksRatingLocked', fetchedKey: 'applebooksRating', type: 'number', providerKey: 'applebooksRating' },
|
||||
{ label: 'Apple Books #', controlName: 'applebooksReviewCount', lockedKey: 'applebooksReviewCountLocked', fetchedKey: 'applebooksReviewCount', type: 'number', providerKey: 'applebooksReviewCount' },
|
||||
];
|
||||
|
||||
// Audiobook content metadata fields (narrator/abridged) - now stored at top level of BookMetadata
|
||||
|
||||
@@ -60,6 +60,7 @@ export interface MetadataProviderSettings {
|
||||
douban: Douban;
|
||||
lubimyczytac: Lubimyczytac;
|
||||
audible: Audible;
|
||||
appleBooks: AppleBooks;
|
||||
}
|
||||
|
||||
export interface Amazon {
|
||||
@@ -106,6 +107,11 @@ export interface Audible {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface AppleBooks {
|
||||
enabled: boolean;
|
||||
country: string;
|
||||
}
|
||||
|
||||
export interface FormatWriteSettings {
|
||||
enabled: boolean;
|
||||
maxFileSizeInMb: number;
|
||||
@@ -222,6 +228,9 @@ export interface MetadataProviderSpecificFields {
|
||||
audibleId: boolean;
|
||||
audibleRating: boolean;
|
||||
audibleReviewCount: boolean;
|
||||
applebooksId: boolean;
|
||||
applebooksRating: boolean;
|
||||
applebooksReviewCount: boolean;
|
||||
}
|
||||
|
||||
export enum AppSettingKey {
|
||||
|
||||
Reference in New Issue
Block a user