refactor(metadata): consolidate metadata providers on the frontend (#2719)

This commit is contained in:
Alex
2026-09-21 16:29:01 +01:00
committed by GitHub
parent c0f6f9cb80
commit 6b70d54662
100 changed files with 1659 additions and 5467 deletions
@@ -88,6 +88,9 @@
[pTooltip]="t('fetchMetadataTooltip')" [pTooltip]="t('fetchMetadataTooltip')"
tooltipPosition="top"/> tooltipPosition="top"/>
</div> </div>
@if (metadataLookupMessage(); as message) {
<small role="status">{{ t(message) }}</small>
}
</div> </div>
</div> </div>
@@ -1,13 +1,20 @@
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {signal} from '@angular/core'; import {signal} from '@angular/core';
import {provideHttpClient} from '@angular/common/http';
import {HttpTestingController, provideHttpClientTesting} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
import type {AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete'; import type {AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete';
import {MessageService} from '@openng/optimus-ui/api';
import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog'; import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
import {TranslocoService} from '@jsverse/transloco';
import {provideTanStackQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {Observable, Subject, throwError} from 'rxjs'; import {Observable, Subject, throwError} from 'rxjs';
import {afterEach, describe, expect, it, vi} from 'vitest'; import {afterEach, describe, expect, it, vi} from 'vitest';
import {Book, BookMetadata} from '../../model/book.model'; import {createAuthServiceStub} from '../../../../core/testing/query-testing';
import {AuthService} from '../../../../shared/service/auth.service';
import {Book} from '../../model/book.model';
import {Library} from '../../model/library.model'; import {Library} from '../../model/library.model';
import {BookMetadataService} from '../../service/book-metadata.service';
import {BookService} from '../../service/book.service'; import {BookService} from '../../service/book.service';
import {LibraryService} from '../../service/library.service'; import {LibraryService} from '../../service/library.service';
import {AddPhysicalBookDialogComponent} from './add-physical-book-dialog.component'; import {AddPhysicalBookDialogComponent} from './add-physical-book-dialog.component';
@@ -37,12 +44,6 @@ describe('AddPhysicalBookDialogComponent', () => {
}; };
} }
function createMetadata(overrides: Partial<BookMetadata> = {}): BookMetadata {
return {
bookId: 0,
...overrides,
};
}
function createHarness(options: { function createHarness(options: {
dialogData?: {libraryId?: number}; dialogData?: {libraryId?: number};
@@ -55,7 +56,6 @@ describe('AddPhysicalBookDialogComponent', () => {
publishers: string[]; publishers: string[];
series: string[]; series: string[];
}; };
lookupResult$?: Observable<BookMetadata>;
createResult$?: Observable<Book>; createResult$?: Observable<Book>;
} = {}) { } = {}) {
const libraries = signal<Library[]>(options.librariesData ?? [ const libraries = signal<Library[]>(options.librariesData ?? [
@@ -70,19 +70,23 @@ describe('AddPhysicalBookDialogComponent', () => {
publishers: [], publishers: [],
series: [], series: [],
}); });
const lookupResult$ = options.lookupResult$ ?? new Subject<BookMetadata>();
const createResult$ = options.createResult$ ?? new Subject<Book>(); const createResult$ = options.createResult$ ?? new Subject<Book>();
const lookupByIsbn = vi.fn(() => lookupResult$);
const createPhysicalBook = vi.fn(() => createResult$); const createPhysicalBook = vi.fn(() => createResult$);
const dialogRef = {close: vi.fn()}; const dialogRef = {close: vi.fn()};
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
provideHttpClient(),
provideHttpClientTesting(),
provideTanStackQuery(new QueryClient()),
{provide: DynamicDialogConfig, useValue: {data: options.dialogData ?? {}}}, {provide: DynamicDialogConfig, useValue: {data: options.dialogData ?? {}}},
{provide: DynamicDialogRef, useValue: dialogRef}, {provide: DynamicDialogRef, useValue: dialogRef},
{provide: AppSettingsService, useValue: {appSettings: signal(null)}},
{provide: AuthService, useValue: createAuthServiceStub()},
{provide: BookService, useValue: {uniqueMetadata, createPhysicalBook}}, {provide: BookService, useValue: {uniqueMetadata, createPhysicalBook}},
{provide: BookMetadataService, useValue: {lookupByIsbn}},
{provide: LibraryService, useValue: {libraries}}, {provide: LibraryService, useValue: {libraries}},
{provide: MessageService, useValue: {add: vi.fn()}},
{provide: TranslocoService, useValue: {translate: (key: string) => key}},
], ],
}); });
@@ -93,11 +97,10 @@ describe('AddPhysicalBookDialogComponent', () => {
component, component,
libraries, libraries,
uniqueMetadata, uniqueMetadata,
lookupResult$,
createResult$, createResult$,
lookupByIsbn,
createPhysicalBook, createPhysicalBook,
dialogRef, dialogRef,
http: TestBed.inject(HttpTestingController),
}; };
} }
@@ -173,62 +176,6 @@ describe('AddPhysicalBookDialogComponent', () => {
expect(duplicateInput.value).toBe(''); expect(duplicateInput.value).toBe('');
}); });
it('trims the isbn, hydrates metadata fields, and clears the fetching flag on success', () => {
const lookupResult$ = new Subject<BookMetadata>();
const {component, lookupByIsbn} = createHarness({lookupResult$});
component.isbn = ' 9780441172719 ';
component.fetchMetadataByIsbn();
expect(lookupByIsbn).toHaveBeenCalledWith('9780441172719');
expect(component.isFetchingMetadata()).toBe(true);
lookupResult$.next(createMetadata({
title: 'Dune',
authors: ['Frank Herbert'],
description: 'Arrakis.',
publisher: 'Ace',
publishedDate: '1965',
language: 'en',
pageCount: 412,
categories: ['Science Fiction'],
thumbnailUrl: 'https://covers.example/dune.jpg',
}));
lookupResult$.complete();
expect(component.title).toBe('Dune');
expect(component.authors).toEqual(['Frank Herbert']);
expect(component.description).toBe('Arrakis.');
expect(component.publisher).toBe('Ace');
expect(component.publishedDate).toBe('1965');
expect(component.language).toBe('en');
expect(component.pageCount).toBe(412);
expect(component.categories).toEqual(['Science Fiction']);
expect(component.coverUrl).toBe('https://covers.example/dune.jpg');
expect(component.isFetchingMetadata()).toBe(false);
});
it('does not start isbn lookup for blank or in-flight requests and clears the flag on error', () => {
const {component, lookupByIsbn} = createHarness();
component.isbn = ' ';
component.fetchMetadataByIsbn();
expect(lookupByIsbn).not.toHaveBeenCalled();
component.isbn = '9780441172719';
component.isFetchingMetadata.set(true);
component.fetchMetadataByIsbn();
expect(lookupByIsbn).not.toHaveBeenCalled();
component.isFetchingMetadata.set(false);
lookupByIsbn.mockReturnValueOnce(throwError(() => new Error('lookup failed')));
component.fetchMetadataByIsbn();
expect(lookupByIsbn).toHaveBeenCalledWith('9780441172719');
expect(component.isFetchingMetadata()).toBe(false);
});
it('gates creation on required fields and does not submit when already loading', () => { it('gates creation on required fields and does not submit when already loading', () => {
const {component, createPhysicalBook} = createHarness(); const {component, createPhysicalBook} = createHarness();
@@ -8,11 +8,12 @@ import {Select} from '@openng/optimus-ui/select';
import {Textarea} from '@openng/optimus-ui/textarea'; import {Textarea} from '@openng/optimus-ui/textarea';
import {InputNumber} from '@openng/optimus-ui/inputnumber'; import {InputNumber} from '@openng/optimus-ui/inputnumber';
import {AutoComplete, AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete'; import {AutoComplete, AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete';
import {QueryClient} from '@tanstack/angular-query-experimental';
import {BookService} from '../../service/book.service'; import {BookService} from '../../service/book.service';
import {BookMetadataService} from '../../service/book-metadata.service';
import {LibraryService} from '../../service/library.service'; import {LibraryService} from '../../service/library.service';
import {Library} from '../../model/library.model'; import {Library} from '../../model/library.model';
import {CreatePhysicalBookRequest} from '../../model/book.model'; import {CreatePhysicalBookRequest} from '../../model/book.model';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {TranslocoDirective} from '@jsverse/transloco'; import {TranslocoDirective} from '@jsverse/transloco';
@Component({ @Component({
@@ -36,7 +37,8 @@ export class AddPhysicalBookDialogComponent {
private dynamicDialogRef = inject(DynamicDialogRef); private dynamicDialogRef = inject(DynamicDialogRef);
private dialogConfig = inject(DynamicDialogConfig); private dialogConfig = inject(DynamicDialogConfig);
private bookService = inject(BookService); private bookService = inject(BookService);
private bookMetadataService = inject(BookMetadataService); private queryClient = inject(QueryClient);
private sources = inject(MetadataSourceQueryService);
private libraryService = inject(LibraryService); private libraryService = inject(LibraryService);
selectedLibraryId: number | null = null; selectedLibraryId: number | null = null;
@@ -59,6 +61,7 @@ export class AddPhysicalBookDialogComponent {
coverUrl: string | null = null; coverUrl: string | null = null;
isLoading = signal(false); isLoading = signal(false);
isFetchingMetadata = signal(false); isFetchingMetadata = signal(false);
readonly metadataLookupMessage = signal<'metadataNotFound' | 'metadataLookupFailed' | null>(null);
private readonly initializeSelectedLibraryEffect = effect(() => { private readonly initializeSelectedLibraryEffect = effect(() => {
const libraries = this.libraries; const libraries = this.libraries;
if (libraries.length === 0) { if (libraries.length === 0) {
@@ -115,28 +118,33 @@ export class AddPhysicalBookDialogComponent {
(event.originalEvent.target as HTMLInputElement).value = ''; (event.originalEvent.target as HTMLInputElement).value = '';
} }
fetchMetadataByIsbn(): void { async fetchMetadataByIsbn(): Promise<void> {
const isbnValue = this.isbn.trim(); const isbnValue = this.isbn.trim();
if (!isbnValue || this.isFetchingMetadata()) return; if (!isbnValue || this.isFetchingMetadata()) return;
this.isFetchingMetadata.set(true); this.isFetchingMetadata.set(true);
this.bookMetadataService.lookupByIsbn(isbnValue).subscribe({ this.metadataLookupMessage.set(null);
next: (metadata) => { try {
if (metadata.title) this.title = metadata.title; const metadata = await this.queryClient.query(this.sources.isbnLookup(isbnValue));
if (metadata.authors?.length) this.authors = [...metadata.authors]; if (!metadata) {
if (metadata.description) this.description = metadata.description; this.metadataLookupMessage.set('metadataNotFound');
if (metadata.publisher) this.publisher = metadata.publisher; return;
if (metadata.publishedDate) this.publishedDate = metadata.publishedDate;
if (metadata.language) this.language = metadata.language;
if (metadata.pageCount) this.pageCount = metadata.pageCount;
if (metadata.categories?.length) this.categories = [...metadata.categories];
this.coverUrl = metadata.thumbnailUrl || null;
this.isFetchingMetadata.set(false);
},
error: () => {
this.isFetchingMetadata.set(false);
} }
});
if (metadata.title) this.title = metadata.title;
if (metadata.authors?.length) this.authors = [...metadata.authors];
if (metadata.description) this.description = metadata.description;
if (metadata.publisher) this.publisher = metadata.publisher;
if (metadata.publishedDate) this.publishedDate = metadata.publishedDate;
if (metadata.language) this.language = metadata.language;
if (metadata.pageCount) this.pageCount = metadata.pageCount;
if (metadata.categories?.length) this.categories = [...metadata.categories];
this.coverUrl = metadata.thumbnailUrl || null;
} catch {
this.metadataLookupMessage.set('metadataLookupFailed');
} finally {
this.isFetchingMetadata.set(false);
}
} }
cancel(): void { cancel(): void {
@@ -22,7 +22,7 @@
<div class="fields-grid"> <div class="fields-grid">
@for (field of lockableFields; track field) { @for (field of lockableFields; track field) {
<div class="field-row"> <div class="field-row">
<span class="field-label">{{ fieldLabels[field] || field }}</span> <span class="field-label">{{ getFieldLabel(field) }}</span>
<p-button <p-button
[outlined]="true" [outlined]="true"
[label]="getLockLabel(field)" [label]="getLockLabel(field)"
@@ -57,6 +57,8 @@ describe('LockUnlockMetadataDialogComponent', () => {
provide: TranslocoService, provide: TranslocoService,
useValue: { useValue: {
translate, translate,
langChanges$: of('en'),
getActiveLang: () => 'en',
}, },
}, },
], ],
@@ -9,6 +9,7 @@ import {Divider} from '@openng/optimus-ui/divider';
import {LoadingService} from '../../../../../core/services/loading.service'; import {LoadingService} from '../../../../../core/services/loading.service';
import {finalize} from 'rxjs'; import {finalize} from 'rxjs';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {MetadataProviderFieldsService} from '../../../../../shared/metadata';
@Component({ @Component({
selector: 'app-lock-unlock-metadata-dialog', selector: 'app-lock-unlock-metadata-dialog',
@@ -33,14 +34,13 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
bookIds: Set<number> = this.dynamicDialogConfig.data.bookIds; bookIds: Set<number> = this.dynamicDialogConfig.data.bookIds;
private readonly providerFields = inject(MetadataProviderFieldsService);
lockableFields: string[] = [ lockableFields: string[] = [
'titleLocked', 'subtitleLocked', 'publisherLocked', 'publishedDateLocked', 'descriptionLocked', 'openlibraryIdLocked', 'titleLocked', 'subtitleLocked', 'publisherLocked', 'publishedDateLocked', 'descriptionLocked',
'isbn13Locked', 'isbn10Locked', 'asinLocked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked', 'isbn13Locked', 'isbn10Locked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked',
'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked', 'moodsLocked', 'tagsLocked', 'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked', 'moodsLocked', 'tagsLocked',
'amazonRatingLocked', 'amazonReviewCountLocked', 'goodreadsRatingLocked', 'goodreadsReviewCountLocked', ...this.providerFields.fields().map(field => field.lockName),
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'hardcoverBookIdLocked', 'googleIdLocked', 'comicvineIdLocked',
'applebooksIdLocked', 'applebooksRatingLocked', 'applebooksReviewCountLocked',
'ranobedbIdLocked', 'ranobedbRatingLocked'
]; ];
fieldLabels: Record<string, string> = { fieldLabels: Record<string, string> = {
@@ -51,8 +51,6 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
descriptionLocked: 'Description', descriptionLocked: 'Description',
isbn13Locked: 'ISBN-13', isbn13Locked: 'ISBN-13',
isbn10Locked: 'ISBN-10', isbn10Locked: 'ISBN-10',
openlibraryIdLocked: 'OpenLibrary ID',
asinLocked: 'ASIN',
pageCountLocked: 'Page Count', pageCountLocked: 'Page Count',
thumbnailLocked: 'Thumbnail', thumbnailLocked: 'Thumbnail',
languageLocked: 'Language', languageLocked: 'Language',
@@ -64,24 +62,13 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
categoriesLocked: 'Genres', categoriesLocked: 'Genres',
moodsLocked: 'Moods', moodsLocked: 'Moods',
tagsLocked: 'Tags', tagsLocked: 'Tags',
amazonRatingLocked: 'Amazon ★',
amazonReviewCountLocked: 'Amazon Reviews',
goodreadsRatingLocked: 'Goodreads ★',
goodreadsReviewCountLocked: 'Goodreads Reviews',
hardcoverRatingLocked: 'Hardcover ★',
hardcoverReviewCountLocked: 'Hardcover Reviews',
goodreadsIdLocked: 'Goodreads ID',
hardcoverIdLocked: 'Hardcover ID',
hardcoverBookIdLocked: 'Hardcover Book ID',
googleIdLocked: 'Google ID',
comicvineIdLocked: 'Comicvine ID',
ranobedbIdLocked: 'Ranobedb ID',
ranobedbRatingLocked: 'Ranobedb ★',
applebooksIdLocked: 'Apple Books ID',
applebooksRatingLocked: 'Apple Books Rating',
applebooksReviewCountLocked: 'Apple Books Reviews',
}; };
getFieldLabel(lockName: string): string {
const providerField = this.providerFields.fields().find(field => field.lockName === lockName);
return providerField ? this.providerFields.label(providerField.name) : this.fieldLabels[lockName] ?? lockName;
}
isSaving = false; isSaving = false;
ngOnInit(): void { ngOnInit(): void {
@@ -55,9 +55,10 @@
<div class="reviewer-name-row"> <div class="reviewer-name-row">
<span class="reviewer-name">{{ review.reviewerName || t('labels.anonymous') }}</span> <span class="reviewer-name">{{ review.reviewerName || t('labels.anonymous') }}</span>
@if (review.metadataProvider) { @if (review.metadataProvider) {
@let provider = catalog.provider(review.metadataProvider);
<p-tag <p-tag
[rounded]="true" [rounded]="true"
[value]="review.metadataProvider" [value]="provider ? (provider.labelKey | transloco) : review.metadataProvider"
[severity]="getProviderSeverity(review.metadataProvider)"/> [severity]="getProviderSeverity(review.metadataProvider)"/>
} }
@if (review.country) { @if (review.country) {
@@ -9,18 +9,19 @@ import {Rating} from '@openng/optimus-ui/rating';
import {Tag} from '@openng/optimus-ui/tag'; import {Tag} from '@openng/optimus-ui/tag';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {ConfirmationService, MessageService} from '@openng/optimus-ui/api'; import {ConfirmationService, MessageService} from '@openng/optimus-ui/api';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
import {UserService} from '../../../settings/user-management/user.service'; import {UserService} from '../../../settings/user-management/user.service';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {BookService} from '../../service/book.service'; import {BookService} from '../../service/book.service';
import {BookMetadataManageService} from '../../service/book-metadata-manage.service'; import {BookMetadataManageService} from '../../service/book-metadata-manage.service';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
@Component({ @Component({
selector: 'app-book-reviews', selector: 'app-book-reviews',
standalone: true, standalone: true,
imports: [ProgressSpinner, Rating, Tag, Button, FormsModule, Tooltip, TranslocoDirective], imports: [ProgressSpinner, Rating, Tag, Button, FormsModule, Tooltip, TranslocoDirective, TranslocoPipe],
templateUrl: './book-reviews.component.html', templateUrl: './book-reviews.component.html',
styleUrl: './book-reviews.component.scss' styleUrl: './book-reviews.component.scss'
}) })
@@ -38,6 +39,7 @@ export class BookReviewsComponent implements OnInit, OnChanges {
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
protected readonly catalog = inject(MetadataCatalogService);
private bookIdState = signal<number | null>(null); private bookIdState = signal<number | null>(null);
private loadingBookId: number | null = null; private loadingBookId: number | null = null;
private loadingRequestSeq = 0; private loadingRequestSeq = 0;
@@ -221,8 +221,8 @@
</div> </div>
<code class="progress-item-isbn">{{ entry.isbn }}</code> <code class="progress-item-isbn">{{ entry.isbn }}</code>
<span class="progress-item-detail"> <span class="progress-item-detail">
@if (entry.status === 'created' && entry.title) { @if (entry.status === 'created') {
{{ entry.title }} {{ entry.title || t('summaryCreated') }}
} @else if (entry.status === 'created-no-metadata') { } @else if (entry.status === 'created-no-metadata') {
{{ t('createdNoMetadata') }} {{ t('createdNoMetadata') }}
} @else if (entry.status === 'failed') { } @else if (entry.status === 'failed') {
@@ -317,8 +317,8 @@
</div> </div>
<code class="summary-detail-isbn">{{ entry.isbn }}</code> <code class="summary-detail-isbn">{{ entry.isbn }}</code>
<span class="summary-detail-info"> <span class="summary-detail-info">
@if (entry.status === 'created' && entry.title) { @if (entry.status === 'created') {
{{ entry.title }} {{ entry.title || t('summaryCreated') }}
} @else if (entry.status === 'created-no-metadata') { } @else if (entry.status === 'created-no-metadata') {
{{ t('createdNoMetadata') }} {{ t('createdNoMetadata') }}
} @else if (entry.status === 'failed') { } @else if (entry.status === 'failed') {
@@ -1,3 +1,4 @@
import {HttpErrorResponse} from '@angular/common/http';
import {Component, computed, effect, inject, signal, WritableSignal} from '@angular/core'; import {Component, computed, effect, inject, signal, WritableSignal} from '@angular/core';
import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog'; import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
@@ -7,11 +8,12 @@ import {Textarea} from '@openng/optimus-ui/textarea';
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {ProgressBar} from '@openng/optimus-ui/progressbar'; import {ProgressBar} from '@openng/optimus-ui/progressbar';
import {FileUpload, FileSelectEvent} from '@openng/optimus-ui/fileupload'; import {FileUpload, FileSelectEvent} from '@openng/optimus-ui/fileupload';
import {QueryClient} from '@tanstack/angular-query-experimental';
import {BookService} from '../../service/book.service'; import {BookService} from '../../service/book.service';
import {BookMetadataService} from '../../service/book-metadata.service';
import {LibraryService} from '../../service/library.service'; import {LibraryService} from '../../service/library.service';
import {Library} from '../../model/library.model'; import {Library} from '../../model/library.model';
import {BookMetadata, CreatePhysicalBookRequest} from '../../model/book.model'; import {BookMetadata, CreatePhysicalBookRequest} from '../../model/book.model';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {TranslocoDirective} from '@jsverse/transloco'; import {TranslocoDirective} from '@jsverse/transloco';
import {Tabs, TabList, Tab, TabPanels, TabPanel} from '@openng/optimus-ui/tabs'; import {Tabs, TabList, Tab, TabPanels, TabPanel} from '@openng/optimus-ui/tabs';
@@ -61,7 +63,8 @@ export class BulkIsbnImportDialogComponent {
private dynamicDialogRef = inject(DynamicDialogRef); private dynamicDialogRef = inject(DynamicDialogRef);
private dialogConfig = inject(DynamicDialogConfig); private dialogConfig = inject(DynamicDialogConfig);
private bookService = inject(BookService); private bookService = inject(BookService);
private bookMetadataService = inject(BookMetadataService); private queryClient = inject(QueryClient);
private sources = inject(MetadataSourceQueryService);
private libraryService = inject(LibraryService); private libraryService = inject(LibraryService);
selectedLibraryId: number | null = null; selectedLibraryId: number | null = null;
@@ -189,7 +192,7 @@ export class BulkIsbnImportDialogComponent {
await this.createBook(request); await this.createBook(request);
if (metadata?.title) { if (metadata !== null) {
updateEntry(i, { status: 'created', title: metadata.title }) updateEntry(i, { status: 'created', title: metadata.title })
this.createdCount.update(v => v + 1); this.createdCount.update(v => v + 1);
} else { } else {
@@ -346,25 +349,21 @@ export class BulkIsbnImportDialogComponent {
return false; return false;
} }
private lookupIsbn(isbn: string): Promise<BookMetadata | null> { private async lookupIsbn(isbn: string): Promise<BookMetadata | null> {
return new Promise((resolve) => { try {
this.bookMetadataService.lookupByIsbn(isbn).subscribe({ return await this.queryClient.query(this.sources.isbnLookup(isbn));
next: metadata => resolve(metadata), } catch (err: unknown) {
error: err => { if (!(err instanceof HttpErrorResponse) || err.status !== 429) {
// Retry once on potential rate limiting return null;
if (err?.status === 429) { }
setTimeout(() => { }
this.bookMetadataService.lookupByIsbn(isbn).subscribe({
next: metadata => resolve(metadata), await this.delay(RETRY_DELAY_MS);
error: () => resolve(null), // Still create with ISBN only try {
}); return await this.queryClient.query(this.sources.isbnLookup(isbn));
}, RETRY_DELAY_MS); } catch {
} else { return null;
resolve(null); // No metadata found, still create with ISBN }
}
},
});
});
} }
private createBook(request: CreatePhysicalBookRequest): Promise<void> { private createBook(request: CreatePhysicalBookRequest): Promise<void> {
@@ -129,10 +129,6 @@ export class BookMetadataManageService {
); );
} }
getFileMetadata(bookId: number): Observable<BookMetadata> {
return this.http.get<BookMetadata>(`${this.url}/${bookId}/file-metadata`);
}
generateCustomCover(bookId: number): Observable<void> { generateCustomCover(bookId: number): Observable<void> {
return this.http.post<void>(`${this.url}/${bookId}/generate-custom-cover`, {}).pipe( return this.http.post<void>(`${this.url}/${bookId}/generate-custom-cover`, {}).pipe(
tap(() => { tap(() => {
@@ -1,140 +0,0 @@
import {provideHttpClient} from '@angular/common/http';
import {HttpTestingController, provideHttpClientTesting} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {AuthService} from '../../../shared/service/auth.service';
import {BookMetadataService} from './book-metadata.service';
describe('BookMetadataService', () => {
let service: BookMetadataService;
let httpTestingController: HttpTestingController;
let authService: {getInternalAccessToken: ReturnType<typeof vi.fn>};
const fetchRequest = {
bookId: 7,
providers: ['google'],
title: 'Dune',
author: 'Frank Herbert',
isbn: '9780441172719',
};
beforeEach(() => {
authService = {
getInternalAccessToken: vi.fn(() => 'token-123'),
};
TestBed.configureTestingModule({
providers: [
provideHttpClient(),
provideHttpClientTesting(),
BookMetadataService,
{provide: AuthService, useValue: authService},
],
});
service = TestBed.inject(BookMetadataService);
httpTestingController = TestBed.inject(HttpTestingController);
});
afterEach(() => {
httpTestingController.verify();
TestBed.resetTestingModule();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
it('throws when fetching metadata without an auth token', () => {
authService.getInternalAccessToken.mockReturnValueOnce(null);
expect(() => service.fetchBookMetadata(7, fetchRequest)).toThrowError(
'No authentication token available'
);
});
it('streams metadata over SSE with auth headers and maps message payloads', async () => {
const mockMetadata = {title: 'Dune'};
const encoder = new TextEncoder();
const dataChunk = encoder.encode(`data: ${JSON.stringify(mockMetadata)}\n`);
// Mocking reader instead of using global ReadableStream which might be missing in jsdom
const mockReader = {
read: vi.fn()
.mockResolvedValueOnce({done: false, value: dataChunk})
.mockResolvedValueOnce({done: true, value: undefined}),
releaseLock: vi.fn()
};
const mockResponse = {
ok: true,
body: {
getReader: () => mockReader
}
};
const fetchSpy = vi.fn().mockResolvedValue(mockResponse);
vi.stubGlobal('fetch', fetchSpy);
let result: unknown;
service.fetchBookMetadata(7, fetchRequest).subscribe(value => {
result = value;
});
// Wait for the stream to process
await new Promise(resolve => setTimeout(resolve, 0));
expect(fetchSpy).toHaveBeenCalledWith(
expect.stringMatching(/\/api\/v1\/books\/7\/metadata\/prospective$/),
expect.objectContaining({
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer token-123'
},
body: JSON.stringify(fetchRequest)
})
);
expect(result).toEqual(mockMetadata);
});
it('turns SSE error events into thrown errors', async () => {
const mockResponse = {
ok: false,
status: 500
};
const fetchSpy = vi.fn().mockResolvedValue(mockResponse);
vi.stubGlobal('fetch', fetchSpy);
let error: Error | undefined;
service.fetchBookMetadata(7, fetchRequest).subscribe({
error: err => {
error = err;
}
});
// Wait for the fetch to resolve
await new Promise(resolve => setTimeout(resolve, 0));
expect(error).toBeInstanceOf(Error);
expect(error?.message).toContain('HTTP error! status: 500');
});
it('requests provider detail and ISBN lookup through HTTP endpoints', () => {
service.fetchMetadataDetail('google', 'abc123').subscribe();
service.lookupByIsbn('9780441172719').subscribe();
const detailRequest = httpTestingController.expectOne(req =>
req.url.endsWith('/api/v1/books/metadata/detail/google/abc123')
);
expect(detailRequest.request.method).toBe('GET');
detailRequest.flush({});
const lookupRequest = httpTestingController.expectOne(req =>
req.url.endsWith('/api/v1/books/metadata/isbn-lookup')
);
expect(lookupRequest.request.method).toBe('POST');
expect(lookupRequest.request.body).toEqual({isbn: '9780441172719'});
lookupRequest.flush({});
});
});
@@ -1,113 +0,0 @@
import {inject, Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {API_CONFIG} from '../../../core/config/api-config';
import {FetchMetadataRequest} from '../../metadata/model/request/fetch-metadata-request.model';
import {BookMetadata} from '../model/book.model';
import {AuthService} from '../../../shared/service/auth.service';
import {HttpClient} from '@angular/common/http';
@Injectable({providedIn: 'root'})
export class BookMetadataService {
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/books`;
private http = inject(HttpClient);
private authService = inject(AuthService);
fetchBookMetadata(bookId: number, request: FetchMetadataRequest): Observable<BookMetadata> {
const token = this.authService.getInternalAccessToken();
if (!token) {
throw new Error('No authentication token available');
}
return new Observable<BookMetadata>((subscriber) => {
const abortController = new AbortController();
fetch(`${this.url}/${bookId}/metadata/prospective`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify(request),
signal: abortController.signal,
})
.then(async (response) => {
if (!response.ok) {
subscriber.error(new Error(`HTTP error! status: ${response.status}`));
return;
}
const reader = response.body?.getReader();
if (!reader) {
subscriber.error(new Error('Response body is null'));
return;
}
const decoder = new TextDecoder();
let buffer = '';
const emitLine = (line: string) => {
if (!line.startsWith('data:')) {
return;
}
const data = line.slice(5).trim();
if (!data) {
return;
}
try {
const metadata = JSON.parse(data) as BookMetadata;
subscriber.next(metadata);
} catch (e) {
console.error('Error parsing SSE data:', e);
}
};
try {
while (true) {
const {done, value} = await reader.read();
if (done) break;
buffer += decoder.decode(value, {stream: true});
const lines = buffer.split('\n');
buffer = lines.pop() || '';
for (const line of lines) {
emitLine(line);
}
}
if (buffer) {
emitLine(buffer);
}
subscriber.complete();
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
// Silently handle abort
} else {
subscriber.error(error);
}
} finally {
reader.releaseLock();
}
})
.catch((error) => {
if (error instanceof Error && error.name === 'AbortError') {
return;
}
subscriber.error(error);
});
return () => {
abortController.abort();
};
});
}
fetchMetadataDetail(provider: string, providerItemId: string): Observable<BookMetadata> {
return this.http.get<BookMetadata>(`${this.url}/metadata/detail/${provider}/${providerItemId}`);
}
lookupByIsbn(isbn: string): Observable<BookMetadata> {
return this.http.post<BookMetadata>(`${this.url}/metadata/isbn-lookup`, {isbn});
}
}
@@ -300,9 +300,9 @@
</div> </div>
</div> </div>
} }
@for (field of metadataFieldsBottom; track field) { @for (field of metadataFieldsBottom(); track field) {
<div class="meta-row field-{{field.controlName}}"> <div class="meta-row field-{{field.controlName}}">
<label for="{{field.controlName}}" class="field-label">{{ field.label }}</label> <label for="{{field.controlName}}" class="field-label">{{ fieldLabel(field) }}</label>
<div class="meta-fields"> <div class="meta-fields">
<input <input
pInputText pInputText
@@ -522,9 +522,9 @@
</div> </div>
} }
@for (field of metadataFieldsBottom; track field) { @for (field of metadataFieldsBottom(); track field) {
<div class="meta-row field-{{field.controlName}}" [class.field-series-name]="field.controlName === 'seriesName'"> <div class="meta-row field-{{field.controlName}}" [class.field-series-name]="field.controlName === 'seriesName'">
<label for="{{field.controlName}}" class="field-label field-label-fixed">{{ field.label }}</label> <label for="{{field.controlName}}" class="field-label field-label-fixed">{{ fieldLabel(field) }}</label>
<div class="field-input-row"> <div class="field-input-row">
<input <input
pSize="small" pSize="small"
@@ -1,4 +1,4 @@
import {Component, effect, EventEmitter, inject, Input, Output} from '@angular/core'; import {Component, computed, effect, EventEmitter, inject, Input, Output, signal} from '@angular/core';
import {FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {NgClass} from '@angular/common'; import {NgClass} from '@angular/common';
@@ -14,7 +14,7 @@ import {ConfirmationService} from '@openng/optimus-ui/api';
import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop';
import {AutoCompleteSelectEvent} from '@openng/optimus-ui/autocomplete'; import {AutoCompleteSelectEvent} from '@openng/optimus-ui/autocomplete';
import {DatePicker} from '@openng/optimus-ui/datepicker'; import {DatePicker} from '@openng/optimus-ui/datepicker';
import {ALL_METADATA_FIELDS, getArrayFields, getBottomFields, getTextareaFields, MetadataFieldConfig} from '../../../../shared/metadata'; import {allMetadataFields, GENERIC_METADATA_FIELDS, getArrayFields, getBottomFields, getTextareaFields, MetadataFieldConfig, MetadataProviderFieldsService} from '../../../../shared/metadata';
import {MetadataUtilsService} from '../../../../shared/metadata'; import {MetadataUtilsService} from '../../../../shared/metadata';
import {MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model'; import {MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
@@ -48,6 +48,7 @@ export class BookdropFileMetadataPickerComponent {
protected readonly urlHelper = inject(UrlHelperService); protected readonly urlHelper = inject(UrlHelperService);
private readonly appSettingsService = inject(AppSettingsService); private readonly appSettingsService = inject(AppSettingsService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly providerFields = inject(MetadataProviderFieldsService);
@Input() fetchedMetadata!: BookMetadata; @Input() fetchedMetadata!: BookMetadata;
@Input() originalMetadata?: BookMetadata; @Input() originalMetadata?: BookMetadata;
@@ -60,13 +61,14 @@ export class BookdropFileMetadataPickerComponent {
authorInputValue = ''; authorInputValue = '';
private enabledProviderFields: MetadataProviderSpecificFields | null = null; private readonly enabledProviderFields = signal<MetadataProviderSpecificFields | null>(null);
private readonly allFields = computed(() => allMetadataFields(this.providerFields.fields()));
metadataFieldsTop: MetadataFieldConfig[] = ALL_METADATA_FIELDS.filter(f => metadataFieldsTop: MetadataFieldConfig[] = GENERIC_METADATA_FIELDS.filter(f =>
['title', 'subtitle', 'publisher'].includes(f.controlName) ['title', 'subtitle', 'publisher'].includes(f.controlName)
); );
metadataPublishDate: MetadataFieldConfig[] = ALL_METADATA_FIELDS.filter(f => metadataPublishDate: MetadataFieldConfig[] = GENERIC_METADATA_FIELDS.filter(f =>
f.controlName === 'publishedDate' f.controlName === 'publishedDate'
); );
@@ -74,16 +76,19 @@ export class BookdropFileMetadataPickerComponent {
metadataDescription: MetadataFieldConfig[] = getTextareaFields(); metadataDescription: MetadataFieldConfig[] = getTextareaFields();
metadataFieldsBottom: MetadataFieldConfig[] = getBottomFields(); readonly metadataFieldsBottom = computed(() => getBottomFields(this.allFields(), this.enabledProviderFields()));
private readonly syncProviderFieldsEffect = effect(() => { private readonly syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings(); const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) { if (settings?.metadataProviderSpecificFields) {
this.enabledProviderFields = settings.metadataProviderSpecificFields; this.enabledProviderFields.set(settings.metadataProviderSpecificFields);
this.metadataFieldsBottom = getBottomFields(this.enabledProviderFields);
} }
}); });
fieldLabel(field: MetadataFieldConfig): string {
return field.providerKey ? this.providerFields.label(field.providerKey) : field.label ?? field.controlName;
}
copyMissing(): void { copyMissing(): void {
this.metadataUtils.copyMissingFields( this.metadataUtils.copyMissingFields(
this.fetchedMetadata, this.fetchedMetadata,
@@ -201,7 +206,7 @@ export class BookdropFileMetadataPickerComponent {
if (this.originalMetadata) { if (this.originalMetadata) {
const patchData: Record<string, unknown> = {}; const patchData: Record<string, unknown> = {};
for (const field of ALL_METADATA_FIELDS) { for (const field of this.allFields()) {
const key = field.controlName as keyof BookMetadata; const key = field.controlName as keyof BookMetadata;
const value = this.originalMetadata[key]; const value = this.originalMetadata[key];
@@ -21,6 +21,7 @@ import {InputGroupAddon} from '@openng/optimus-ui/inputgroupaddon';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {BookMetadata} from '../../../book/model/book.model'; import {BookMetadata} from '../../../book/model/book.model';
import {UrlHelperService} from '../../../../shared/service/url-helper.service'; import {UrlHelperService} from '../../../../shared/service/url-helper.service';
import {MetadataProviderFieldsService} from '../../../../shared/metadata';
import {Checkbox} from '@openng/optimus-ui/checkbox'; import {Checkbox} from '@openng/optimus-ui/checkbox';
import {NgClass} from '@angular/common'; import {NgClass} from '@angular/common';
import {Paginator} from '@openng/optimus-ui/paginator'; import {Paginator} from '@openng/optimus-ui/paginator';
@@ -73,6 +74,7 @@ export class BookdropFileReviewComponent implements OnInit {
private readonly appSettingsService = inject(AppSettingsService); private readonly appSettingsService = inject(AppSettingsService);
private readonly messageService = inject(MessageService); private readonly messageService = inject(MessageService);
private readonly urlHelper = inject(UrlHelperService); private readonly urlHelper = inject(UrlHelperService);
private readonly providerFields = inject(MetadataProviderFieldsService);
private readonly activatedRoute = inject(ActivatedRoute); private readonly activatedRoute = inject(ActivatedRoute);
private readonly pageTitle = inject(PageTitleService); private readonly pageTitle = inject(PageTitleService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
@@ -309,26 +311,11 @@ export class BookdropFileReviewComponent implements OnInit {
description: original?.description ?? null, description: original?.description ?? null,
pageCount: original?.pageCount ?? null, pageCount: original?.pageCount ?? null,
language: original?.language ?? null, language: original?.language ?? null,
asin: original?.asin ?? null,
amazonRating: original?.amazonRating ?? null,
amazonReviewCount: original?.amazonReviewCount ?? null,
goodreadsId: original?.goodreadsId ?? null,
goodreadsRating: original?.goodreadsRating ?? null,
goodreadsReviewCount: original?.goodreadsReviewCount ?? null,
hardcoverId: original?.hardcoverId ?? null,
hardcoverBookId: original?.hardcoverBookId ?? null,
hardcoverRating: original?.hardcoverRating ?? null,
hardcoverReviewCount: original?.hardcoverReviewCount ?? null,
lubimyczytacId: original?.lubimyczytacId ?? null,
lubimyczytacRating: original?.lubimyczytacRating ?? null,
googleId: original?.googleId ?? null,
comicvineId: original?.comicvineId ?? null,
ranobedbId: original?.ranobedbId ?? null,
ranobedbRating: original?.ranobedbRating ?? null,
seriesName: original?.seriesName ?? null, seriesName: original?.seriesName ?? null,
seriesNumber: original?.seriesNumber ?? null, seriesNumber: original?.seriesNumber ?? null,
seriesTotal: original?.seriesTotal ?? null, seriesTotal: original?.seriesTotal ?? null,
thumbnailUrl: this.urlHelper.getBookdropCoverUrl(fileUi.file.id), thumbnailUrl: this.urlHelper.getBookdropCoverUrl(fileUi.file.id),
...Object.fromEntries(this.providerFields.fields().map(field => [field.name, original?.[field.name] ?? null])),
}); });
fileUi.copiedFields = {}; fileUi.copiedFields = {};
fileUi.savedFields = {}; fileUi.savedFields = {};
@@ -590,26 +577,11 @@ export class BookdropFileReviewComponent implements OnInit {
description: new FormControl(original?.description ?? ''), description: new FormControl(original?.description ?? ''),
pageCount: new FormControl(original?.pageCount ?? ''), pageCount: new FormControl(original?.pageCount ?? ''),
language: new FormControl(original?.language ?? ''), language: new FormControl(original?.language ?? ''),
asin: new FormControl(original?.asin ?? ''),
amazonRating: new FormControl(original?.amazonRating ?? ''),
amazonReviewCount: new FormControl(original?.amazonReviewCount ?? ''),
goodreadsId: new FormControl(original?.goodreadsId ?? ''),
goodreadsRating: new FormControl(original?.goodreadsRating ?? ''),
goodreadsReviewCount: new FormControl(original?.goodreadsReviewCount ?? ''),
hardcoverId: new FormControl(original?.hardcoverId ?? ''),
hardcoverBookId: new FormControl(original?.hardcoverBookId ?? ''),
hardcoverRating: new FormControl(original?.hardcoverRating ?? ''),
hardcoverReviewCount: new FormControl(original?.hardcoverReviewCount ?? ''),
lubimyczytacId: new FormControl(original?.lubimyczytacId ?? ''),
lubimyczytacRating: new FormControl(original?.lubimyczytacRating ?? ''),
ranobedbId: new FormControl(original?.ranobedbId ?? ''),
ranobedbRating: new FormControl(original?.ranobedbRating ?? ''),
googleId: new FormControl(original?.googleId ?? ''),
comicvineId: new FormControl(original?.comicvineId ?? ''),
seriesName: new FormControl(original?.seriesName ?? ''), seriesName: new FormControl(original?.seriesName ?? ''),
seriesNumber: new FormControl(original?.seriesNumber ?? ''), seriesNumber: new FormControl(original?.seriesNumber ?? ''),
seriesTotal: new FormControl(original?.seriesTotal ?? ''), seriesTotal: new FormControl(original?.seriesTotal ?? ''),
thumbnailUrl: new FormControl(this.urlHelper.getBookdropCoverUrl(bookdropFileId)), thumbnailUrl: new FormControl(this.urlHelper.getBookdropCoverUrl(bookdropFileId)),
...Object.fromEntries(this.providerFields.fields().map(field => [field.name, new FormControl(original?.[field.name] ?? '')])),
}); });
} }
@@ -152,12 +152,12 @@
} @else if (['dateFinished', 'addedOn', 'lastReadTime'].includes(ruleCtrl.get('field')?.value)) { } @else if (['dateFinished', 'addedOn', 'lastReadTime'].includes(ruleCtrl.get('field')?.value)) {
<p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="yy-mm-dd" [placeholder]="t('placeholders.startDate')" appendTo="body" fluid class="value-input"></p-datepicker> <p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="yy-mm-dd" [placeholder]="t('placeholders.startDate')" appendTo="body" fluid class="value-input"></p-datepicker>
<p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="yy-mm-dd" [placeholder]="t('placeholders.endDate')" appendTo="body" fluid class="value-input"></p-datepicker> <p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="yy-mm-dd" [placeholder]="t('placeholders.endDate')" appendTo="body" fluid class="value-input"></p-datepicker>
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'number') { } @else if (numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.type === 'number') {
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" [min]="0" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber> <p-inputNumber [formControl]="ruleCtrl.get('valueStart')" [min]="0" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber>
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" [min]="0" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber> <p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" [min]="0" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'decimal') { } @else if (numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.type === 'decimal') {
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber> <p-inputNumber [formControl]="ruleCtrl.get('valueStart')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber>
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber> <p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
} @else { } @else {
<input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" [placeholder]="t('placeholders.startValue')"/> <input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" [placeholder]="t('placeholders.startValue')"/>
<input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" [placeholder]="t('placeholders.endValue')"/> <input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" [placeholder]="t('placeholders.endValue')"/>
@@ -167,12 +167,12 @@
<p-datepicker formControlName="value" dateFormat="yy-mm-dd" appendTo="body" fluid class="value-input"></p-datepicker> <p-datepicker formControlName="value" dateFormat="yy-mm-dd" appendTo="body" fluid class="value-input"></p-datepicker>
} @else if (['dateFinished', 'addedOn', 'lastReadTime'].includes(ruleCtrl.get('field')?.value)) { } @else if (['dateFinished', 'addedOn', 'lastReadTime'].includes(ruleCtrl.get('field')?.value)) {
<p-datepicker formControlName="value" dateFormat="yy-mm-dd" appendTo="body" fluid class="value-input"></p-datepicker> <p-datepicker formControlName="value" dateFormat="yy-mm-dd" appendTo="body" fluid class="value-input"></p-datepicker>
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'boolean') { } @else if (numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.type === 'boolean') {
<p-select [options]="booleanOptions" formControlName="value" [placeholder]="t('placeholders.selectValue')" appendTo="body" class="value-input"></p-select> <p-select [options]="booleanOptions" formControlName="value" [placeholder]="t('placeholders.selectValue')" appendTo="body" class="value-input"></p-select>
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'number') { } @else if (numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.type === 'number') {
<p-inputNumber formControlName="value" class="value-input" mode="decimal" [placeholder]="t('placeholders.value')" [showButtons]="true"></p-inputNumber> <p-inputNumber formControlName="value" class="value-input" mode="decimal" [placeholder]="t('placeholders.value')" [showButtons]="true"></p-inputNumber>
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'decimal') { } @else if (numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.type === 'decimal') {
<p-inputNumber formControlName="value" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.value')"></p-inputNumber> <p-inputNumber formControlName="value" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap().get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.value')"></p-inputNumber>
} @else if (ruleCtrl.get('field')?.value === 'seriesStatus') { } @else if (ruleCtrl.get('field')?.value === 'seriesStatus') {
<p-select [options]="seriesStatusOptions" formControlName="value" [placeholder]="t('placeholders.selectSeriesStatus')" appendTo="body" class="value-input"></p-select> <p-select [options]="seriesStatusOptions" formControlName="value" [placeholder]="t('placeholders.selectSeriesStatus')" appendTo="body" class="value-input"></p-select>
} @else if (ruleCtrl.get('field')?.value === 'seriesGaps') { } @else if (ruleCtrl.get('field')?.value === 'seriesGaps') {
@@ -699,33 +699,33 @@ describe('MagicShelfComponent (Part 3)', () => {
describe('numericFieldConfigMap', () => { describe('numericFieldConfigMap', () => {
it('should contain readingProgress with max 100', () => { it('should contain readingProgress with max 100', () => {
const config = component.numericFieldConfigMap.get('readingProgress'); const config = component.numericFieldConfigMap().get('readingProgress');
expect(config).toBeDefined(); expect(config).toBeDefined();
expect(config!.type).toBe('decimal'); expect(config!.type).toBe('decimal');
expect(config!.max).toBe(100); expect(config!.max).toBe(100);
}); });
it('should contain personalRating with max 10', () => { it('should contain personalRating with max 10', () => {
const config = component.numericFieldConfigMap.get('personalRating'); const config = component.numericFieldConfigMap().get('personalRating');
expect(config).toBeDefined(); expect(config).toBeDefined();
expect(config!.type).toBe('decimal'); expect(config!.type).toBe('decimal');
expect(config!.max).toBe(10); expect(config!.max).toBe(10);
}); });
it('should contain pageCount with type number and no max', () => { it('should contain pageCount with type number and no max', () => {
const config = component.numericFieldConfigMap.get('pageCount'); const config = component.numericFieldConfigMap().get('pageCount');
expect(config).toBeDefined(); expect(config).toBeDefined();
expect(config!.type).toBe('number'); expect(config!.type).toBe('number');
expect(config!.max).toBeUndefined(); expect(config!.max).toBeUndefined();
}); });
it('should not contain title', () => { it('should not contain title', () => {
const config = component.numericFieldConfigMap.get('title'); const config = component.numericFieldConfigMap().get('title');
expect(config).toBeUndefined(); expect(config).toBeUndefined();
}); });
it('should contain abridged with type boolean', () => { it('should contain abridged with type boolean', () => {
const config = component.numericFieldConfigMap.get('abridged'); const config = component.numericFieldConfigMap().get('abridged');
expect(config).toBeDefined(); expect(config).toBeDefined();
expect(config!.type).toBe('boolean'); expect(config!.type).toBe('boolean');
}); });
@@ -24,6 +24,8 @@ import {ShelfService} from '../../book/service/shelf.service';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {Textarea} from '@openng/optimus-ui/textarea'; import {Textarea} from '@openng/optimus-ui/textarea';
import {IconSelection, toIconSelection} from '../../../shared/icons/icon-selection'; import {IconSelection, toIconSelection} from '../../../shared/icons/icon-selection';
import {MetadataProviderFieldsService, providerFieldRecord, type MetadataProviderFieldRole} from '../../../shared/metadata';
import type {MetadataProviderFieldName, MetadataProviderScoreFieldName} from '../../../shared/metadata/metadata-providers';
export type RuleOperator = export type RuleOperator =
| 'equals' | 'equals'
@@ -46,7 +48,7 @@ export type RuleOperator =
| 'older_than' | 'older_than'
| 'this_period' | 'this_period'
export type RuleField = type GenericRuleField =
| 'library' | 'library'
| 'shelf' | 'shelf'
| 'title' | 'title'
@@ -62,13 +64,6 @@ export type RuleField =
| 'language' | 'language'
| 'isbn13' | 'isbn13'
| 'isbn10' | 'isbn10'
| 'amazonRating'
| 'amazonReviewCount'
| 'goodreadsRating'
| 'goodreadsReviewCount'
| 'hardcoverRating'
| 'hardcoverReviewCount'
| 'ranobedbRating'
| 'personalRating' | 'personalRating'
| 'fileType' | 'fileType'
| 'fileSize' | 'fileSize'
@@ -79,15 +74,10 @@ export type RuleField =
| 'moods' | 'moods'
| 'tags' | 'tags'
| 'addedOn' | 'addedOn'
| 'lubimyczytacRating'
| 'description' | 'description'
| 'narrator' | 'narrator'
| 'ageRating' | 'ageRating'
| 'contentRating' | 'contentRating'
| 'audibleRating'
| 'audibleReviewCount'
| 'applebooksRating'
| 'applebooksReviewCount'
| 'abridged' | 'abridged'
| 'audiobookDuration' | 'audiobookDuration'
| 'audiobookCodec' | 'audiobookCodec'
@@ -100,11 +90,14 @@ export type RuleField =
| 'readingProgress' | 'readingProgress'
| 'metadataPresence'; | 'metadataPresence';
export type RuleField = GenericRuleField | MetadataProviderScoreFieldName;
interface FullFieldConfig { interface FullFieldConfig {
label: string; label: string;
type?: FieldType; type?: FieldType;
max?: number; max?: number;
providerField?: MetadataProviderFieldName;
} }
type FieldType = 'number' | 'decimal' | 'date' | 'boolean' | undefined; type FieldType = 'number' | 'decimal' | 'date' | 'boolean' | undefined;
@@ -143,7 +136,9 @@ export type GroupFormGroup = FormGroup<{
rules: FormArray<GroupFormGroup | RuleFormGroup>; rules: FormArray<GroupFormGroup | RuleFormGroup>;
}>; }>;
const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = { const RULE_UNSUPPORTED_PROVIDER_FIELD = 'hardcoverBookId';
const GENERIC_FIELD_CONFIGS = {
library: {label: 'library'}, library: {label: 'library'},
shelf: {label: 'shelf'}, shelf: {label: 'shelf'},
readStatus: {label: 'readStatus'}, readStatus: {label: 'readStatus'},
@@ -168,23 +163,11 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
fileSize: {label: 'fileSize', type: 'number'}, fileSize: {label: 'fileSize', type: 'number'},
fileType: {label: 'fileType'}, fileType: {label: 'fileType'},
subtitle: {label: 'subtitle'}, subtitle: {label: 'subtitle'},
amazonRating: {label: 'amazonRating', type: 'decimal', max: 5},
amazonReviewCount: {label: 'amazonReviewCount', type: 'number'},
goodreadsRating: {label: 'goodreadsRating', type: 'decimal', max: 5},
goodreadsReviewCount: {label: 'goodreadsReviewCount', type: 'number'},
hardcoverRating: {label: 'hardcoverRating', type: 'decimal', max: 5},
hardcoverReviewCount: {label: 'hardcoverReviewCount', type: 'number'},
ranobedbRating: {label: 'ranobedbRating', type: 'decimal', max: 5},
addedOn: {label: 'addedOn', type: 'date'}, addedOn: {label: 'addedOn', type: 'date'},
lubimyczytacRating: {label: 'lubimyczytacRating', type: 'decimal', max: 5},
description: {label: 'description'}, description: {label: 'description'},
narrator: {label: 'narrator'}, narrator: {label: 'narrator'},
ageRating: {label: 'ageRating', type: 'number'}, ageRating: {label: 'ageRating', type: 'number'},
contentRating: {label: 'contentRating'}, 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'}, abridged: {label: 'abridged', type: 'boolean'},
audiobookDuration: {label: 'audiobookDuration', type: 'number'}, audiobookDuration: {label: 'audiobookDuration', type: 'number'},
audiobookCodec: {label: 'audiobookCodec'}, audiobookCodec: {label: 'audiobookCodec'},
@@ -196,19 +179,19 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
seriesPosition: {label: 'seriesPosition'}, seriesPosition: {label: 'seriesPosition'},
readingProgress: {label: 'readingProgress', type: 'decimal', max: 100}, readingProgress: {label: 'readingProgress', type: 'decimal', max: 100},
metadataPresence: {label: 'metadataPresence'} metadataPresence: {label: 'metadataPresence'}
}; } satisfies Record<GenericRuleField, FullFieldConfig>;
interface FieldGroup { interface FieldGroup {
translationKey: string; translationKey: string;
fields: RuleField[]; fields: RuleField[];
} }
const FIELD_GROUPS: FieldGroup[] = [ const GENERIC_FIELD_GROUPS: FieldGroup[] = [
{ translationKey: 'organization', fields: ['library', 'shelf', 'readStatus', 'readingProgress'] }, { translationKey: 'organization', fields: ['library', 'shelf', 'readStatus', 'readingProgress'] },
{ translationKey: 'bookInfo', fields: ['title', 'subtitle', 'description', 'authors', 'categories', 'publisher', 'language', 'pageCount', 'ageRating', 'contentRating'] }, { translationKey: 'bookInfo', fields: ['title', 'subtitle', 'description', 'authors', 'categories', 'publisher', 'language', 'pageCount', 'ageRating', 'contentRating'] },
{ translationKey: 'series', fields: ['seriesName', 'seriesNumber', 'seriesTotal', 'seriesStatus', 'seriesGaps', 'seriesPosition'] }, { translationKey: 'series', fields: ['seriesName', 'seriesNumber', 'seriesTotal', 'seriesStatus', 'seriesGaps', 'seriesPosition'] },
{ translationKey: 'dates', fields: ['publishedDate', 'dateFinished', 'lastReadTime', 'addedOn'] }, { translationKey: 'dates', fields: ['publishedDate', 'dateFinished', 'lastReadTime', 'addedOn'] },
{ translationKey: 'ratingsReviews', fields: ['personalRating', 'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'hardcoverRating', 'hardcoverReviewCount', 'ranobedbRating', 'lubimyczytacRating', 'audibleRating', 'audibleReviewCount', 'applebooksRating', 'applebooksReviewCount'] }, { translationKey: 'ratingsReviews', fields: ['personalRating'] },
{ translationKey: 'qualityMetadata', fields: ['metadataScore', 'metadataPresence'] }, { translationKey: 'qualityMetadata', fields: ['metadataScore', 'metadataPresence'] },
{ translationKey: 'tagsMoods', fields: ['moods', 'tags'] }, { translationKey: 'tagsMoods', fields: ['moods', 'tags'] },
{ translationKey: 'audiobook', fields: ['narrator', 'abridged', 'audiobookDuration', 'audiobookCodec', 'audiobookChapterCount', 'audiobookBitrate'] }, { translationKey: 'audiobook', fields: ['narrator', 'abridged', 'audiobookDuration', 'audiobookCodec', 'audiobookChapterCount', 'audiobookBitrate'] },
@@ -261,15 +244,27 @@ const READ_STATUS_KEYS: Record<string, string> = {
export class MagicShelfComponent implements OnInit { export class MagicShelfComponent implements OnInit {
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly providerFields = inject(MetadataProviderFieldsService);
private readonly injector = inject(Injector); private readonly injector = inject(Injector);
private readonly controlIds = new WeakMap<AbstractControl, string>(); private readonly controlIds = new WeakMap<AbstractControl, string>();
private controlIdCounter = 0; private controlIdCounter = 0;
numericFieldConfigMap = new Map<RuleField, FieldConfig>( readonly fieldConfigs = computed<Record<RuleField, FullFieldConfig>>(() => ({
Object.entries(FIELD_CONFIGS) ...GENERIC_FIELD_CONFIGS,
...providerFieldRecord(this.providerFields.scoreFields(), (field): FullFieldConfig => ({
label: field.name, providerField: field.name, type: field.role === 'rating' ? 'decimal' : 'number', max: field.role === 'rating' ? 5 : undefined,
})),
}));
private readonly fieldGroups = computed(() => GENERIC_FIELD_GROUPS.map(group => group.translationKey === 'ratingsReviews'
? {...group, fields: [...group.fields, ...this.providerFields.scoreFields().map(field => field.name)]}
: group));
readonly numericFieldConfigMap = computed(() => new Map<RuleField, FieldConfig>(
Object.entries(this.fieldConfigs())
.filter(([, config]) => config.type) .filter(([, config]) => config.type)
.map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}]) .map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}])
); ));
get conditionOptions(): { label: string; value: 'and' | 'or' }[] { get conditionOptions(): { label: string; value: 'and' | 'or' }[] {
return [ return [
@@ -279,14 +274,14 @@ export class MagicShelfComponent implements OnInit {
} }
get fieldOptions() { get fieldOptions() {
return FIELD_GROUPS return this.fieldGroups()
.map(group => ({ .map(group => ({
label: this.t.translate(`magicShelf.fieldGroups.${group.translationKey}`), label: this.t.translate(`magicShelf.fieldGroups.${group.translationKey}`),
items: group.fields.map(field => { items: group.fields.map(field => {
const config = FIELD_CONFIGS[field]; const config = this.fieldConfigs()[field];
const translationKey = field === 'categories' ? 'genre' : config.label; const translationKey = field === 'categories' ? 'genre' : config.label;
return { return {
label: this.t.translate(`magicShelf.fields.${translationKey}`), label: config.providerField ? this.providerFields.label(config.providerField) : this.t.translate(`magicShelf.fields.${translationKey}`),
value: field value: field
}; };
}) })
@@ -360,6 +355,12 @@ export class MagicShelfComponent implements OnInit {
]; ];
} }
private providerFieldOptions(role: MetadataProviderFieldRole) {
return this.providerFields.fields()
.filter(field => field.role === role && field.name !== RULE_UNSUPPORTED_PROVIDER_FIELD)
.map(field => ({label: this.providerFields.label(field.name), value: field.name}));
}
get metadataPresenceOptions() { get metadataPresenceOptions() {
return [ return [
{ label: this.t.translate('magicShelf.metadataFieldGroups.bookInfo'), items: [ { label: this.t.translate('magicShelf.metadataFieldGroups.bookInfo'), items: [
@@ -386,7 +387,6 @@ export class MagicShelfComponent implements OnInit {
{ label: this.t.translate('magicShelf.metadataFieldGroups.identifiers'), items: [ { label: this.t.translate('magicShelf.metadataFieldGroups.identifiers'), items: [
{label: this.t.translate('magicShelf.metadataFields.isbn13'), value: 'isbn13'}, {label: this.t.translate('magicShelf.metadataFields.isbn13'), value: 'isbn13'},
{label: this.t.translate('magicShelf.metadataFields.isbn10'), value: 'isbn10'}, {label: this.t.translate('magicShelf.metadataFields.isbn10'), value: 'isbn10'},
{label: this.t.translate('magicShelf.metadataFields.asin'), value: 'asin'},
]}, ]},
{ label: this.t.translate('magicShelf.metadataFieldGroups.contentClassification'), items: [ { label: this.t.translate('magicShelf.metadataFieldGroups.contentClassification'), items: [
{label: this.t.translate('magicShelf.metadataFields.ageRating'), value: 'ageRating'}, {label: this.t.translate('magicShelf.metadataFields.ageRating'), value: 'ageRating'},
@@ -394,32 +394,10 @@ export class MagicShelfComponent implements OnInit {
]}, ]},
{ label: this.t.translate('magicShelf.metadataFieldGroups.ratings'), items: [ { label: this.t.translate('magicShelf.metadataFieldGroups.ratings'), items: [
{label: this.t.translate('magicShelf.metadataFields.personalRating'), value: 'personalRating'}, {label: this.t.translate('magicShelf.metadataFields.personalRating'), value: 'personalRating'},
{label: this.t.translate('magicShelf.metadataFields.amazonRating'), value: 'amazonRating'}, ...this.providerFieldOptions('rating'),
{label: this.t.translate('magicShelf.metadataFields.goodreadsRating'), value: 'goodreadsRating'},
{label: this.t.translate('magicShelf.metadataFields.hardcoverRating'), value: 'hardcoverRating'},
{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.openlibraryId'), value: 'openlibraryId'},
{label: this.t.translate('magicShelf.metadataFields.goodreadsId'), value: 'goodreadsId'},
{label: this.t.translate('magicShelf.metadataFields.hardcoverId'), value: 'hardcoverId'},
{label: this.t.translate('magicShelf.metadataFields.googleId'), value: 'googleId'},
{label: this.t.translate('magicShelf.metadataFields.audibleId'), value: 'audibleId'},
{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.reviewCounts'), items: this.providerFieldOptions('reviewCount')},
{ label: this.t.translate('magicShelf.metadataFieldGroups.externalIds'), items: this.providerFieldOptions('id')},
{ label: this.t.translate('magicShelf.metadataFieldGroups.audiobook'), items: [ { label: this.t.translate('magicShelf.metadataFieldGroups.audiobook'), items: [
{label: this.t.translate('magicShelf.metadataFields.narrator'), value: 'narrator'}, {label: this.t.translate('magicShelf.metadataFields.narrator'), value: 'narrator'},
{label: this.t.translate('magicShelf.metadataFields.abridged'), value: 'abridged'}, {label: this.t.translate('magicShelf.metadataFields.abridged'), value: 'abridged'},
@@ -576,7 +554,7 @@ export class MagicShelfComponent implements OnInit {
} }
buildRuleFromData(data: Rule): RuleFormGroup { buildRuleFromData(data: Rule): RuleFormGroup {
const config = FIELD_CONFIGS[data.field]; const config = this.fieldConfigs()[data.field];
const type = config?.type; const type = config?.type;
const isRelativeDate = RELATIVE_DATE_OPERATORS.includes(data.operator); const isRelativeDate = RELATIVE_DATE_OPERATORS.includes(data.operator);
@@ -641,7 +619,7 @@ export class MagicShelfComponent implements OnInit {
if (!field) return [...baseOperators, ...multiValueOperators]; if (!field) return [...baseOperators, ...multiValueOperators];
const config = FIELD_CONFIGS[field]; const config = this.fieldConfigs()[field];
if (config.type === 'boolean') { if (config.type === 'boolean') {
return baseOperators; return baseOperators;
@@ -763,7 +741,7 @@ export class MagicShelfComponent implements OnInit {
/** A value survives an operator change only when the input the new operator renders can still edit it. */ /** A value survives an operator change only when the input the new operator renders can still edit it. */
private isSingleValue(ruleCtrl: FormGroup, value: unknown): boolean { private isSingleValue(ruleCtrl: FormGroup, value: unknown): boolean {
if (value == null || value === '' || Array.isArray(value)) return false; if (value == null || value === '' || Array.isArray(value)) return false;
const type = FIELD_CONFIGS[ruleCtrl.get('field')?.value as RuleField]?.type; const type = this.fieldConfigs()[ruleCtrl.get('field')?.value as RuleField]?.type;
return type !== 'date' || value instanceof Date; return type !== 'date' || value instanceof Date;
} }
@@ -664,327 +664,21 @@
@if (providerSectionExpanded) { @if (providerSectionExpanded) {
<div class="collapsible-content"> <div class="collapsible-content">
<div class="field-row metadata-ids-row"> <div class="field-row metadata-ids-row">
@if (isFieldVisible('openlibraryId')) { @for (field of providerFields.fields(); track field.name) {
<div class="field-group metadata-id-field"> @if (isFieldVisible(field.name)) {
<label for="openlibraryId">{{ t('openlibraryId') }} @if (isEmbeddable('openlibraryId', book)) { <i class="pi pi-file-export embeddable-indicator" [pTooltip]="t('writtenToFileTooltip')" tooltipPosition="top"></i> }</label> <div class="field-group metadata-id-field">
<div class="field-with-lock"> <label [for]="field.name">{{ providerFields.label(field.name) }} @if (isEmbeddable(field.name, book)) { <i class="pi pi-file-export embeddable-indicator" [pTooltip]="t('writtenToFileTooltip')" tooltipPosition="top"></i> }</label>
<input pSize="small" pInputText id="openlibraryId" formControlName="openlibraryId"/> <div class="field-with-lock">
@if (!book.metadata!['openlibraryIdLocked']) { <input pSize="small" pInputText [id]="field.name" [formControlName]="field.name"/>
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('openlibraryId')" severity="success"></p-button> @if (!book.metadata![field.lockName]) {
} <p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock(field.name)" severity="success"></p-button>
@if (book.metadata!['openlibraryIdLocked']) { }
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('openlibraryId')" severity="warn"></p-button> @if (book.metadata![field.lockName]) {
} <p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.name)" severity="warn"></p-button>
}
</div>
</div> </div>
</div> }
}
@if (isFieldVisible('asin')) {
<div class="field-group metadata-id-field">
<label for="asin">{{ t('amazonAsin') }} @if (isEmbeddable('asin', 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="asin" formControlName="asin"/>
@if (!book.metadata!['asinLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('asin')" severity="success"></p-button>
}
@if (book.metadata!['asinLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('asin')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('amazonRating')) {
<div class="field-group metadata-id-field">
<label for="amazonRating">{{ t('amazonRating') }} @if (isEmbeddable('amazonRating', 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="amazonRating" formControlName="amazonRating"/>
@if (!book.metadata!['amazonRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonRating')" severity="success"></p-button>
}
@if (book.metadata!['amazonRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('amazonReviewCount')) {
<div class="field-group metadata-id-field">
<label for="amazonRatingCount">{{ t('amazonReviewCount') }} @if (isEmbeddable('amazonReviewCount', 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="amazonRatingCount" formControlName="amazonReviewCount"/>
@if (!book.metadata!['amazonReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="success"></p-button>
}
@if (book.metadata!['amazonReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('googleId')) {
<div class="field-group metadata-id-field">
<label for="googleId">{{ t('googleBooksId') }} @if (isEmbeddable('googleId', 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="googleId" formControlName="googleId"/>
@if (!book.metadata!['googleIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('googleId')" severity="success"></p-button>
}
@if (book.metadata!['googleIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('googleId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('goodreadsId')) {
<div class="field-group metadata-id-field">
<label for="goodreadsId">{{ t('goodreadsId') }} @if (isEmbeddable('goodreadsId', 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="goodreadsId" formControlName="goodreadsId"/>
@if (!book.metadata!['goodreadsIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsId')" severity="success"></p-button>
}
@if (book.metadata!['goodreadsIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('goodreadsRating')) {
<div class="field-group metadata-id-field">
<label for="goodreadsRating">{{ t('goodreadsRating') }} @if (isEmbeddable('goodreadsRating', 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="goodreadsRating" formControlName="goodreadsRating"/>
@if (!book.metadata!['goodreadsRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsRating')" severity="success"></p-button>
}
@if (book.metadata!['goodreadsRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('goodreadsReviewCount')) {
<div class="field-group metadata-id-field">
<label for="goodreadsReviewCount">{{ t('goodreadsReviewCount') }} @if (isEmbeddable('goodreadsReviewCount', 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="goodreadsReviewCount" formControlName="goodreadsReviewCount"/>
@if (!book.metadata!['goodreadsReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="success"></p-button>
}
@if (book.metadata!['goodreadsReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('hardcoverId')) {
<div class="field-group metadata-id-field">
<label for="hardcoverId">{{ t('hardcoverId') }} @if (isEmbeddable('hardcoverId', 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="hardcoverId" formControlName="hardcoverId"/>
@if (!book.metadata!['hardcoverIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverId')" severity="success"></p-button>
}
@if (book.metadata!['hardcoverIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('hardcoverBookId')) {
<div class="field-group metadata-id-field">
<label for="hardcoverBookId">{{ t('hardcoverBookId') }} @if (isEmbeddable('hardcoverBookId', 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="hardcoverBookId" formControlName="hardcoverBookId"/>
@if (!book.metadata!['hardcoverBookIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverBookId')" severity="success"></p-button>
}
@if (book.metadata!['hardcoverBookIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverBookId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('hardcoverRating')) {
<div class="field-group metadata-id-field">
<label for="hardcoverRating">{{ t('hardcoverRating') }} @if (isEmbeddable('hardcoverRating', 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="hardcoverRating" formControlName="hardcoverRating"/>
@if (!book.metadata!['hardcoverRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverRating')" severity="success"></p-button>
}
@if (book.metadata!['hardcoverRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('hardcoverReviewCount')) {
<div class="field-group metadata-id-field">
<label for="hardcoverReviewCount">{{ t('hardcoverReviewCount') }} @if (isEmbeddable('hardcoverReviewCount', 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="hardcoverReviewCount" formControlName="hardcoverReviewCount"/>
@if (!book.metadata!['hardcoverReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="success"></p-button>
}
@if (book.metadata!['hardcoverReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('lubimyczytacId')) {
<div class="field-group metadata-id-field">
<label for="lubimyczytacId">{{ t('lubimyczytacId') }} @if (isEmbeddable('lubimyczytacId', 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="lubimyczytacId" formControlName="lubimyczytacId"/>
@if (!book.metadata!['lubimyczytacIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('lubimyczytacId')" severity="success"></p-button>
}
@if (book.metadata!['lubimyczytacIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('lubimyczytacId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('lubimyczytacRating')) {
<div class="field-group metadata-id-field">
<label for="lubimyczytacRating">{{ t('lubimyczytacRating') }} @if (isEmbeddable('lubimyczytacRating', 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="lubimyczytacRating" formControlName="lubimyczytacRating"/>
@if (!book.metadata!['lubimyczytacRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('lubimyczytacRating')" severity="success"></p-button>
}
@if (book.metadata!['lubimyczytacRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('lubimyczytacRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('comicvineId')) {
<div class="field-group metadata-id-field">
<label for="comicvineId">{{ t('comicvineId') }} @if (isEmbeddable('comicvineId', 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="comicvineId" formControlName="comicvineId"/>
@if (!book.metadata!['comicvineIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('comicvineId')" severity="success"></p-button>
}
@if (book.metadata!['comicvineIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('comicvineId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('ranobedbId')) {
<div class="field-group metadata-id-field">
<label for="ranobedbId">{{ t('ranobedbId') }} @if (isEmbeddable('ranobedbId', 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="ranobedbId" formControlName="ranobedbId"/>
@if (!book.metadata!['ranobedbIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbId')" severity="success"></p-button>
}
@if (book.metadata!['ranobedbIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('ranobedbId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('ranobedbRating')) {
<div class="field-group metadata-id-field">
<label for="ranobedbRating">{{ t('ranobedbRating') }} @if (isEmbeddable('ranobedbRating', 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="ranobedbRating" formControlName="ranobedbRating"/>
@if (!book.metadata!['ranobedbRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbRating')" severity="success"></p-button>
}
@if (book.metadata!['ranobedbRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('ranobedbRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('audibleId')) {
<div class="field-group metadata-id-field">
<label for="audibleId">{{ t('audibleId') }} @if (isEmbeddable('audibleId', 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="audibleId" formControlName="audibleId"/>
@if (!book.metadata!['audibleIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('audibleId')" severity="success"></p-button>
}
@if (book.metadata!['audibleIdLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('audibleId')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('audibleRating')) {
<div class="field-group metadata-id-field">
<label for="audibleRating">{{ t('audibleRating') }} @if (isEmbeddable('audibleRating', 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="audibleRating" formControlName="audibleRating"/>
@if (!book.metadata!['audibleRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('audibleRating')" severity="success"></p-button>
}
@if (book.metadata!['audibleRatingLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('audibleRating')" severity="warn"></p-button>
}
</div>
</div>
}
@if (isFieldVisible('audibleReviewCount')) {
<div class="field-group metadata-id-field">
<label for="audibleReviewCount">{{ t('audibleReviewCount') }} @if (isEmbeddable('audibleReviewCount', 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="audibleReviewCount" formControlName="audibleReviewCount"/>
@if (!book.metadata!['audibleReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('audibleReviewCount')" severity="success"></p-button>
}
@if (book.metadata!['audibleReviewCountLocked']) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('audibleReviewCount')" severity="warn"></p-button>
}
</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>
</div> </div>
@@ -1,4 +1,5 @@
import {Component, computed, DestroyRef, effect, EffectRef, EventEmitter, inject, Input, OnInit, Output} from "@angular/core"; import {HttpErrorResponse} from '@angular/common/http';
import {Component, computed, DestroyRef, EventEmitter, inject, Input, OnInit, Output} from "@angular/core";
import {InputText} from "@openng/optimus-ui/inputtext"; import {InputText} from "@openng/optimus-ui/inputtext";
import {Button} from "@openng/optimus-ui/button"; import {Button} from "@openng/optimus-ui/button";
import {Divider} from "@openng/optimus-ui/divider"; import {Divider} from "@openng/optimus-ui/divider";
@@ -8,7 +9,7 @@ import {MessageService} from "@openng/optimus-ui/api";
import {Book, BookMetadata, ComicMetadata, MetadataClearFlags, MetadataUpdateWrapper,} from "../../../../book/model/book.model"; import {Book, BookMetadata, ComicMetadata, MetadataClearFlags, MetadataUpdateWrapper,} from "../../../../book/model/book.model";
import {UrlHelperService} from "../../../../../shared/service/url-helper.service"; import {UrlHelperService} from "../../../../../shared/service/url-helper.service";
import {CoverComponent} from "../../../../../shared/components/cover/cover.component"; import {CoverComponent} from "../../../../../shared/components/cover/cover.component";
import {ALL_COMIC_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELDS, COMIC_FORM_TO_MODEL_LOCK, COMIC_TEXT_METADATA_FIELDS, COMIC_ARRAY_METADATA_FIELDS, COMIC_TEXTAREA_METADATA_FIELDS, isFieldEmbeddable, hasMetadataWriter} from '../../../../../shared/metadata'; import {ALL_COMIC_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELDS, COMIC_FORM_TO_MODEL_LOCK, COMIC_TEXT_METADATA_FIELDS, COMIC_ARRAY_METADATA_FIELDS, COMIC_TEXTAREA_METADATA_FIELDS, isFieldEmbeddable, hasMetadataWriter, MetadataProviderFieldsService, providerFieldRecord} from '../../../../../shared/metadata';
import {FileUpload, FileUploadErrorEvent, FileUploadEvent,} from "@openng/optimus-ui/fileupload"; import {FileUpload, FileUploadErrorEvent, FileUploadEvent,} from "@openng/optimus-ui/fileupload";
import {HttpResponse} from "@angular/common/http"; import {HttpResponse} from "@angular/common/http";
import {BookService} from "../../../../book/service/book.service"; import {BookService} from "../../../../book/service/book.service";
@@ -33,6 +34,9 @@ import {MetadataProviderSpecificFields} from '../../../../../shared/model/app-se
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop';
import {QueryClient} from '@tanstack/angular-query-experimental';
import {MetadataSourceQueryService} from '../../../sources/metadata-source-query.service';
@Component({ @Component({
selector: "app-metadata-editor", selector: "app-metadata-editor",
standalone: true, standalone: true,
@@ -102,6 +106,9 @@ export class MetadataEditorComponent implements OnInit {
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly queryClient = inject(QueryClient);
private readonly sources = inject(MetadataSourceQueryService);
protected readonly providerFields = inject(MetadataProviderFieldsService);
private readonly uniqueMetadata = computed(() => this.bookService.uniqueMetadata()); private readonly uniqueMetadata = computed(() => this.bookService.uniqueMetadata());
metadataForm: FormGroup; metadataForm: FormGroup;
@@ -147,33 +154,13 @@ export class MetadataEditorComponent implements OnInit {
comicTextareaFields = COMIC_TEXTAREA_METADATA_FIELDS; comicTextareaFields = COMIC_TEXTAREA_METADATA_FIELDS;
audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS; audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS;
providerSpecificFields: MetadataProviderSpecificFields = { private readonly providerSpecificFields = computed<MetadataProviderSpecificFields>(
openlibraryId: true, () => this.appSettingsService.appSettings()?.metadataProviderSpecificFields
asin: true, ?? providerFieldRecord(this.providerFields.fields(), () => true),
amazonRating: true, );
amazonReviewCount: true,
googleId: true, private readonly providerFieldNames = computed(() => new Set(this.providerFields.fields().map(field => field.name)));
goodreadsId: true,
goodreadsRating: true,
goodreadsReviewCount: true,
hardcoverId: true,
hardcoverBookId: true,
hardcoverRating: true,
hardcoverReviewCount: true,
comicvineId: true,
lubimyczytacId: true,
lubimyczytacRating: true,
ranobedbId: true,
ranobedbRating: true,
audibleId: true,
audibleRating: true,
audibleReviewCount: true,
applebooksId: true,
applebooksRating: true,
applebooksReviewCount: true,
};
private syncProviderFieldsEffect!: EffectRef;
readonly navigationState = this.bookNavigationService.navigationState; readonly navigationState = this.bookNavigationService.navigationState;
readonly canNavigatePrevious = this.bookNavigationService.canNavigatePrevious; readonly canNavigatePrevious = this.bookNavigationService.canNavigatePrevious;
readonly canNavigateNext = this.bookNavigationService.canNavigateNext; readonly canNavigateNext = this.bookNavigationService.canNavigateNext;
@@ -279,29 +266,6 @@ export class MetadataEditorComponent implements OnInit {
description: new FormControl(""), description: new FormControl(""),
pageCount: new FormControl(""), pageCount: new FormControl(""),
language: new FormControl(""), language: new FormControl(""),
openlibraryId: new FormControl(""),
asin: new FormControl(""),
amazonRating: new FormControl(""),
amazonReviewCount: new FormControl(""),
goodreadsId: new FormControl(""),
comicvineId: new FormControl(""),
goodreadsRating: new FormControl(""),
goodreadsReviewCount: new FormControl(""),
hardcoverId: new FormControl(""),
hardcoverBookId: new FormControl(""),
hardcoverRating: new FormControl(""),
hardcoverReviewCount: new FormControl(""),
lubimyczytacId: new FormControl(""),
lubimyczytacRating: new FormControl(""),
ranobedbId: new FormControl(""),
ranobedbRating: new FormControl(""),
googleId: new FormControl(""),
audibleId: new FormControl(""),
audibleRating: new FormControl(""),
audibleReviewCount: new FormControl(""),
applebooksId: new FormControl(""),
applebooksRating: new FormControl(""),
applebooksReviewCount: new FormControl(""),
seriesName: new FormControl(""), seriesName: new FormControl(""),
seriesNumber: new FormControl(""), seriesNumber: new FormControl(""),
seriesTotal: new FormControl(""), seriesTotal: new FormControl(""),
@@ -321,29 +285,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: new FormControl(false), descriptionLocked: new FormControl(false),
pageCountLocked: new FormControl(false), pageCountLocked: new FormControl(false),
languageLocked: new FormControl(false), languageLocked: new FormControl(false),
openlibraryIdLocked: new FormControl(false),
asinLocked: new FormControl(false),
amazonRatingLocked: new FormControl(false),
amazonReviewCountLocked: new FormControl(false),
goodreadsIdLocked: new FormControl(""),
comicvineIdLocked: new FormControl(false),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
hardcoverIdLocked: new FormControl(false),
hardcoverBookIdLocked: new FormControl(false),
hardcoverRatingLocked: new FormControl(false),
hardcoverReviewCountLocked: new FormControl(false),
lubimyczytacIdLocked: new FormControl(false),
lubimyczytacRatingLocked: new FormControl(false),
ranobedbIdLocked: new FormControl(""),
ranobedbRatingLocked: new FormControl(false),
googleIdLocked: new FormControl(false),
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), seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false), seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false), seriesTotalLocked: new FormControl(false),
@@ -380,6 +321,11 @@ export class MetadataEditorComponent implements OnInit {
{label: '21+', value: 21} {label: '21+', value: 21}
]; ];
for (const field of this.providerFields.fields()) {
this.metadataForm.addControl(field.name, new FormControl(''));
this.metadataForm.addControl(field.lockName, new FormControl(false));
}
// Add audiobook metadata form controls // Add audiobook metadata form controls
for (const field of AUDIOBOOK_METADATA_FIELDS) { for (const field of AUDIOBOOK_METADATA_FIELDS) {
const defaultValue = field.type === 'boolean' ? null : ''; const defaultValue = field.type === 'boolean' ? null : '';
@@ -393,13 +339,6 @@ export class MetadataEditorComponent implements OnInit {
this.metadataForm.addControl(field.controlName, new FormControl(defaultValue)); this.metadataForm.addControl(field.controlName, new FormControl(defaultValue));
this.metadataForm.addControl(field.lockedKey, new FormControl(false)); this.metadataForm.addControl(field.lockedKey, new FormControl(false));
} }
this.syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) {
this.providerSpecificFields = settings.metadataProviderSpecificFields;
}
});
} }
ngOnInit(): void { ngOnInit(): void {
@@ -427,29 +366,6 @@ export class MetadataEditorComponent implements OnInit {
language: metadata.language ?? null, language: metadata.language ?? null,
rating: metadata.rating ?? null, rating: metadata.rating ?? null,
reviewCount: metadata.reviewCount ?? null, reviewCount: metadata.reviewCount ?? null,
openlibraryId: metadata.openlibraryId ?? null,
asin: metadata.asin ?? null,
amazonRating: metadata.amazonRating ?? null,
amazonReviewCount: metadata.amazonReviewCount ?? null,
goodreadsId: metadata.goodreadsId ?? null,
comicvineId: metadata.comicvineId ?? null,
goodreadsRating: metadata.goodreadsRating ?? null,
goodreadsReviewCount: metadata.goodreadsReviewCount ?? null,
hardcoverId: metadata.hardcoverId ?? null,
hardcoverBookId: metadata.hardcoverBookId ?? null,
hardcoverRating: metadata.hardcoverRating ?? null,
hardcoverReviewCount: metadata.hardcoverReviewCount ?? null,
lubimyczytacId: metadata.lubimyczytacId ?? null,
lubimyczytacRating: metadata.lubimyczytacRating ?? null,
ranobedbId: metadata.ranobedbId ?? null,
ranobedbRating: metadata.ranobedbRating ?? null,
googleId: metadata.googleId ?? null,
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, seriesName: metadata.seriesName ?? null,
seriesNumber: metadata.seriesNumber ?? null, seriesNumber: metadata.seriesNumber ?? null,
seriesTotal: metadata.seriesTotal ?? null, seriesTotal: metadata.seriesTotal ?? null,
@@ -466,29 +382,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: metadata.descriptionLocked ?? false, descriptionLocked: metadata.descriptionLocked ?? false,
pageCountLocked: metadata.pageCountLocked ?? false, pageCountLocked: metadata.pageCountLocked ?? false,
languageLocked: metadata.languageLocked ?? false, languageLocked: metadata.languageLocked ?? false,
openlibraryIdLocked: metadata.openlibraryIdLocked ?? false,
asinLocked: metadata.asinLocked ?? false,
amazonRatingLocked: metadata.amazonRatingLocked ?? false,
amazonReviewCountLocked: metadata.amazonReviewCountLocked ?? false,
goodreadsIdLocked: metadata.goodreadsIdLocked ?? false,
comicvineIdLocked: metadata.comicvineIdLocked ?? false,
goodreadsRatingLocked: metadata.goodreadsRatingLocked ?? false,
goodreadsReviewCountLocked: metadata.goodreadsReviewCountLocked ?? false,
hardcoverIdLocked: metadata.hardcoverIdLocked ?? false,
hardcoverBookIdLocked: metadata.hardcoverBookIdLocked ?? false,
hardcoverRatingLocked: metadata.hardcoverRatingLocked ?? false,
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked ?? false,
lubimyczytacIdLocked: metadata.lubimyczytacIdLocked ?? false,
lubimyczytacRatingLocked: metadata.lubimyczytacRatingLocked ?? false,
ranobedbIdLocked: metadata.ranobedbIdLocked ?? false,
ranobedbRatingLocked: metadata.ranobedbRatingLocked ?? false,
googleIdLocked: metadata.googleIdLocked ?? false,
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, seriesNameLocked: metadata.seriesNameLocked ?? false,
seriesNumberLocked: metadata.seriesNumberLocked ?? false, seriesNumberLocked: metadata.seriesNumberLocked ?? false,
seriesTotalLocked: metadata.seriesTotalLocked ?? false, seriesTotalLocked: metadata.seriesTotalLocked ?? false,
@@ -501,6 +394,13 @@ export class MetadataEditorComponent implements OnInit {
contentRatingLocked: metadata.contentRatingLocked ?? false, contentRatingLocked: metadata.contentRatingLocked ?? false,
}); });
const providerPatch: Record<string, string | number | boolean | null> = {};
for (const field of this.providerFields.fields()) {
providerPatch[field.name] = metadata[field.name] ?? null;
providerPatch[field.lockName] = metadata[field.lockName] ?? false;
}
this.metadataForm.patchValue(providerPatch);
// Patch audiobook metadata // Patch audiobook metadata
const audiobookPatch: Record<string, unknown> = {}; const audiobookPatch: Record<string, unknown> = {};
for (const field of AUDIOBOOK_METADATA_FIELDS) { for (const field of AUDIOBOOK_METADATA_FIELDS) {
@@ -540,30 +440,7 @@ export class MetadataEditorComponent implements OnInit {
{key: "languageLocked", control: "language"}, {key: "languageLocked", control: "language"},
{key: "isbn10Locked", control: "isbn10"}, {key: "isbn10Locked", control: "isbn10"},
{key: "isbn13Locked", control: "isbn13"}, {key: "isbn13Locked", control: "isbn13"},
{key: "openlibraryIdLocked", control: "openlibraryId"}, ...this.providerFields.fields().map(field => ({key: field.lockName, control: field.name})),
{key: "asinLocked", control: "asin"},
{key: "amazonReviewCountLocked", control: "amazonReviewCount"},
{key: "amazonRatingLocked", control: "amazonRating"},
{key: "goodreadsIdLocked", control: "goodreadsId"},
{key: "comicvineIdLocked", control: "comicvineId"},
{key: "goodreadsReviewCountLocked", control: "goodreadsReviewCount"},
{key: "goodreadsRatingLocked", control: "goodreadsRating"},
{key: "hardcoverIdLocked", control: "hardcoverId"},
{key: "hardcoverBookIdLocked", control: "hardcoverBookId"},
{key: "hardcoverReviewCountLocked", control: "hardcoverReviewCount"},
{key: "hardcoverRatingLocked", control: "hardcoverRating"},
{key: "lubimyczytacIdLocked", control: "lubimyczytacId"},
{key: "lubimyczytacRatingLocked", control: "lubimyczytacRating"},
{key: "ranobedbReviewCountLocked", control: "ranobedbReviewCount"},
{key: "ranobedbIdLocked", control: "ranobedbId"},
{key: "ranobedbRatingLocked", control: "ranobedbRating"},
{key: "googleIdLocked", control: "googleId"},
{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: "pageCountLocked", control: "pageCount"},
{key: "descriptionLocked", control: "description"}, {key: "descriptionLocked", control: "description"},
{key: "seriesNameLocked", control: "seriesName"}, {key: "seriesNameLocked", control: "seriesName"},
@@ -735,29 +612,6 @@ export class MetadataEditorComponent implements OnInit {
pageCount: form.get("pageCount")?.value, pageCount: form.get("pageCount")?.value,
rating: form.get("rating")?.value, rating: form.get("rating")?.value,
reviewCount: form.get("reviewCount")?.value, reviewCount: form.get("reviewCount")?.value,
openlibraryId: form.get("openlibraryId")?.value,
asin: form.get("asin")?.value,
amazonRating: form.get("amazonRating")?.value,
amazonReviewCount: form.get("amazonReviewCount")?.value,
goodreadsId: form.get("goodreadsId")?.value,
comicvineId: form.get("comicvineId")?.value,
goodreadsRating: form.get("goodreadsRating")?.value,
goodreadsReviewCount: form.get("goodreadsReviewCount")?.value,
hardcoverId: form.get("hardcoverId")?.value,
hardcoverBookId: form.get("hardcoverBookId")?.value,
hardcoverRating: form.get("hardcoverRating")?.value,
hardcoverReviewCount: form.get("hardcoverReviewCount")?.value,
lubimyczytacId: form.get("lubimyczytacId")?.value,
lubimyczytacRating: form.get("lubimyczytacRating")?.value,
ranobedbId: form.get("ranobedbId")?.value,
ranobedbRating: form.get("ranobedbRating")?.value,
googleId: form.get("googleId")?.value,
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, language: form.get("language")?.value,
seriesName: form.get("seriesName")?.value, seriesName: form.get("seriesName")?.value,
seriesNumber: form.get("seriesNumber")?.value, seriesNumber: form.get("seriesNumber")?.value,
@@ -785,29 +639,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: form.get("descriptionLocked")?.value, descriptionLocked: form.get("descriptionLocked")?.value,
pageCountLocked: form.get("pageCountLocked")?.value, pageCountLocked: form.get("pageCountLocked")?.value,
languageLocked: form.get("languageLocked")?.value, languageLocked: form.get("languageLocked")?.value,
openlibraryIdLocked: form.get("openlibraryIdLocked")?.value,
asinLocked: form.get("asinLocked")?.value,
amazonRatingLocked: form.get("amazonRatingLocked")?.value,
amazonReviewCountLocked: form.get("amazonReviewCountLocked")?.value,
goodreadsIdLocked: form.get("goodreadsIdLocked")?.value,
comicvineIdLocked: form.get("comicvineIdLocked")?.value,
goodreadsRatingLocked: form.get("goodreadsRatingLocked")?.value,
goodreadsReviewCountLocked: form.get("goodreadsReviewCountLocked")?.value,
hardcoverIdLocked: form.get("hardcoverIdLocked")?.value,
hardcoverBookIdLocked: form.get("hardcoverBookIdLocked")?.value,
hardcoverRatingLocked: form.get("hardcoverRatingLocked")?.value,
hardcoverReviewCountLocked: form.get("hardcoverReviewCountLocked")?.value,
lubimyczytacIdLocked: form.get("lubimyczytacIdLocked")?.value,
lubimyczytacRatingLocked: form.get("lubimyczytacRatingLocked")?.value,
ranobedbIdLocked: form.get("ranobedbIdLocked")?.value,
ranobedbRatingLocked: form.get("ranobedbRatingLocked")?.value,
googleIdLocked: form.get("googleIdLocked")?.value,
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, seriesNameLocked: form.get("seriesNameLocked")?.value,
seriesNumberLocked: form.get("seriesNumberLocked")?.value, seriesNumberLocked: form.get("seriesNumberLocked")?.value,
seriesTotalLocked: form.get("seriesTotalLocked")?.value, seriesTotalLocked: form.get("seriesTotalLocked")?.value,
@@ -824,6 +655,11 @@ export class MetadataEditorComponent implements OnInit {
}), }),
}; };
for (const field of this.providerFields.fields()) {
metadata[field.name] = form.get(field.name)?.value;
metadata[field.lockName] = form.get(field.lockName)?.value;
}
// Build comic metadata from form controls // Build comic metadata from form controls
const comicMetadata: Record<string, unknown> = {}; const comicMetadata: Record<string, unknown> = {};
for (const field of ALL_COMIC_METADATA_FIELDS) { for (const field of ALL_COMIC_METADATA_FIELDS) {
@@ -879,29 +715,6 @@ export class MetadataEditorComponent implements OnInit {
description: wasCleared("description"), description: wasCleared("description"),
pageCount: wasCleared("pageCount"), pageCount: wasCleared("pageCount"),
language: wasCleared("language"), language: wasCleared("language"),
openlibraryId: wasCleared("openlibraryId"),
asin: wasCleared("asin"),
amazonRating: wasCleared("amazonRating"),
amazonReviewCount: wasCleared("amazonReviewCount"),
goodreadsId: wasCleared("goodreadsId"),
comicvineId: wasCleared("comicvineId"),
goodreadsRating: wasCleared("goodreadsRating"),
goodreadsReviewCount: wasCleared("goodreadsReviewCount"),
hardcoverId: wasCleared("hardcoverId"),
hardcoverRating: wasCleared("hardcoverRating"),
hardcoverReviewCount: wasCleared("hardcoverReviewCount"),
hardcoverBookId: wasCleared("hardcoverBookId"),
lubimyczytacId: wasCleared("lubimyczytacId"),
lubimyczytacRating: wasCleared("lubimyczytacRating"),
ranobedbId: wasCleared("ranobedbId"),
ranobedbRating: wasCleared("ranobedbRating"),
googleId: wasCleared("googleId"),
audibleId: wasCleared("audibleId"),
audibleRating: wasCleared("audibleRating"),
audibleReviewCount: wasCleared("audibleReviewCount"),
applebooksId: wasCleared("applebooksId"),
applebooksRating: wasCleared("applebooksRating"),
applebooksReviewCount: wasCleared("applebooksReviewCount"),
seriesName: wasCleared("seriesName"), seriesName: wasCleared("seriesName"),
seriesNumber: wasCleared("seriesNumber"), seriesNumber: wasCleared("seriesNumber"),
seriesTotal: wasCleared("seriesTotal"), seriesTotal: wasCleared("seriesTotal"),
@@ -913,6 +726,10 @@ export class MetadataEditorComponent implements OnInit {
contentRating: wasCleared("contentRating"), contentRating: wasCleared("contentRating"),
}; };
for (const field of this.providerFields.fields()) {
clearFlags[field.name] = wasCleared(field.name);
}
return {metadata, clearFlags}; return {metadata, clearFlags};
} }
@@ -1101,29 +918,26 @@ export class MetadataEditorComponent implements OnInit {
}, 15000); }, 15000);
} }
fetchFromFile(bookId: number) { async fetchFromFile(bookId: number): Promise<void> {
this.isFetchingFromFile = true; this.isFetchingFromFile = true;
this.bookMetadataManageService.getFileMetadata(bookId).pipe( try {
finalize(() => this.isFetchingFromFile = false), this.populateFormFromMetadata(await this.queryClient.query(this.sources.fileMetadata(bookId)));
takeUntilDestroyed(this.destroyRef) this.metadataForm.markAsDirty();
).subscribe({ this.messageService.add({
next: (metadata) => { severity: 'info',
this.populateFormFromMetadata(metadata); summary: this.t.translate('metadata.editor.toast.successSummary'),
this.metadataForm.markAsDirty(); detail: this.t.translate('metadata.editor.toast.fileMetadataLoaded'),
this.messageService.add({ });
severity: 'info', } catch (err) {
summary: this.t.translate('metadata.editor.toast.successSummary'), const message: unknown = err instanceof HttpErrorResponse ? err.error?.message : null;
detail: this.t.translate('metadata.editor.toast.fileMetadataLoaded'), this.messageService.add({
}); severity: 'error',
}, summary: this.t.translate('metadata.editor.toast.errorSummary'),
error: (err) => { detail: typeof message === 'string' ? message : this.t.translate('metadata.editor.toast.fileMetadataFailed'),
this.messageService.add({ });
severity: 'error', } finally {
summary: this.t.translate('metadata.editor.toast.errorSummary'), this.isFetchingFromFile = false;
detail: err?.error?.message || this.t.translate('metadata.editor.toast.fileMetadataFailed'), }
});
}
});
} }
onNext() { onNext() {
@@ -1189,7 +1003,7 @@ export class MetadataEditorComponent implements OnInit {
} }
isFieldVisible(field: keyof MetadataProviderSpecificFields): boolean { isFieldVisible(field: keyof MetadataProviderSpecificFields): boolean {
return this.providerSpecificFields[field] ?? false; return this.providerSpecificFields()[field];
} }
protected readonly sample = sample; protected readonly sample = sample;
@@ -1225,7 +1039,7 @@ export class MetadataEditorComponent implements OnInit {
} }
isEmbeddable(controlName: string, book: Book): boolean { isEmbeddable(controlName: string, book: Book): boolean {
return isFieldEmbeddable(book.primaryFile?.bookType, controlName); return isFieldEmbeddable(book.primaryFile?.bookType, controlName, this.providerFieldNames());
} }
hasWriter(book: Book): boolean { hasWriter(book: Book): boolean {
@@ -1,13 +1,6 @@
@if (book; as book) { @if (book; as book) {
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="metadata-picker" *transloco="let t; prefix: 'metadata.picker'"> <form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="metadata-picker" *transloco="let t; prefix: 'metadata.picker'">
<div class="dialog-body"> <div class="dialog-body">
@if (detailLoading) {
<div class="detail-loading-banner">
<i class="pi pi-spin pi-spinner"></i>
<span>{{ t('loadingMetadata') }}</span>
</div>
}
<!-- Column Headers --> <!-- Column Headers -->
<div class="column-headers"> <div class="column-headers">
<div class="column-label current"> <div class="column-label current">
@@ -716,7 +709,7 @@
} }
<!-- Provider Metadata Section --> <!-- Provider Metadata Section -->
@if (metadataProviderFields.length > 0) { @if (metadataProviderFields().length > 0) {
<section class="form-section"> <section class="form-section">
<div class="section-header"> <div class="section-header">
<i class="pi pi-cloud"></i> <i class="pi pi-cloud"></i>
@@ -724,9 +717,9 @@
</div> </div>
<div class="section-content"> <div class="section-content">
@for (field of metadataProviderFields; track field) { @for (field of metadataProviderFields(); track field) {
<div class="field-row"> <div class="field-row">
<span class="field-label">{{ field.label }}</span> <span class="field-label">{{ providerFields.label(field.providerKey!) }}</span>
<div class="field-content"> <div class="field-content">
<div class="field-side current"> <div class="field-side current">
<button <button
@@ -25,26 +25,6 @@
} }
// Detail loading banner
.detail-loading-banner {
display: flex;
align-items: center;
justify-content: center;
gap: 0.4375rem;
padding: 0.5469rem 0.875rem;
background: rgb(34 197 94 / 10%);
border: 1px solid rgb(34 197 94 / 30%);
border-radius: 8px;
color: var(--p-green-400);
font-size: var(--app-text-sm);
font-weight: 600;
animation: fade-in 0.3s ease-in;
i {
font-size: var(--app-text-base);
}
}
// Body // Body
.dialog-body { .dialog-body {
flex: 1; flex: 1;
@@ -374,7 +354,7 @@
min-width: 100px; min-width: 100px;
@media (width >= 768px) { @media (width >= 768px) {
min-width: 120px; width: 120px;
flex-shrink: 0; flex-shrink: 0;
} }
} }
@@ -3,7 +3,6 @@ import {TestBed} from '@angular/core/testing';
import {of} from 'rxjs'; import {of} from 'rxjs';
import {beforeEach, describe, expect, it, vi} from 'vitest'; import {beforeEach, describe, expect, it, vi} from 'vitest';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {TranslocoService} from '@jsverse/transloco';
import {CdkDragDrop} from '@angular/cdk/drag-drop'; import {CdkDragDrop} from '@angular/cdk/drag-drop';
import {AutoCompleteSelectEvent} from '@openng/optimus-ui/autocomplete'; import {AutoCompleteSelectEvent} from '@openng/optimus-ui/autocomplete';
@@ -15,6 +14,7 @@ import {AppSettingsService} from '../../../../../shared/service/app-settings.ser
import {UrlHelperService} from '../../../../../shared/service/url-helper.service'; import {UrlHelperService} from '../../../../../shared/service/url-helper.service';
import {MetadataFormBuilder} from '../../../../../shared/metadata'; import {MetadataFormBuilder} from '../../../../../shared/metadata';
import {MetadataUtilsService} from '../../../../../shared/metadata/metadata-utils.service'; import {MetadataUtilsService} from '../../../../../shared/metadata/metadata-utils.service';
import {getTranslocoModule} from '../../../../../core/testing/transloco-testing';
import {MetadataPickerComponent} from './metadata-picker.component'; import {MetadataPickerComponent} from './metadata-picker.component';
describe('MetadataPickerComponent', () => { describe('MetadataPickerComponent', () => {
@@ -31,7 +31,6 @@ describe('MetadataPickerComponent', () => {
const uploadAudiobookCoverFromUrl = vi.fn(() => of(void 0)); const uploadAudiobookCoverFromUrl = vi.fn(() => of(void 0));
const supportsDualCovers = vi.fn(() => true); const supportsDualCovers = vi.fn(() => true);
const messageAdd = vi.fn(); const messageAdd = vi.fn();
const translate = vi.fn((key: string, params?: Record<string, unknown>) => params?.['field'] ? `${key}:${params['field']}` : key);
const getThumbnailUrl = vi.fn((bookId: number, updatedOn?: string) => `thumb:${bookId}:${updatedOn ?? 'none'}`); const getThumbnailUrl = vi.fn((bookId: number, updatedOn?: string) => `thumb:${bookId}:${updatedOn ?? 'none'}`);
const getCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `cover:${bookId}:${updatedOn ?? 'none'}`); const getCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `cover:${bookId}:${updatedOn ?? 'none'}`);
const getAudiobookCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `audio-cover:${bookId}:${updatedOn ?? 'none'}`); const getAudiobookCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `audio-cover:${bookId}:${updatedOn ?? 'none'}`);
@@ -44,7 +43,7 @@ describe('MetadataPickerComponent', () => {
authors: ['Alice'], authors: ['Alice'],
categories: ['Fantasy'], categories: ['Fantasy'],
description: 'Original description', description: 'Original description',
provider: 'googleBooks', provider: 'Google',
coverUpdatedOn: '2026-03-26', coverUpdatedOn: '2026-03-26',
titleLocked: true, titleLocked: true,
comicMetadata: { comicMetadata: {
@@ -68,7 +67,7 @@ describe('MetadataPickerComponent', () => {
} as Book; } as Book;
} }
beforeEach(() => { beforeEach(async () => {
uniqueMetadata.set({ uniqueMetadata.set({
authors: ['Alice', 'Bob'], authors: ['Alice', 'Bob'],
categories: ['Fantasy', 'History'], categories: ['Fantasy', 'History'],
@@ -82,12 +81,12 @@ describe('MetadataPickerComponent', () => {
uploadAudiobookCoverFromUrl.mockClear(); uploadAudiobookCoverFromUrl.mockClear();
supportsDualCovers.mockClear(); supportsDualCovers.mockClear();
messageAdd.mockClear(); messageAdd.mockClear();
translate.mockClear();
getThumbnailUrl.mockClear(); getThumbnailUrl.mockClear();
getCoverUrl.mockClear(); getCoverUrl.mockClear();
getAudiobookCoverUrl.mockClear(); getAudiobookCoverUrl.mockClear();
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [getTranslocoModule({preloadLangs: true})],
providers: [ providers: [
MetadataFormBuilder, MetadataFormBuilder,
MetadataUtilsService, MetadataUtilsService,
@@ -102,9 +101,8 @@ describe('MetadataPickerComponent', () => {
useValue: {getThumbnailUrl, getCoverUrl, getAudiobookCoverUrl}, useValue: {getThumbnailUrl, getCoverUrl, getAudiobookCoverUrl},
}, },
{provide: MessageService, useValue: {add: messageAdd}}, {provide: MessageService, useValue: {add: messageAdd}},
{provide: TranslocoService, useValue: {translate}},
] ]
}); }).compileComponents();
}); });
it('syncs provider field visibility from app settings and filters metadata suggestions', () => { it('syncs provider field visibility from app settings and filters metadata suggestions', () => {
@@ -119,9 +117,9 @@ describe('MetadataPickerComponent', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent()); const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
TestBed.flushEffects(); TestBed.flushEffects();
expect(component.metadataProviderFields.map(field => field.controlName)).toContain('googleId'); expect(component.metadataProviderFields().map(field => field.controlName)).toContain('googleId');
expect(component.metadataProviderFields.map(field => field.controlName)).toContain('audibleId'); expect(component.metadataProviderFields().map(field => field.controlName)).toContain('audibleId');
expect(component.metadataProviderFields.map(field => field.controlName)).not.toContain('amazonRating'); expect(component.metadataProviderFields().map(field => field.controlName)).not.toContain('amazonRating');
component.filterItems({query: 'fan'}, 'categories'); component.filterItems({query: 'fan'}, 'categories');
expect(component.getFiltered('categories')).toEqual(['Fantasy']); expect(component.getFiltered('categories')).toEqual(['Fantasy']);
@@ -134,7 +132,7 @@ describe('MetadataPickerComponent', () => {
component.copiedFields = {title: true}; component.copiedFields = {title: true};
component.savedFields = {title: true}; component.savedFields = {title: true};
component.hoveredFields = {title: true}; component.hoveredFields = {title: true};
component.fetchedMetadata = createMetadata({provider: 'comicvine'}); component.fetchedMetadata = createMetadata({provider: 'Comicvine'});
component.book = createBook(); component.book = createBook();
@@ -151,6 +149,7 @@ describe('MetadataPickerComponent', () => {
it('handles author and array autocomplete helpers without duplicating values', () => { it('handles author and array autocomplete helpers without duplicating values', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent()); const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata();
component.book = createBook(); component.book = createBook();
component.metadataForm.get('authors')?.setValue(['Alice', 'Bob']); component.metadataForm.get('authors')?.setValue(['Alice', 'Bob']);
@@ -179,19 +178,19 @@ describe('MetadataPickerComponent', () => {
it('copies fetched values, respects locked fields, and resets fields back to the original metadata', () => { it('copies fetched values, respects locked fields, and resets fields back to the original metadata', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent()); const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.book = createBook();
component.fetchedMetadata = createMetadata({ component.fetchedMetadata = createMetadata({
title: 'Fetched Title', title: 'Fetched Title',
provider: 'Audible', provider: 'Audible',
thumbnailUrl: 'https://covers.example/audiobook.jpg', thumbnailUrl: 'https://covers.example/audiobook.jpg',
comicMetadata: {issueNumber: '7'}, comicMetadata: {issueNumber: '7'},
}); });
component.book = createBook();
component.copyFetchedToCurrent('title'); component.copyFetchedToCurrent('title');
expect(messageAdd).toHaveBeenCalledWith({ expect(messageAdd).toHaveBeenCalledWith({
severity: 'warn', severity: 'warn',
summary: 'metadata.picker.toast.actionBlockedSummary', summary: 'Action Blocked',
detail: 'metadata.picker.toast.fieldLockedDetail:title', detail: 'title is locked and cannot be updated.',
}); });
component.metadataForm.get('titleLocked')?.setValue(false); component.metadataForm.get('titleLocked')?.setValue(false);
@@ -208,8 +207,8 @@ describe('MetadataPickerComponent', () => {
component.copyFetchedToCurrent('comicIssueNumber'); component.copyFetchedToCurrent('comicIssueNumber');
expect(messageAdd).toHaveBeenLastCalledWith({ expect(messageAdd).toHaveBeenLastCalledWith({
severity: 'warn', severity: 'warn',
summary: 'metadata.picker.toast.actionBlockedSummary', summary: 'Action Blocked',
detail: 'metadata.picker.toast.fieldLockedDetail:Issue #', detail: 'Issue # is locked and cannot be updated.',
}); });
component.resetField('title'); component.resetField('title');
@@ -217,14 +216,11 @@ describe('MetadataPickerComponent', () => {
expect(component.isValueCopied('title')).toBe(false); expect(component.isValueCopied('title')).toBe(false);
}); });
it('saves metadata, uploads audible covers when needed, and toggles lock states', () => { it('saves metadata and marks copied fields as saved', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent()); const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata({ component.fetchedMetadata = createMetadata();
provider: 'Audible',
thumbnailUrl: 'https://covers.example/audiobook.jpg',
});
component.book = createBook(); component.book = createBook();
component.copiedFields = {title: true, audiobookThumbnailUrl: true}; component.copiedFields = {title: true};
component.metadataForm.get('titleLocked')?.setValue(false); component.metadataForm.get('titleLocked')?.setValue(false);
component.metadataForm.get('title')?.enable(); component.metadataForm.get('title')?.enable();
component.metadataForm.get('title')?.setValue('Updated Title'); component.metadataForm.get('title')?.setValue('Updated Title');
@@ -235,15 +231,34 @@ describe('MetadataPickerComponent', () => {
metadata: expect.objectContaining({title: 'Updated Title'}), metadata: expect.objectContaining({title: 'Updated Title'}),
clearFlags: expect.any(Object), clearFlags: expect.any(Object),
}), false, 'REPLACE_WHEN_PROVIDED'); }), false, 'REPLACE_WHEN_PROVIDED');
expect(uploadAudiobookCoverFromUrl).toHaveBeenCalledWith(21, 'https://covers.example/audiobook.jpg');
expect(component.isSaving).toBe(false); expect(component.isSaving).toBe(false);
expect(component.isValueSaved('title')).toBe(true); expect(component.isValueSaved('title')).toBe(true);
expect(component.isValueSaved('audiobookThumbnailUrl')).toBe(true);
expect(messageAdd).toHaveBeenCalledWith({ expect(messageAdd).toHaveBeenCalledWith({
severity: 'info', severity: 'info',
summary: 'metadata.picker.toast.successSummary', summary: 'Success',
detail: 'metadata.picker.toast.metadataUpdated', detail: 'Book metadata updated',
}); });
});
it('uploads an Audible cover when its fetched cover was copied', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata({
provider: 'Audible',
thumbnailUrl: 'https://covers.example/audiobook.jpg',
});
component.book = createBook();
component.copiedFields = {audiobookThumbnailUrl: true};
component.onSave();
expect(uploadAudiobookCoverFromUrl).toHaveBeenCalledWith(21, 'https://covers.example/audiobook.jpg');
expect(component.isValueSaved('audiobookThumbnailUrl')).toBe(true);
});
it('toggles individual and all lock states', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata();
component.book = createBook();
component.toggleLock('thumbnailUrl'); component.toggleLock('thumbnailUrl');
expect(component.metadataForm.get('coverLocked')?.value).toBe(true); expect(component.metadataForm.get('coverLocked')?.value).toBe(true);
@@ -252,24 +267,11 @@ describe('MetadataPickerComponent', () => {
component.lockAll(); component.lockAll();
component.unlockAll(); component.unlockAll();
expect(updateBookMetadata).toHaveBeenCalledTimes(4); expect(updateBookMetadata).toHaveBeenCalledTimes(3);
}); });
it('covers hover state, back navigation, dual-cover helpers, and comic visibility helpers', () => { it('tracks hover state for copied fields that are not saved', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent()); const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
const goBackEmit = vi.spyOn(component.goBack, 'emit');
const book = createBook({}, {
isPhysical: true,
primaryFile: undefined,
alternativeFormats: [{id: 2, bookId: 21, bookType: 'AUDIOBOOK'}],
});
component.fetchedMetadata = createMetadata({
provider: 'comicvine',
narrator: 'Narrator',
comicMetadata: {issueNumber: '7'},
});
component.book = book;
component.copiedFields = {title: true}; component.copiedFields = {title: true};
component.savedFields = {title: false}; component.savedFields = {title: false};
@@ -278,19 +280,43 @@ describe('MetadataPickerComponent', () => {
component.onMouseLeave('title'); component.onMouseLeave('title');
expect(component.hoveredFields['title']).toBe(false); expect(component.hoveredFields['title']).toBe(false);
});
it('emits when navigating back', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
const goBackEmit = vi.spyOn(component.goBack, 'emit');
component.goBackClick(); component.goBackClick();
expect(goBackEmit).toHaveBeenCalledWith(true); expect(goBackEmit).toHaveBeenCalledWith(true);
});
it('reports audiobook provider values and dual-cover support', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
const book = createBook({}, {
isPhysical: true,
primaryFile: undefined,
alternativeFormats: [{id: 2, bookId: 21, bookType: 'AUDIOBOOK'}],
});
component.fetchedMetadata = createMetadata({provider: 'Comicvine'});
expect(component.isAudibleProvider()).toBe(false); expect(component.isAudibleProvider()).toBe(false);
component.fetchedMetadata = createMetadata({provider: 'Audible', narrator: 'Narrator', comicMetadata: {issueNumber: '7'}}); component.fetchedMetadata = createMetadata({provider: 'Audible', narrator: 'Narrator'});
expect(component.isAudibleProvider()).toBe(true); expect(component.isAudibleProvider()).toBe(true);
expect(component.getFetchedAudiobookValue('narrator')).toBe('Narrator');
expect(component.getFetchedComicValue('issueNumber')).toBe('7');
expect(component.hasEbookFormat(book)).toBe(true); expect(component.hasEbookFormat(book)).toBe(true);
expect(component.hasAudiobookFormat(book)).toBe(true); expect(component.hasAudiobookFormat(book)).toBe(true);
expect(component.supportsDualCovers(book)).toBe(true); expect(component.supportsDualCovers(book)).toBe(true);
});
it('reports fetched and current comic data and section visibility', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata({
provider: 'Comicvine',
comicMetadata: {issueNumber: '7'},
});
component.book = createBook();
expect(component.getFetchedComicValue('issueNumber')).toBe('7');
expect(component.hasAnyFetchedComicData()).toBe(true); expect(component.hasAnyFetchedComicData()).toBe(true);
expect(component.hasAnyCurrentComicData()).toBe(true); expect(component.hasAnyCurrentComicData()).toBe(true);
expect(component.shouldShowComicSection()).toBe(true); expect(component.shouldShowComicSection()).toBe(true);
@@ -1,4 +1,4 @@
import {Component, computed, DestroyRef, effect, EventEmitter, inject, Input, Output} from '@angular/core'; import {Component, computed, DestroyRef, effect, EventEmitter, inject, Input, Output, signal} from '@angular/core';
import {Book, BookMetadata, ComicMetadata, MetadataClearFlags, MetadataUpdateWrapper} from '../../../../book/model/book.model'; import {Book, BookMetadata, ComicMetadata, MetadataClearFlags, MetadataUpdateWrapper} from '../../../../book/model/book.model';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop';
@@ -18,7 +18,7 @@ import {Checkbox} from '@openng/optimus-ui/checkbox';
import {LazyLoadImageModule} from 'ng-lazyload-image'; import {LazyLoadImageModule} from 'ng-lazyload-image';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {MetadataProviderSpecificFields} from '../../../../../shared/model/app-settings.model'; import {MetadataProviderSpecificFields} from '../../../../../shared/model/app-settings.model';
import {ALL_COMIC_METADATA_FIELDS, ALL_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELDS, COMIC_ARRAY_METADATA_FIELDS, COMIC_FORM_TO_MODEL_LOCK, COMIC_TEXT_METADATA_FIELDS, COMIC_TEXTAREA_METADATA_FIELDS, getArrayFields, getBookDetailsFields, getBottomFields, getProviderFields, getSeriesFields, getTextareaFields, getTopFields, MetadataFieldConfig, MetadataFormBuilder, MetadataUtilsService} from '../../../../../shared/metadata'; import {ALL_COMIC_METADATA_FIELDS, allMetadataFields, AUDIOBOOK_METADATA_FIELDS, COMIC_ARRAY_METADATA_FIELDS, COMIC_FORM_TO_MODEL_LOCK, COMIC_TEXT_METADATA_FIELDS, COMIC_TEXTAREA_METADATA_FIELDS, getArrayFields, getBookDetailsFields, getProviderFields, getSeriesFields, getTextareaFields, getTopFields, MetadataFieldConfig, MetadataProviderFieldsService, MetadataFormBuilder, MetadataUtilsService} from '../../../../../shared/metadata';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
@Component({ @Component({
@@ -50,8 +50,6 @@ export class MetadataPickerComponent {
metadataDescription: MetadataFieldConfig[] = []; metadataDescription: MetadataFieldConfig[] = [];
metadataSeriesFields: MetadataFieldConfig[] = []; metadataSeriesFields: MetadataFieldConfig[] = [];
metadataBookDetailsFields: MetadataFieldConfig[] = []; metadataBookDetailsFields: MetadataFieldConfig[] = [];
metadataProviderFields: MetadataFieldConfig[] = [];
metadataFieldsBottom: MetadataFieldConfig[] = [];
audiobookMetadataFields: MetadataFieldConfig[] = []; audiobookMetadataFields: MetadataFieldConfig[] = [];
comicTextFields: MetadataFieldConfig[] = []; comicTextFields: MetadataFieldConfig[] = [];
comicArrayFields: MetadataFieldConfig[] = []; comicArrayFields: MetadataFieldConfig[] = [];
@@ -84,7 +82,6 @@ export class MetadataPickerComponent {
return this.currentBook; return this.currentBook;
} }
@Input() detailLoading = false;
@Output() goBack = new EventEmitter<boolean>(); @Output() goBack = new EventEmitter<boolean>();
currentBook: Book | null = null; currentBook: Book | null = null;
@@ -110,13 +107,16 @@ export class MetadataPickerComponent {
private formBuilder = inject(MetadataFormBuilder); private formBuilder = inject(MetadataFormBuilder);
private metadataUtils = inject(MetadataUtilsService); private metadataUtils = inject(MetadataUtilsService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
protected readonly providerFields = inject(MetadataProviderFieldsService);
private readonly uniqueMetadata = computed(() => this.bookService.uniqueMetadata()); private readonly uniqueMetadata = computed(() => this.bookService.uniqueMetadata());
private enabledProviderFields: MetadataProviderSpecificFields | null = null; private readonly enabledProviderFields = signal<MetadataProviderSpecificFields | null>(null);
private readonly allFields = computed(() => allMetadataFields(this.providerFields.fields()));
readonly metadataProviderFields = computed(() => getProviderFields(this.allFields(), this.enabledProviderFields()));
constructor() { constructor() {
this.metadataForm = this.formBuilder.buildForm(true); this.metadataForm = this.formBuilder.buildForm(true, this.allFields());
this.initFieldArrays(); this.initFieldArrays();
} }
@@ -126,22 +126,12 @@ export class MetadataPickerComponent {
this.metadataDescription = getTextareaFields(); this.metadataDescription = getTextareaFields();
this.metadataSeriesFields = getSeriesFields(); this.metadataSeriesFields = getSeriesFields();
this.metadataBookDetailsFields = getBookDetailsFields(); this.metadataBookDetailsFields = getBookDetailsFields();
this.updateProviderFields();
this.updateBottomFields();
this.audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS; this.audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS;
this.comicTextFields = COMIC_TEXT_METADATA_FIELDS; this.comicTextFields = COMIC_TEXT_METADATA_FIELDS;
this.comicArrayFields = COMIC_ARRAY_METADATA_FIELDS; this.comicArrayFields = COMIC_ARRAY_METADATA_FIELDS;
this.comicTextareaFields = COMIC_TEXTAREA_METADATA_FIELDS; this.comicTextareaFields = COMIC_TEXTAREA_METADATA_FIELDS;
} }
private updateProviderFields(): void {
this.metadataProviderFields = getProviderFields(this.enabledProviderFields);
}
private updateBottomFields(): void {
this.metadataFieldsBottom = getBottomFields(this.enabledProviderFields);
}
getFiltered(controlName: string): string[] { getFiltered(controlName: string): string[] {
return this.filteredItems[controlName] ?? []; return this.filteredItems[controlName] ?? [];
} }
@@ -155,9 +145,7 @@ export class MetadataPickerComponent {
private readonly syncProviderFieldsEffect = effect(() => { private readonly syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings(); const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) { if (settings?.metadataProviderSpecificFields) {
this.enabledProviderFields = settings.metadataProviderSpecificFields; this.enabledProviderFields.set(settings.metadataProviderSpecificFields);
this.updateProviderFields();
this.updateBottomFields();
} }
}); });
@@ -165,7 +153,7 @@ export class MetadataPickerComponent {
void book; void book;
const patchData: Record<string, unknown> = {}; const patchData: Record<string, unknown> = {};
for (const field of ALL_METADATA_FIELDS) { for (const field of this.allFields()) {
const key = field.controlName as keyof BookMetadata; const key = field.controlName as keyof BookMetadata;
const lockedKey = field.lockedKey as keyof BookMetadata; const lockedKey = field.lockedKey as keyof BookMetadata;
const value = metadata[key]; const value = metadata[key];
@@ -222,7 +210,7 @@ export class MetadataPickerComponent {
private applyLockStates(metadata: BookMetadata): void { private applyLockStates(metadata: BookMetadata): void {
const lockedFields: Record<string, boolean> = {}; const lockedFields: Record<string, boolean> = {};
for (const field of ALL_METADATA_FIELDS) { for (const field of this.allFields()) {
lockedFields[field.lockedKey] = !!metadata[field.lockedKey as keyof BookMetadata]; lockedFields[field.lockedKey] = !!metadata[field.lockedKey as keyof BookMetadata];
} }
// Also handle audiobook metadata lock states (now at top-level of BookMetadata) // Also handle audiobook metadata lock states (now at top-level of BookMetadata)
@@ -235,7 +223,7 @@ export class MetadataPickerComponent {
const modelLockKey = COMIC_FORM_TO_MODEL_LOCK[field.lockedKey]; const modelLockKey = COMIC_FORM_TO_MODEL_LOCK[field.lockedKey];
lockedFields[field.lockedKey] = !!comicMeta?.[modelLockKey as keyof ComicMetadata]; lockedFields[field.lockedKey] = !!comicMeta?.[modelLockKey as keyof ComicMetadata];
} }
this.formBuilder.applyLockStates(this.metadataForm, lockedFields); this.formBuilder.applyLockStates(this.metadataForm, lockedFields, this.allFields());
} }
onAutoCompleteSelect(fieldName: string, event: AutoCompleteSelectEvent) { onAutoCompleteSelect(fieldName: string, event: AutoCompleteSelectEvent) {
@@ -349,7 +337,7 @@ export class MetadataPickerComponent {
private buildMetadataFromForm(): BookMetadata { private buildMetadataFromForm(): BookMetadata {
const metadata: Record<string, unknown> = {bookId: this.currentBookId}; const metadata: Record<string, unknown> = {bookId: this.currentBookId};
for (const field of ALL_METADATA_FIELDS) { for (const field of this.allFields()) {
if (field.type === 'array') { if (field.type === 'array') {
metadata[field.controlName] = this.getArrayValue(field.controlName); metadata[field.controlName] = this.getArrayValue(field.controlName);
} else if (field.type === 'number') { } else if (field.type === 'number') {
@@ -460,7 +448,7 @@ export class MetadataPickerComponent {
private inferClearFlags(current: BookMetadata, original: BookMetadata): MetadataClearFlags { private inferClearFlags(current: BookMetadata, original: BookMetadata): MetadataClearFlags {
const flags: Record<string, boolean> = {}; const flags: Record<string, boolean> = {};
for (const field of ALL_METADATA_FIELDS) { for (const field of this.allFields()) {
const key = field.controlName as keyof BookMetadata; const key = field.controlName as keyof BookMetadata;
const curr = current[key]; const curr = current[key];
const orig = original[key]; const orig = original[key];
@@ -3,7 +3,6 @@
<app-metadata-picker <app-metadata-picker
[fetchedMetadata]="selectedMetadata" [fetchedMetadata]="selectedMetadata"
[book]="book()" [book]="book()"
[detailLoading]="detailLoading()"
(goBack)="onGoBack()"> (goBack)="onGoBack()">
</app-metadata-picker> </app-metadata-picker>
</div> </div>
@@ -20,8 +19,10 @@
inputId="metadata-search-providers" inputId="metadata-search-providers"
[filter]="false" [filter]="false"
showToggleAll="false" showToggleAll="false"
[options]="providers()" [options]="providerOptions()"
formControlName="provider" optionLabel="label"
optionValue="id"
formControlName="providers"
[placeholder]="t('selectProviders')" [placeholder]="t('selectProviders')"
class="'custom-multiselect'"> class="'custom-multiselect'">
</p-multiselect> </p-multiselect>
@@ -84,7 +85,7 @@
</div> </div>
</form> </form>
@if (loading() || searchTriggered()) { @if (hasSearched()) {
<div class="provider-status"> <div class="provider-status">
<div class="status-header"> <div class="status-header">
<div class="results-info"> <div class="results-info">
@@ -104,19 +105,20 @@
<div class="provider-pills"> <div class="provider-pills">
@for (tab of providerTabs(); track tab.provider) { @for (tab of providerTabs(); track tab.provider) {
<div class="provider-pill" <div class="provider-pill"
[class]="'provider-' + providerClass(tab.provider)"
[class.has-results]="tab.count > 0" [class.has-results]="tab.count > 0"
[class.active]="isProviderPillActive(tab.provider)" [class.active]="isProviderPillActive(tab.provider)"
[class]="'provider-pill provider-' + tab.provider.toLowerCase() + (tab.count > 0 ? ' has-results' : '') + (isProviderPillActive(tab.provider) ? ' active' : '')"
[attr.role]="tab.count > 0 ? 'button' : null" [attr.role]="tab.count > 0 ? 'button' : null"
[attr.tabindex]="tab.count > 0 ? '0' : null" [attr.tabindex]="tab.count > 0 ? '0' : null"
(click)="tab.count > 0 && onProviderPillClick(tab.provider, $event)" (click)="tab.count > 0 && onProviderPillClick(tab.provider, $event)"
(keydown.enter)="tab.count > 0 && onProviderPillClick(tab.provider, $event)" (keydown.enter)="tab.count > 0 && onProviderPillClick(tab.provider, $event)">
[style.cursor]="tab.count > 0 ? 'pointer' : 'default'">
<div class="pill-icon"> <div class="pill-icon">
<i class="pi pi-database"></i> <i class="pi pi-database"></i>
</div> </div>
<div class="pill-content"> <div class="pill-content">
<span class="pill-name">{{ tab.provider }}</span> <span class="pill-name">
{{ providerLabelKey(tab.provider) | transloco }}
</span>
@if (loading() && tab.count === 0) { @if (loading() && tab.count === 0) {
<i class="pi pi-spin pi-spinner pill-spinner"></i> <i class="pi pi-spin pi-spinner pill-spinner"></i>
} @else { } @else {
@@ -129,23 +131,31 @@
</div> </div>
} }
@if (!searchTriggered() && results().length === 0) { @if (!hasSearched()) {
<div class="empty-state"> <div class="empty-state">
<div class="empty-icon"> <div class="empty-icon">
<i class="pi pi-search"></i> <i class="pi pi-search"></i>
</div> </div>
<h3>{{ t('readyToSearch') }}</h3> @if (noProviders()) {
<p>{{ t('readyToSearchHint') }}</p> <h3>{{ t('noProviders') }}</h3>
} @else {
<h3>{{ t('readyToSearch') }}</h3>
<p>{{ t('readyToSearchHint') }}</p>
}
</div> </div>
} }
@if (searchTriggered() && results().length === 0 && !loading()) { @if (hasSearched() && !loading() && (results().length === 0 || failed())) {
<div class="empty-state"> <div class="empty-state">
<div class="empty-icon no-results"> <div class="empty-icon no-results">
<i class="pi pi-inbox"></i> <i class="pi pi-inbox"></i>
</div> </div>
<h3>{{ t('noResultsFound') }}</h3> @if (failed()) {
<p>{{ t('noResultsHint') }}</p> <h3>{{ t('searchFailed') }}</h3>
} @else {
<h3>{{ t('noResultsFound') }}</h3>
<p>{{ t('noResultsHint') }}</p>
}
</div> </div>
} }
@@ -164,7 +174,7 @@
class="book-cover" class="book-cover"
[src]="metadata.thumbnailUrl" [src]="metadata.thumbnailUrl"
[title]="metadata.title" [title]="metadata.title"
[authors]="metadata.authors ?? []" [authors]="metadata.authors"
[alt]="metadata.title ?? ''"/> [alt]="metadata.title ?? ''"/>
<div class="card-overlay"> <div class="card-overlay">
<i class="pi pi-eye"></i> <i class="pi pi-eye"></i>
@@ -174,32 +184,20 @@
<div class="card-content"> <div class="card-content">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">{{ truncateText(metadata.title!, 60) }}</h4> <h4 class="card-title">{{ truncateText(metadata.title, 60) }}</h4>
<div <div class="card-provider" [class]="'provider-' + providerClass(metadata.provider)">
class="card-provider" @let providerLabel = providerLabelKey(metadata.provider) | transloco;
[class]="'card-provider provider-' + providerClass(metadata)" @if (metadata.externalUrl; as href) {
role="button" <a [href]="href" target="_blank" rel="noopener" (click)="$event.stopPropagation()">
tabindex="0" {{ providerLabel }}
(click)="onProviderClick($event)"
(keydown.enter)="onProviderClick($event)"
>
@if (providerHref(metadata); as href) {
<a [href]="href" target="_blank" rel="noopener">
@if (providerName(metadata); as name) {
{{ name }}
} @else {
{{ t('unknownProvider') }}
}
</a> </a>
} @else if (providerName(metadata); as name) {
{{ name }}
} @else { } @else {
{{ t('unknownProvider') }} {{ providerLabel }}
} }
</div> </div>
</div> </div>
@if (metadata.authors && metadata.authors.length > 0) { @if (metadata.authors?.length) {
<p class="card-authors"> <p class="card-authors">
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
{{ truncateText(metadata.authors.join(', '), 50) }} {{ truncateText(metadata.authors.join(', '), 50) }}
@@ -1,24 +1,23 @@
import {Component, input, output, provideZonelessChangeDetection, signal} from '@angular/core'; import {MetadataCatalogService} from '../../../../../shared/metadata/metadata-catalog.service';
import {METADATA_PROVIDER_LIST, type MetadataProviderId} from '../../../../../shared/metadata/metadata-providers';
import {Component, computed, input, output, provideZonelessChangeDetection, signal} from '@angular/core';
import {ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {Subject} from 'rxjs'; import {experimental_streamedQuery, provideTanStackQuery, queryOptions, QueryClient} from '@tanstack/angular-query-experimental';
import {beforeEach, describe, expect, it, vi} from 'vitest'; import {beforeEach, describe, expect, it, vi} from 'vitest';
import {Book, BookMetadata} from '../../../../book/model/book.model'; import {getTranslocoModule} from '../../../../../core/testing/transloco-testing';
import {BookMetadataService} from '../../../../book/service/book-metadata.service';
import {AppSettings} from '../../../../../shared/model/app-settings.model'; import {AppSettings} from '../../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {CoverComponent} from '../../../../../shared/components/cover/cover.component'; import {CoverComponent} from '../../../../../shared/components/cover/cover.component';
import {getTranslocoModule} from '../../../../../core/testing/transloco-testing'; import {Book, BookMetadata} from '../../../../book/model/book.model';
import {MetadataSourceQueryService, type MetadataSearchParams, type MetadataSearchResult} from '../../../sources/metadata-source-query.service';
import {MetadataPickerComponent} from '../metadata-picker/metadata-picker.component'; import {MetadataPickerComponent} from '../metadata-picker/metadata-picker.component';
import {MetadataSearcherComponent} from './metadata-searcher.component'; import {MetadataSearcherComponent} from './metadata-searcher.component';
import {MetadataProviderService} from '../../../service/metadata-provider.service';
import {MetadataProvider} from '../../../model/metadata-provider.model';
@Component({selector: 'app-metadata-picker', template: '', standalone: true}) @Component({selector: 'app-metadata-picker', template: '', standalone: true})
class PickerStub { class PickerStub {
readonly fetchedMetadata = input<BookMetadata>(); readonly fetchedMetadata = input<BookMetadata>();
readonly book = input<Book | null>(); readonly book = input<Book | null>();
readonly detailLoading = input(false);
readonly goBack = output<boolean>(); readonly goBack = output<boolean>();
} }
@@ -31,55 +30,73 @@ class CoverStub {
} }
describe('MetadataSearcherComponent', () => { describe('MetadataSearcherComponent', () => {
const providers = signal(METADATA_PROVIDER_LIST);
const providersLoading = signal(false);
let fixture: ComponentFixture<MetadataSearcherComponent>; let fixture: ComponentFixture<MetadataSearcherComponent>;
let component: MetadataSearcherComponent; let component: MetadataSearcherComponent;
let search$: Subject<BookMetadata>; let results: MetadataSearchResult[];
let detail$: Subject<BookMetadata>; let streamError: Error | null;
let providers$: Subject<MetadataProvider[]>; let queryResult: Promise<MetadataSearchResult[]>;
let queryClient: QueryClient;
const appSettings = signal<Pick<AppSettings, 'autoBookSearch' | 'metadataProviderSettings'> | null>(null);
const prospective = vi.fn((params: MetadataSearchParams) => queryOptions({
queryKey: ['prospective', params],
queryFn: experimental_streamedQuery({
streamFn: async function* () {
yield* await queryResult;
if (streamError) throw streamError;
},
}),
retry: false,
}));
const appSettings = signal<AppSettings | null>(null); const settings = (autoBookSearch = false): Pick<AppSettings, 'autoBookSearch' | 'metadataProviderSettings'> => ({
const fetchBookMetadata = vi.fn(); autoBookSearch,
const fetchMetadataDetail = vi.fn();
const fetchMetadataProviders = vi.fn();
const settings = (): AppSettings => ({
autoBookSearch: false,
metadataProviderSettings: { metadataProviderSettings: {
openLibrary: {enabled: true}, openLibrary: {enabled: true},
amazon: {enabled: false, cookie: '', domain: 'com'},
google: {enabled: false, language: '', apiKey: ''},
goodReads: {enabled: true}, goodReads: {enabled: true},
ranobedb: {enabled: false, preferRomaji: false},
hardcover: {enabled: false, apiKey: ''},
comicvine: {enabled: false, apiKey: ''},
douban: {enabled: false},
lubimyczytac: {enabled: false},
audible: {enabled: false, domain: 'com'},
appleBooks: {enabled: false, country: ''},
}, },
} as unknown as AppSettings); });
const book = (): Book => ({ const book = (id = 1) => ({
id: 1, id,
libraryId: 1, libraryId: 1,
metadata: {bookId: 1, title: 'Dune', authors: ['Frank Herbert'], isbn13: '9780441013593'}, metadata: {bookId: id, title: 'Dune', authors: ['Frank Herbert'], isbn13: '9780441013593'},
} as Book);
const openLibraryResult = (): BookMetadata => ({
bookId: 1,
provider: 'OpenLibrary',
title: 'Dune',
openlibraryId: '/books/OL30014174M',
goodreadsId: '53403754',
}); });
beforeEach(async () => { beforeEach(async () => {
search$ = new Subject<BookMetadata>(); providers.set(METADATA_PROVIDER_LIST);
detail$ = new Subject<BookMetadata>(); providersLoading.set(false);
providers$ = new Subject<MetadataProvider[]>(); results = [];
streamError = null;
queryResult = Promise.resolve(results);
prospective.mockClear();
appSettings.set(null); appSettings.set(null);
fetchBookMetadata.mockReset().mockReturnValue(search$.asObservable());
fetchMetadataDetail.mockReset().mockReturnValue(detail$.asObservable());
fetchMetadataProviders.mockReset().mockReturnValue(providers$.asObservable());
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [MetadataSearcherComponent, getTranslocoModule()], imports: [MetadataSearcherComponent, getTranslocoModule()],
providers: [ providers: [
provideZonelessChangeDetection(), provideZonelessChangeDetection(),
provideTanStackQuery(queryClient = new QueryClient()),
{provide: AppSettingsService, useValue: {appSettings}}, {provide: AppSettingsService, useValue: {appSettings}},
{provide: BookMetadataService, useValue: {fetchBookMetadata, fetchMetadataDetail}}, {provide: MetadataSourceQueryService, useValue: {
{provide: MetadataProviderService, useValue: {fetchMetadataProviders, fetchMetadataDetail}}, prospective,
providersLoading: providersLoading.asReadonly(),
enabledProviders: computed(() => providers().filter(provider => appSettings()?.metadataProviderSettings[provider.settingsKey]?.enabled)),
}},
{provide: MetadataCatalogService, useValue: {
providers: providers.asReadonly(),
provider: (id: MetadataProviderId) => providers().find(provider => provider.id === id),
}},
], ],
}) })
.overrideComponent(MetadataSearcherComponent, { .overrideComponent(MetadataSearcherComponent, {
@@ -92,27 +109,41 @@ describe('MetadataSearcherComponent', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
}); });
function setUp(isActiveTab = false): void { function setUp(isActiveTab = false, autoBookSearch = false, id = 1): void {
appSettings.set(settings()); appSettings.set(settings(autoBookSearch));
fixture.componentRef.setInput('book', book()); fixture.componentRef.setInput('book', book(id));
fixture.componentRef.setInput('isActiveTab', isActiveTab); fixture.componentRef.setInput('isActiveTab', isActiveTab);
fixture.detectChanges(); fixture.detectChanges();
} }
it('keeps an OpenLibrary result even when it carries a Goodreads ID', () => { function latestQuery() {
setUp(); const query = prospective.mock.results.at(-1);
const result = openLibraryResult(); if (!query || query.type !== 'return') throw new Error('Expected a prospective query');
return query.value;
}
async function submit(): Promise<void> {
component.onSubmit(); component.onSubmit();
search$.next(result); TestBed.flushEffects();
await queryClient.fetchQuery(latestQuery()).catch(() => undefined);
await fixture.whenStable();
await new Promise(resolve => setTimeout(resolve, 0));
TestBed.flushEffects();
fixture.detectChanges();
}
component.onBookClick(result); it('keeps the selected result provider', async () => {
results = [{bookId: 1, provider: 'OpenLibrary', title: 'Dune'}];
queryResult = Promise.resolve(results);
setUp();
expect(fetchMetadataDetail).not.toHaveBeenCalled(); await submit();
expect(component.selected()).toBe(result); component.onBookClick(component.results()[0]);
expect(component.detailLoading()).toBe(false);
expect(component.selected()?.provider).toBe('OpenLibrary');
}); });
it('keeps user-edited search terms when the tab is switched away and back', () => { it('keeps typed terms through a tab switch', () => {
setUp(true); setUp(true);
component.form.patchValue({title: 'Dune Messiah', isbn: ''}); component.form.patchValue({title: 'Dune Messiah', isbn: ''});
@@ -121,7 +152,7 @@ describe('MetadataSearcherComponent', () => {
fixture.componentRef.setInput('isActiveTab', true); fixture.componentRef.setInput('isActiveTab', true);
fixture.detectChanges(); fixture.detectChanges();
expect(component.form.value.title).toBe('Dune Messiah'); expect(component.form.value).toMatchObject({title: 'Dune Messiah', isbn: ''});
expect(component.form.value.isbn).toBe('');
}); });
}); });
@@ -1,57 +1,26 @@
import {Component, computed, effect, inject, input, OnDestroy, signal} from '@angular/core'; import {Component, computed, effect, inject, input, linkedSignal, signal} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop'; import {toSignal} from '@angular/core/rxjs-interop';
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormBuilder, ReactiveFormsModule} from '@angular/forms';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {InputText} from '@openng/optimus-ui/inputtext'; import {InputText} from '@openng/optimus-ui/inputtext';
import {MultiSelect} from '@openng/optimus-ui/multiselect'; import {MultiSelect} from '@openng/optimus-ui/multiselect';
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {TranslocoDirective} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
import {catchError, Subject, takeUntil} from 'rxjs'; import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {FetchMetadataRequest} from '../../../model/request/fetch-metadata-request.model'; import {Book} from '../../../../book/model/book.model';
import {Book, BookMetadata} from '../../../../book/model/book.model';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {BookMetadataService} from '../../../../book/service/book-metadata.service';
import {MetadataPickerComponent} from '../metadata-picker/metadata-picker.component'; import {MetadataPickerComponent} from '../metadata-picker/metadata-picker.component';
import {CoverComponent} from '../../../../../shared/components/cover/cover.component'; import {CoverComponent} from '../../../../../shared/components/cover/cover.component';
import {MetadataProviderService} from '../../../service/metadata-provider.service'; import {MetadataCatalogService} from '../../../../../shared/metadata/metadata-catalog.service';
import {map} from 'rxjs/operators'; import type {MetadataProviderId} from '../../../../../shared/metadata/metadata-providers';
import {
MetadataSourceQueryService,
type MetadataSearchParams,
type MetadataSearchResult,
} from '../../../sources/metadata-source-query.service';
const DETAIL_ID_FIELD: Record<string, keyof BookMetadata> = { const NO_SEARCH: MetadataSearchParams = {bookId: 0, providers: []};
GoodReads: 'goodreadsId',
Amazon: 'asin',
Audible: 'audibleId',
Comicvine: 'comicvineId',
};
function providerKey(result: BookMetadata): string {
return result.provider?.toLowerCase() ?? 'unknown';
}
function capitalize(value: string): string {
return value.charAt(0).toUpperCase() + value.slice(1);
}
function needsDetail(result: BookMetadata): boolean {
if (result.provider === 'Comicvine') {
const comic = result.comicMetadata;
return !comic || !(
comic.pencillers?.length || comic.inkers?.length || comic.colorists?.length ||
comic.letterers?.length || comic.editors?.length || comic.characters?.length
);
}
return !result.description;
}
export function detailRequestFor(result: BookMetadata): { provider: string; id: string } | null {
const provider = result.provider;
const idField = provider ? DETAIL_ID_FIELD[provider] : undefined;
const id = idField ? result[idField] : undefined;
if (!provider || typeof id !== 'string' || !id || !needsDetail(result)) {
return null;
}
return {provider, id};
}
@Component({ @Component({
selector: 'app-metadata-searcher', selector: 'app-metadata-searcher',
@@ -59,70 +28,81 @@ export function detailRequestFor(result: BookMetadata): { provider: string; id:
styleUrls: ['./metadata-searcher.component.scss'], styleUrls: ['./metadata-searcher.component.scss'],
imports: [ imports: [
ReactiveFormsModule, ReactiveFormsModule,
FormsModule,
Button, Button,
InputText, InputText,
MetadataPickerComponent, MetadataPickerComponent,
MultiSelect, MultiSelect,
Tooltip, Tooltip,
TranslocoDirective, TranslocoDirective,
TranslocoPipe,
CoverComponent CoverComponent
], ],
standalone: true standalone: true
}) })
export class MetadataSearcherComponent implements OnDestroy { export class MetadataSearcherComponent {
readonly book = input<Book | null>(null); readonly book = input<Book | null>(null);
readonly isActiveTab = input(false); readonly isActiveTab = input(false);
private readonly formBuilder = inject(FormBuilder); private readonly formBuilder = inject(FormBuilder);
private readonly bookMetadataService = inject(BookMetadataService);
private readonly appSettingsService = inject(AppSettingsService); private readonly appSettingsService = inject(AppSettingsService);
private readonly metadataProviderService = inject(MetadataProviderService); private readonly sources = inject(MetadataSourceQueryService);
private readonly catalog = inject(MetadataCatalogService);
private readonly queryClient = inject(QueryClient);
private readonly t = inject(TranslocoService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
private readonly search = signal<MetadataSearchParams | null>(null);
private resetForBookId: number | null = null;
private readonly autoSearchPending = linkedSignal<number | undefined, boolean>({
source: () => this.book()?.id,
computation: bookId => bookId !== undefined
&& !!this.appSettingsService.appSettings()?.autoBookSearch,
});
private providersInitialised = false;
private readonly query = injectQuery(() => ({
...this.sources.prospective(this.search() ?? NO_SEARCH),
enabled: this.search() !== null,
}));
readonly form: FormGroup = this.formBuilder.group({ readonly form = this.formBuilder.group({
provider: null, providers: this.formBuilder.control<MetadataProviderId[] | null>(null),
title: [''], title: this.formBuilder.nonNullable.control(''),
author: [''], author: this.formBuilder.nonNullable.control(''),
isbn: [''] isbn: this.formBuilder.nonNullable.control('')
}); });
readonly results = signal<BookMetadata[]>([]); readonly results = computed(() => this.query.data() ?? []);
readonly searchedProviders = signal<string[]>([]); readonly loading = this.query.isFetching;
readonly loading = signal(false); readonly failed = computed(() => this.query.isError());
readonly searchTriggered = signal(false); readonly hasSearched = computed(() => this.search() !== null);
readonly selectedFilters = signal<Set<string>>(new Set(['all'])); readonly selectedFilters = signal<Set<MetadataProviderId | 'all'>>(new Set(['all']));
readonly selected = signal<BookMetadata | null>(null); readonly selected = signal<MetadataSearchResult | null>(null);
readonly detailLoading = signal(false);
readonly providers = toSignal( readonly providers = computed(() => this.sources.enabledProviders().map(provider => provider.id));
this.metadataProviderService.fetchMetadataProviders() readonly noProviders = computed(() => !this.sources.providersLoading() && this.providers().length === 0);
.pipe(map(
providers => providers.filter(p => p.enabled).map(p => capitalize(p.name)) readonly providerOptions = computed(() => this.sources.enabledProviders().map(provider => ({
)) id: provider.id,
.pipe(catchError(() => [])) label: this.t.translate(provider.labelKey, {}, this.activeLang()),
); })));
readonly resultsByProvider = computed(() => { readonly resultsByProvider = computed(() => {
const groups = new Map<string, BookMetadata[]>(); const groups = new Map<MetadataProviderId, MetadataSearchResult[]>();
this.searchedProviders().forEach(provider => groups.set(provider.toLowerCase(), [])); this.search()?.providers.forEach(provider => groups.set(provider, []));
for (const result of this.results()) { for (const result of this.results()) {
const key = providerKey(result); groups.get(result.provider)?.push(result);
groups.set(key, [...(groups.get(key) ?? []), result]);
} }
return groups; return groups;
}); });
readonly providerTabs = computed(() => readonly providerTabs = computed(() => Array.from(
this.searchedProviders().map(provider => ({ this.resultsByProvider(),
provider, ([provider, results]) => ({provider, count: results.length})
count: this.resultsByProvider().get(provider.toLowerCase())?.length ?? 0 ));
}))
);
readonly interleavedResults = computed(() => { private readonly interleavedResults = computed(() => {
const lists = Array.from(this.resultsByProvider().values()); const lists = Array.from(this.resultsByProvider().values());
const maxLength = Math.max(0, ...lists.map(list => list.length)); const maxLength = Math.max(0, ...lists.map(list => list.length));
const interleaved: BookMetadata[] = []; const interleaved: MetadataSearchResult[] = [];
for (let i = 0; i < maxLength; i++) { for (let i = 0; i < maxLength; i++) {
for (const list of lists) { for (const list of lists) {
if (i < list.length) interleaved.push(list[i]); if (i < list.length) interleaved.push(list[i]);
@@ -134,19 +114,14 @@ export class MetadataSearcherComponent implements OnDestroy {
readonly filteredResults = computed(() => { readonly filteredResults = computed(() => {
const filters = this.selectedFilters(); const filters = this.selectedFilters();
const all = this.interleavedResults(); const all = this.interleavedResults();
return filters.has('all') ? all : all.filter(result => filters.has(providerKey(result))); return filters.has('all') ? all : all.filter(result => filters.has(result.provider));
}); });
private bookId: number | null = null;
private readonly autoSearchPending = signal(false);
private providersInitialised = false;
private readonly cancel$ = new Subject<void>();
constructor() { constructor() {
effect(() => { effect(() => {
if (!this.appSettingsService.appSettings() || this.sources.providersLoading()) return;
const providers = this.providers(); const providers = this.providers();
if (!this.appSettingsService.appSettings() || !providers) return; const control = this.form.controls.providers;
const control = this.form.get('provider')!;
if (!this.providersInitialised) { if (!this.providersInitialised) {
this.providersInitialised = true; this.providersInitialised = true;
@@ -154,7 +129,7 @@ export class MetadataSearcherComponent implements OnDestroy {
return; return;
} }
const current: string[] = control.value ?? []; const current = control.value ?? [];
const valid = current.filter(provider => providers.includes(provider)); const valid = current.filter(provider => providers.includes(provider));
if (valid.length !== current.length) { if (valid.length !== current.length) {
control.setValue(valid.length > 0 ? valid : null); control.setValue(valid.length > 0 ? valid : null);
@@ -169,173 +144,107 @@ export class MetadataSearcherComponent implements OnDestroy {
} }
const settings = this.appSettingsService.appSettings(); const settings = this.appSettingsService.appSettings();
const providers = this.providers(); if (!settings || book.id === this.resetForBookId) return;
if (!settings || !providers || book.id === this.bookId) return;
this.bookId = book.id; this.resetForBookId = book.id;
this.resetForBook(book); this.resetForBook(book);
if (providers.length > 0) {
this.autoSearchPending.set(!!settings.autoBookSearch);
}
}); });
effect(() => { effect(() => {
if (this.autoSearchPending() && this.isActiveTab()) { if (this.autoSearchPending() && this.isActiveTab() && !this.sources.providersLoading()) {
this.autoSearchPending.set(false); this.autoSearchPending.set(false);
this.onSubmit(); this.onSubmit();
} }
}); });
} }
ngOnDestroy(): void {
this.cancel$.next();
this.cancel$.complete();
}
get isSearchEnabled(): boolean { get isSearchEnabled(): boolean {
const providerSelected = !!this.form.get('provider')?.value; const providerSelected = !!this.form.controls.providers.value?.length;
const title = this.form.get('title')?.value; const title = this.form.controls.title.value;
const isbn = this.form.get('isbn')?.value; const isbn = this.form.controls.isbn.value;
return providerSelected && (title || isbn); return providerSelected && (title.length > 0 || isbn.length > 0);
} }
onSubmit(): void { onSubmit(): void {
this.searchTriggered.set(true); const selectedProviders = this.form.controls.providers.value;
const selectedProviders: string[] | null = this.form.get('provider')?.value; const bookId = this.book()?.id;
if (!selectedProviders?.length || this.bookId === null) return; if (!selectedProviders?.length || bookId === undefined) return;
const request: FetchMetadataRequest = { const params: MetadataSearchParams = {
bookId: this.bookId, bookId,
providers: selectedProviders, providers: selectedProviders,
title: this.form.get('title')?.value, title: this.form.controls.title.value,
author: this.form.get('author')?.value, author: this.form.controls.author.value,
isbn: this.form.get('isbn')?.value isbn: this.form.controls.isbn.value
}; };
this.cancel$.next();
this.results.set([]);
this.searchedProviders.set(selectedProviders);
this.selectedFilters.set(new Set(['all'])); this.selectedFilters.set(new Set(['all']));
this.loading.set(true);
this.bookMetadataService.fetchBookMetadata(request.bookId, request) void this.queryClient.resetQueries({queryKey: this.sources.prospective(params).queryKey, exact: true});
.pipe(takeUntil(this.cancel$)) this.search.set(params);
.subscribe({
next: result => this.results.update(all => [...all, result]),
error: error => {
console.error('Error fetching metadata:', error);
this.loading.set(false);
},
complete: () => this.loading.set(false)
});
} }
onBookClick(result: BookMetadata): void { onBookClick(result: MetadataSearchResult): void {
this.selected.set(result); this.selected.set(result);
const detail = detailRequestFor(result);
this.detailLoading.set(!!detail);
if (!detail) return;
this.bookMetadataService.fetchMetadataDetail(detail.provider, detail.id)
.pipe(takeUntil(this.cancel$))
.subscribe({
next: enriched => {
if (this.selected() !== result) return;
this.selected.set(enriched);
this.detailLoading.set(false);
},
error: error => {
console.error('Error fetching detailed metadata:', error);
if (this.selected() === result) this.detailLoading.set(false);
}
});
} }
onGoBack(): void { onGoBack(): void {
this.detailLoading.set(false);
this.selected.set(null); this.selected.set(null);
} }
onProviderPillClick(provider: string, event: Event): void { onProviderPillClick(provider: MetadataProviderId, event: Event): void {
const key = provider.toLowerCase();
const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey); const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey);
this.selectedFilters.update(filters => { this.selectedFilters.update(filters => {
const next = new Set(filters); const next = new Set(filters);
if (isModifierClick) { if (isModifierClick) {
if (next.has(key)) { if (next.has(provider)) {
next.delete(key); next.delete(provider);
} else { } else {
next.add(key); next.add(provider);
next.delete('all'); next.delete('all');
} }
if (next.size === 0) next.add('all'); if (next.size === 0) next.add('all');
} else if (next.has(key) && next.size === 1) { } else if (next.has(provider) && next.size === 1) {
next.clear(); next.clear();
next.add('all'); next.add('all');
} else { } else {
next.clear(); next.clear();
next.add(key); next.add(provider);
} }
return next; return next;
}); });
} }
isProviderPillActive(provider: string): boolean { isProviderPillActive(provider: MetadataProviderId): boolean {
return this.selectedFilters().has(provider.toLowerCase()); return this.selectedFilters().has(provider);
} }
providerClass(result: BookMetadata): string { providerClass(id: MetadataProviderId): string {
return providerKey(result); return id.toLowerCase();
} }
providerName(result: BookMetadata): string | null { providerLabelKey(id: MetadataProviderId): string {
return result.provider ?? null; return this.catalog.provider(id)?.labelKey ?? id;
} }
providerHref(result: BookMetadata): string | null { sanitizeHtml(htmlString: string): string {
if (!result.externalUrl) {
return null;
}
return result.externalUrl;
}
onProviderClick(event: Event): void {
const target = event.target as HTMLElement;
if (target.tagName === 'A' || target.closest('a')) {
event.stopPropagation();
}
}
sanitizeHtml(htmlString: string | null | undefined): string {
if (!htmlString) return '';
return htmlString.replace(/<\/?[^>]+(>|$)/g, '').trim(); return htmlString.replace(/<\/?[^>]+(>|$)/g, '').trim();
} }
truncateText(text: string | null, length: number): string { truncateText(text: string | undefined, length: number): string {
const safeText = text ?? ''; const safeText = text ?? '';
return safeText.length > length ? safeText.substring(0, length) + '...' : safeText; return safeText.length > length ? safeText.substring(0, length) + '...' : safeText;
} }
private isEnabledProviderSetting(value: unknown): value is { enabled: boolean } {
return !!value && typeof value === 'object' && 'enabled' in value && typeof value.enabled == 'boolean';
}
private resetSearchState(): void { private resetSearchState(): void {
this.cancel$.next(); this.search.set(null);
this.loading.set(false);
this.detailLoading.set(false);
this.searchTriggered.set(false);
this.selected.set(null); this.selected.set(null);
this.results.set([]);
this.searchedProviders.set([]);
this.selectedFilters.set(new Set(['all'])); this.selectedFilters.set(new Set(['all']));
} }
private clearForNoBook(): void { private clearForNoBook(): void {
this.bookId = null; this.resetForBookId = null;
this.autoSearchPending.set(false); this.autoSearchPending.set(false);
this.resetSearchState(); this.resetSearchState();
this.form.patchValue({title: '', author: '', isbn: ''}); this.form.patchValue({title: '', author: '', isbn: ''});
@@ -343,10 +252,6 @@ export class MetadataSearcherComponent implements OnDestroy {
private resetForBook(book: Book): void { private resetForBook(book: Book): void {
this.resetSearchState(); this.resetSearchState();
this.patchFormFromBook(book);
}
private patchFormFromBook(book: Book): void {
this.form.patchValue({ this.form.patchValue({
title: book.metadata?.title ?? '', title: book.metadata?.title ?? '',
author: book.metadata?.authors?.[0] ?? '', author: book.metadata?.authors?.[0] ?? '',
@@ -184,127 +184,20 @@
</p-button> </p-button>
</div> </div>
@if (book?.metadata?.amazonRating || book?.metadata?.asin || book?.metadata?.goodreadsRating || book?.metadata?.goodreadsId || book?.metadata?.hardcoverRating || book?.metadata?.hardcoverId || book?.metadata?.lubimyczytacRating || book?.metadata?.lubimyczytacId || book?.metadata?.ranobedbRating || book?.metadata?.ranobedbId || book?.metadata?.audibleRating || book?.metadata?.audibleId || book?.metadata?.googleId) { @if (providerBadges().length > 0) {
<div class="gradient-divider"></div> <div class="gradient-divider"></div>
} }
<div class="external-ratings"> <div class="external-ratings">
@if (book?.metadata?.amazonRating || book?.metadata?.asin) { @for (provider of providerBadges(); track provider.id) {
<a <span
class="rating-link" class="rating-badge"
[href]="'https://www.amazon.com/dp/' + (book.metadata?.asin ?? '')" [pTooltip]="provider.tooltip"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.amazonRating ? getRatingTooltip(book, 'amazon') : undefined"
tooltipPosition="top" tooltipPosition="top"
> >
<img src="https://www.amazon.com/favicon.ico" alt="Amazon" class="rating-favicon"/> <span class="rating-provider">{{ provider.labelKey | transloco }}</span>
@if (book?.metadata?.amazonRating) { <span class="rating-value">{{ getRatingPercent(provider.rating) }}%</span>
<span class="rating-value">{{ getRatingPercent(book.metadata!.amazonRating) }}%</span> </span>
}
</a>
}
@if (book?.metadata?.goodreadsRating || book?.metadata?.goodreadsId) {
<a
class="rating-link"
[href]="'https://www.goodreads.com/book/show/' + (book.metadata?.goodreadsId ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.goodreadsRating ? getRatingTooltip(book, 'goodreads') : undefined"
tooltipPosition="top"
>
<img src="https://www.goodreads.com/favicon.ico" alt="Goodreads" class="rating-favicon"/>
@if (book?.metadata?.goodreadsRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.goodreadsRating) }}%</span>
}
</a>
}
@if (book?.metadata?.hardcoverRating || book?.metadata?.hardcoverId) {
<a
class="rating-link"
[href]="'https://hardcover.app/books/' + (book.metadata?.hardcoverId ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.hardcoverRating ? getRatingTooltip(book, 'hardcover') : undefined"
tooltipPosition="top"
>
<img src="https://assets.hardcover.app/static/favicon.ico" alt="Hardcover" class="rating-favicon"/>
@if (book?.metadata?.hardcoverRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.hardcoverRating) }}%</span>
}
</a>
}
@if (book?.metadata?.lubimyczytacRating || book?.metadata?.lubimyczytacId) {
<a
class="rating-link"
[href]="book.metadata?.lubimyczytacId ? 'https://lubimyczytac.pl/ksiazka/' + book.metadata?.lubimyczytacId + '/ksiazka' : ''"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.lubimyczytacRating ? getRatingTooltip(book, 'lubimyczytac') : undefined"
tooltipPosition="top"
>
<img src="https://lubimyczytac.pl/favicon.ico" alt="Lubimyczytac" class="rating-favicon"/>
@if (book?.metadata?.lubimyczytacRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.lubimyczytacRating) }}%</span>
}
</a>
}
@if (book?.metadata?.ranobedbRating || book?.metadata?.ranobedbId) {
<a
class="rating-link"
[href]="'https://ranobedb.org/book/' + (book.metadata?.ranobedbId ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.ranobedbRating ? getRatingTooltip(book, 'ranobedb') : undefined"
tooltipPosition="top"
>
<img src="https://www.ranobedb.org/favicon.png" alt="Ranobedb" class="rating-favicon"/>
@if (book?.metadata?.ranobedbRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.ranobedbRating) }}%</span>
}
</a>
}
@if (book?.metadata?.audibleRating || book?.metadata?.audibleId) {
<a
class="rating-link"
[href]="'https://www.audible.com/pd/' + (book.metadata?.audibleId ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.audibleRating ? getRatingTooltip(book, 'audible') : undefined"
tooltipPosition="top"
>
<img src="https://www.audible.com/favicon.ico" alt="Audible" class="rating-favicon"/>
@if (book?.metadata?.audibleRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.audibleRating) }}%</span>
}
</a>
}
@if (book?.metadata?.googleId) {
<a
class="rating-link"
[href]="'https://books.google.com/books?id=' + book.metadata!.googleId"
target="_blank"
rel="noopener noreferrer"
>
<img src="https://books.google.com/favicon.ico" alt="Google Books" class="rating-favicon"/>
</a>
}
@if (book?.metadata?.comicMetadata?.webLink) {
<a
class="rating-link"
[href]="book.metadata!.comicMetadata!.webLink"
target="_blank"
rel="noopener noreferrer"
>
<img src="https://www.comicvine.com/favicon.ico" alt="Comic Vine" class="rating-favicon"/>
</a>
} }
</div> </div>
</div> </div>
@@ -317,29 +317,16 @@
} }
} }
.rating-link { .rating-badge {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.3281rem; gap: 0.3281rem;
text-decoration: none;
color: var(--color-text); color: var(--color-text);
transition: transform 0.2s ease;
} }
.rating-link:hover { .rating-provider {
transform: translateY(-2px); font-size: var(--app-text-sm);
} color: var(--color-text-secondary);
.rating-link:hover .rating-favicon {
transform: scale(1.2);
filter: drop-shadow(0 2px 4px rgb(0 0 0 / 30%));
}
.rating-favicon {
width: 1.0938rem;
height: 1.0938rem;
object-fit: contain;
transition: transform 0.2s ease, filter 0.2s ease;
} }
.rating-value { .rating-value {
@@ -1,6 +1,8 @@
import {MetadataCatalogService} from '../../../../../shared/metadata/metadata-catalog.service';
import {METADATA_PROVIDER_LIST} from '../../../../../shared/metadata/metadata-providers';
import {signal} from '@angular/core'; import {signal} from '@angular/core';
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
import {of, throwError} from 'rxjs'; import {BehaviorSubject, of, throwError} from 'rxjs';
import {beforeEach, describe, expect, it, vi} from 'vitest'; import {beforeEach, describe, expect, it, vi} from 'vitest';
import {ConfirmationService, MessageService, MenuItem} from '@openng/optimus-ui/api'; import {ConfirmationService, MessageService, MenuItem} from '@openng/optimus-ui/api';
import {TranslocoService} from '@jsverse/transloco'; import {TranslocoService} from '@jsverse/transloco';
@@ -42,6 +44,8 @@ interface ConfirmationLike {
} }
describe('MetadataViewerComponent', () => { describe('MetadataViewerComponent', () => {
let langChanges: BehaviorSubject<string>;
const providers = signal(METADATA_PROVIDER_LIST);
const currentUser = signal<CurrentUser | null>(null); const currentUser = signal<CurrentUser | null>(null);
const appSettings = signal<AppSettings | null>(null); const appSettings = signal<AppSettings | null>(null);
const navigationState = signal(false); const navigationState = signal(false);
@@ -90,10 +94,11 @@ describe('MetadataViewerComponent', () => {
}); });
const messageAdd = vi.fn(); const messageAdd = vi.fn();
const translate = vi.fn((key: string, params?: Record<string, unknown>) => { const translate = vi.fn((key: string, params?: Record<string, unknown>) => {
const translatedKey = langChanges.value === 'en' ? key : `${langChanges.value}:${key}`;
if (!params) { if (!params) {
return key; return translatedKey;
} }
return `${key}:${Object.entries(params).map(([paramKey, value]) => `${paramKey}=${value}`).join(',')}`; return `${translatedKey}:${Object.entries(params).map(([paramKey, value]) => `${paramKey}=${String(value)}`).join(',')}`;
}); });
const getCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `cover:${bookId}:${updatedOn ?? 'none'}`); const getCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `cover:${bookId}:${updatedOn ?? 'none'}`);
const getAudiobookCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `audio:${bookId}:${updatedOn ?? 'none'}`); const getAudiobookCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `audio:${bookId}:${updatedOn ?? 'none'}`);
@@ -150,6 +155,8 @@ describe('MetadataViewerComponent', () => {
} }
beforeEach(() => { beforeEach(() => {
langChanges = new BehaviorSubject('en');
providers.set(METADATA_PROVIDER_LIST);
currentUser.set(null); currentUser.set(null);
appSettings.set(null); appSettings.set(null);
navigationState.set(false); navigationState.set(false);
@@ -202,7 +209,8 @@ describe('MetadataViewerComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{provide: TranslocoService, useValue: {translate, getActiveLang: () => 'en', langChanges$: of('en')}}, {provide: MetadataCatalogService, useValue: {providers: providers.asReadonly()}},
{provide: TranslocoService, useValue: {translate, getActiveLang: () => langChanges.value, langChanges$: langChanges}},
{provide: LibraryService, useValue: {findLibraryById}}, {provide: LibraryService, useValue: {findLibraryById}},
{ {
provide: BookDialogHelperService, provide: BookDialogHelperService,
@@ -482,7 +490,6 @@ describe('MetadataViewerComponent', () => {
expect(component.getStarColorScaled(null)).toBe('rgb(203, 213, 225)'); expect(component.getStarColorScaled(null)).toBe('rgb(203, 213, 225)');
expect(component.getStarColorScaled(5)).toBe('rgb(34, 197, 94)'); expect(component.getStarColorScaled(5)).toBe('rgb(34, 197, 94)');
expect(component.getRatingPercent(4.5)).toBe(90); expect(component.getRatingPercent(4.5)).toBe(90);
expect(component.getRatingTooltip(createBook({metadata: createMetadata({amazonRating: 4.2, amazonReviewCount: 1234})}), 'amazon')).toBe('★ 4.2 | 1,234 reviews');
expect(component.getStatusLabel(ReadStatus.READING)).toBe('metadata.viewer.readStatusReading'.toUpperCase()); expect(component.getStatusLabel(ReadStatus.READING)).toBe('metadata.viewer.readStatusReading'.toUpperCase());
expect(component.getStatusLabel('missing')).toBe('UNSET'); expect(component.getStatusLabel('missing')).toBe('UNSET');
expect(component.getBookCoverUrl(createBook())).toBe('cover:21:2026-03-26'); expect(component.getBookCoverUrl(createBook())).toBe('cover:21:2026-03-26');
@@ -498,4 +505,5 @@ describe('MetadataViewerComponent', () => {
expect(component.getChannelLabel(2)).toBe('metadata.viewer.channelStereo'); expect(component.getChannelLabel(2)).toBe('metadata.viewer.channelStereo');
expect(component.getChannelLabel(6)).toBe('metadata.viewer.channelMultiple:count=6'); expect(component.getChannelLabel(6)).toBe('metadata.viewer.channelMultiple:count=6');
}); });
}); });
@@ -40,7 +40,15 @@ import {AuthorService} from '../../../../author-browser/service/author.service';
import {Dialog} from '@openng/optimus-ui/dialog'; import {Dialog} from '@openng/optimus-ui/dialog';
import {Checkbox} from '@openng/optimus-ui/checkbox'; import {Checkbox} from '@openng/optimus-ui/checkbox';
import DOMPurify from 'dompurify'; import DOMPurify from 'dompurify';
import {MetadataCatalogService} from '../../../../../shared/metadata/metadata-catalog.service';
import type {MetadataProviderId} from '../../../../../shared/metadata/metadata-providers';
interface ProviderBadge {
id: MetadataProviderId;
labelKey: string;
rating: number | null;
tooltip: string | undefined;
}
@Component({ @Component({
selector: 'app-metadata-viewer', selector: 'app-metadata-viewer',
@@ -100,6 +108,7 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
} }
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
private libraryService = inject(LibraryService); private libraryService = inject(LibraryService);
private bookDialogHelperService = inject(BookDialogHelperService) private bookDialogHelperService = inject(BookDialogHelperService)
private emailService = inject(EmailService); private emailService = inject(EmailService);
@@ -118,6 +127,34 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
private dialogRef = inject(DynamicDialogRef, { optional: true }); private dialogRef = inject(DynamicDialogRef, { optional: true });
private userState = this.userService.currentUser; private userState = this.userService.currentUser;
private appSettings = this.appSettingsService.appSettings; private appSettings = this.appSettingsService.appSettings;
private readonly catalog = inject(MetadataCatalogService);
readonly providerBadges = computed((): ProviderBadge[] => {
const metadata = this.currentBook()?.metadata;
if (!metadata) {
return [];
}
return this.catalog.providers().map(provider => {
const book = provider.book;
const rating = (book?.rating ? metadata[book.rating] : null) ?? null;
const reviewCount = (book?.reviewCount ? metadata[book.reviewCount] : null) ?? null;
return {
id: provider.id,
labelKey: provider.labelKey,
rating,
tooltip: this.ratingTooltip(rating, reviewCount),
};
}).filter(provider => provider.rating !== null);
});
private ratingTooltip(rating: number | null, reviewCount: number | null): string | undefined {
if (rating === null) return undefined;
return reviewCount === null
? this.t.translate('metadata.viewer.ratingTooltipNoReviews', {rating}, this.activeLang())
: this.t.translate('metadata.viewer.ratingTooltip', {rating, reviews: reviewCount.toLocaleString()}, this.activeLang());
}
private navigateAfterDialogClose(navigate: () => void): void { private navigateAfterDialogClose(navigate: () => void): void {
if (this.metadataCenterViewMode !== 'dialog') { if (this.metadataCenterViewMode !== 'dialog') {
@@ -475,7 +512,6 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
if (user) { if (user) {
this.metadataCenterViewMode = user.userSettings.metadataCenterViewMode ?? 'route'; this.metadataCenterViewMode = user.userSettings.metadataCenterViewMode ?? 'route';
} }
} }
ngAfterViewChecked(): void { ngAfterViewChecked(): void {
@@ -1139,40 +1175,6 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
return p != null ? Math.round(p * 10) / 10 : null; return p != null ? Math.round(p * 10) / 10 : null;
} }
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover' | 'lubimyczytac' | 'ranobedb' | 'audible'): string {
const meta = book?.metadata;
if (!meta) return '';
switch (source) {
case 'amazon':
return meta.amazonRating != null
? `★ ${meta.amazonRating} | ${meta.amazonReviewCount?.toLocaleString() ?? '0'} reviews`
: '';
case 'goodreads':
return meta.goodreadsRating != null
? `★ ${meta.goodreadsRating} | ${meta.goodreadsReviewCount?.toLocaleString() ?? '0'} reviews`
: '';
case 'hardcover':
return meta.hardcoverRating != null
? `★ ${meta.hardcoverRating} | ${meta.hardcoverReviewCount?.toLocaleString() ?? '0'} reviews`
: '';
case 'lubimyczytac':
return meta.lubimyczytacRating != null
? `★ ${meta.lubimyczytacRating}`
: '';
case 'ranobedb':
return meta.ranobedbRating != null
? `★ ${meta.ranobedbRating}`
: '';
case 'audible':
return meta.audibleRating != null
? `★ ${meta.audibleRating} | ${meta.audibleReviewCount?.toLocaleString() ?? '0'} reviews`
: '';
default:
return '';
}
}
getRatingPercent(rating: number | null | undefined): number { getRatingPercent(rating: number | null | undefined): number {
if (rating == null) return 0; if (rating == null) return 0;
return Math.round((rating / 5) * 100); return Math.round((rating / 5) * 100);
@@ -8,11 +8,13 @@
</p> </p>
</div> </div>
<div class="header-actions"> <div class="header-actions">
<p-tag @if (syncStatus() !== null) {
[value]="getSyncStatusLabel()" <p-tag
[severity]="getSyncStatusSeverity()" [value]="syncStatusLabel()"
class="sync-status-tag" [severity]="syncStatusSeverity()"
/> class="sync-status-tag"
/>
}
</div> </div>
</div> </div>
@@ -21,6 +23,12 @@
<i class="pi pi-spin pi-spinner"></i> <i class="pi pi-spin pi-spinner"></i>
<span>{{ t('loading') }}</span> <span>{{ t('loading') }}</span>
</div> </div>
} @else if (failed()) {
<div class="empty-state" role="alert">
<i class="pi pi-exclamation-circle"></i>
<p>{{ t('readFailed') }}</p>
<p-button [label]="'common.retry' | transloco" (onClick)="retryRead()" size="small" />
</div>
} @else { } @else {
<div class="sidecar-actions"> <div class="sidecar-actions">
<p-button <p-button
@@ -37,7 +45,7 @@
[label]="t('importBtn')" [label]="t('importBtn')"
icon="pi pi-download" icon="pi pi-download"
[loading]="importing()" [loading]="importing()"
[disabled]="syncStatus === 'MISSING'" [disabled]="syncStatus() === 'MISSING'"
(onClick)="importFromSidecar()" (onClick)="importFromSidecar()"
severity="secondary" severity="secondary"
size="small" size="small"
@@ -46,7 +54,7 @@
/> />
</div> </div>
@if (syncStatus === 'MISSING') { @if (syncStatus() === 'MISSING') {
<div class="empty-state"> <div class="empty-state">
<i class="pi pi-file"></i> <i class="pi pi-file"></i>
<h4>{{ t('noSidecarTitle') }}</h4> <h4>{{ t('noSidecarTitle') }}</h4>
@@ -54,33 +62,33 @@
{{ t('noSidecarDescription') }} {{ t('noSidecarDescription') }}
</p> </p>
</div> </div>
} @else if (sidecarContent) { } @else if (sidecarContent(); as sidecar) {
<div class="sidecar-content"> <div class="sidecar-content">
<div class="content-header"> <div class="content-header">
<div class="content-meta"> <div class="content-meta">
<span class="meta-item"> <span class="meta-item">
<i class="pi pi-clock"></i> <i class="pi pi-clock"></i>
{{ t('generatedLabel') }} {{ sidecarContent.generatedAt | date:'medium' }} {{ t('generatedLabel') }} {{ sidecar.generatedAt | date:'medium' }}
</span> </span>
<span class="meta-item"> <span class="meta-item">
<i class="pi pi-tag"></i> <i class="pi pi-tag"></i>
{{ t('versionLabel') }} {{ sidecarContent.version }} {{ t('versionLabel') }} {{ sidecar.version }}
</span> </span>
<span class="meta-item"> <span class="meta-item">
<i class="pi pi-cog"></i> <i class="pi pi-cog"></i>
{{ t('byLabel') }} {{ sidecarContent.generatedBy }} {{ t('byLabel') }} {{ sidecar.generatedBy }}
</span> </span>
</div> </div>
</div> </div>
<div class="json-viewer"> <div class="json-viewer">
<pre class="json-content">{{ sidecarContent | json }}</pre> <pre class="json-content">{{ sidecar | json }}</pre>
</div> </div>
@if (sidecarContent.cover) { @if (sidecar.cover; as cover) {
<div class="cover-info"> <div class="cover-info">
<i class="pi pi-image"></i> <i class="pi pi-image"></i>
<span>{{ t('coverFileLabel') }} {{ sidecarContent.cover.path }}</span> <span>{{ t('coverFileLabel') }} {{ cover.path }}</span>
</div> </div>
} }
</div> </div>
@@ -1,58 +1,88 @@
import {TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {of, throwError} from 'rxjs';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {TranslocoService} from '@jsverse/transloco'; import {TranslocoService} from '@jsverse/transloco';
import {provideTanStackQuery, queryOptions, QueryClient} from '@tanstack/angular-query-experimental';
import {BehaviorSubject, of, throwError} from 'rxjs';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {Book} from '../../../../book/model/book.model'; import {Book} from '../../../../book/model/book.model';
import {SidecarMetadata, SidecarService, SidecarSyncStatus} from '../../../service/sidecar.service'; import {SidecarService} from '../../../service/sidecar.service';
import {SidecarMetadata, SidecarSyncStatus} from '../../../sources/sidecar.models';
import {metadataSourceKeys, MetadataSourceQueryService} from '../../../sources/metadata-source-query.service';
import {SidecarViewerComponent} from './sidecar-viewer.component'; import {SidecarViewerComponent} from './sidecar-viewer.component';
describe('SidecarViewerComponent', () => { describe('SidecarViewerComponent', () => {
const getSyncStatus = vi.fn(); let status: SidecarSyncStatus;
const getSidecarContent = vi.fn(); let statusError: Error | null;
const exportToSidecar = vi.fn(); let contentError: Error | null;
const importFromSidecar = vi.fn(); let content: SidecarMetadata;
let queryClient: QueryClient;
let fixture: ComponentFixture<SidecarViewerComponent>;
let langChanges: BehaviorSubject<string>;
const messageAdd = vi.fn(); const messageAdd = vi.fn();
const translate = vi.fn((key: string) => `translated:${key}`); const exportToSidecar = vi.fn(() => of({message: 'ok'}));
const importFromSidecar = vi.fn(() => of({message: 'ok'}));
const contentQuery = vi.fn(async () => {
if (contentError) throw contentError;
return content;
});
const sidecarStatus = vi.fn((bookId: number) => queryOptions({
queryKey: metadataSourceKeys.sidecarStatus(bookId),
queryFn: async () => {
if (statusError) throw statusError;
return {status};
},
retry: false,
}));
const sidecar = vi.fn((bookId: number) => queryOptions({
queryKey: metadataSourceKeys.sidecar(bookId),
queryFn: contentQuery,
retry: false,
}));
const translate = vi.fn((key: string) => `${langChanges.value === 'en' ? 'translated' : langChanges.value}:${key}`);
function createBook(id: number): Book { const book = (id: number): Book => ({id, libraryId: 1, libraryName: 'Library'});
return {
id,
title: `Book ${id}`,
libraryId: 1,
libraryName: 'Library',
} as Book;
}
function createMetadata(): SidecarMetadata { beforeEach(() => {
return { langChanges = new BehaviorSubject('en');
status = 'IN_SYNC';
statusError = null;
contentError = null;
content = {
version: '1', version: '1',
generatedAt: '2026-03-26T00:00:00Z', generatedAt: '2026-03-26T00:00:00Z',
generatedBy: 'test', generatedBy: 'test',
metadata: {title: 'Example'}, metadata: {title: 'Example'},
cover: {source: 'embedded', path: '/covers/example.jpg'}, cover: {source: 'embedded', path: '/covers/example.jpg'},
}; };
}
beforeEach(() => {
vi.restoreAllMocks();
getSyncStatus.mockReset();
getSidecarContent.mockReset();
exportToSidecar.mockReset();
importFromSidecar.mockReset();
messageAdd.mockReset(); messageAdd.mockReset();
translate.mockClear(); sidecarStatus.mockClear();
sidecar.mockClear();
contentQuery.mockClear();
exportToSidecar.mockReset();
exportToSidecar.mockReturnValue(of({message: 'ok'}));
importFromSidecar.mockReset();
importFromSidecar.mockReturnValue(of({message: 'ok'}));
queryClient = new QueryClient();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{ provideTanStackQuery(queryClient),
provide: SidecarService,
useValue: {getSyncStatus, getSidecarContent, exportToSidecar, importFromSidecar},
},
{provide: MessageService, useValue: {add: messageAdd}}, {provide: MessageService, useValue: {add: messageAdd}},
{provide: TranslocoService, useValue: {translate}}, {provide: SidecarService, useValue: {exportToSidecar, importFromSidecar}},
] {provide: MetadataSourceQueryService, useValue: {sidecarStatus, sidecar}},
{
provide: TranslocoService,
useValue: {
config: {reRenderOnLangChange: false},
langChanges$: langChanges,
getActiveLang: () => langChanges.value,
selectTranslate: (key: string) => of(translate(key)),
_loadDependencies: () => of(undefined),
translate,
},
},
],
}); });
}); });
@@ -60,173 +90,129 @@ describe('SidecarViewerComponent', () => {
TestBed.resetTestingModule(); TestBed.resetTestingModule();
}); });
it('resets its state when the selected book is cleared', () => { async function createComponent(bookId = 7): Promise<SidecarViewerComponent> {
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent()); fixture = TestBed.createComponent(SidecarViewerComponent);
component.currentBookId = 7; fixture.componentRef.setInput('book', book(bookId));
component.sidecarContent = createMetadata(); await fixture.whenStable();
component.syncStatus = 'IN_SYNC'; await queryClient.fetchQuery(sidecarStatus(bookId)).catch(() => undefined);
component.loading.set(true); await fixture.whenStable();
component.error = 'failed'; await new Promise(resolve => setTimeout(resolve, 0));
await fixture.whenStable();
if (status !== 'MISSING' && status !== 'NOT_APPLICABLE' && statusError === null) {
await queryClient.fetchQuery(sidecar(bookId)).catch(() => undefined);
await fixture.whenStable();
await new Promise(resolve => setTimeout(resolve, 0));
await fixture.whenStable();
}
return fixture.componentInstance;
}
component.book = null; it('shows sidecar status and content and updates the label when the language changes', async () => {
const component = await createComponent();
expect(component.currentBookId).toBeNull(); expect(component.syncStatus()).toBe('IN_SYNC');
expect(component.sidecarContent).toBeNull(); expect(component.sidecarContent()).toEqual(content);
expect(component.syncStatus).toBe('NOT_APPLICABLE'); expect(component.syncStatusLabel()).toBe('translated:metadata.sidecar.syncStatusInSync');
expect(component.loading()).toBe(false);
expect(component.error).toBeNull(); langChanges.next('de');
await fixture.whenStable();
expect(component.syncStatusLabel()).toBe('de:metadata.sidecar.syncStatusInSync');
expect(component.syncStatus()).toBe('IN_SYNC');
}); });
it('loads sync status and content when a sidecar exists for the selected book', () => { it('skips sidecar content for missing and not-applicable statuses', async () => {
const metadata = createMetadata(); status = 'MISSING';
getSyncStatus.mockReturnValue(of({status: 'IN_SYNC'})); const missing = await createComponent(3);
getSidecarContent.mockReturnValue(of(metadata)); expect(missing.sidecarContent()).toBeNull();
expect(contentQuery).not.toHaveBeenCalled();
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent()); status = 'NOT_APPLICABLE';
component.book = createBook(7); const notApplicable = await createComponent(4);
expect(notApplicable.sidecarContent()).toBeNull();
expect(getSyncStatus).toHaveBeenCalledWith(7); expect(contentQuery).not.toHaveBeenCalled();
expect(getSidecarContent).toHaveBeenCalledWith(7);
expect(component.currentBookId).toBe(7);
expect(component.syncStatus).toBe('IN_SYNC');
expect(component.sidecarContent).toEqual(metadata);
expect(component.loading()).toBe(false);
}); });
it('skips content loading when the sidecar is missing or not applicable', () => { it('maps every status to its severity and label', async () => {
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent()); const cases: [SidecarSyncStatus, ReturnType<SidecarViewerComponent['syncStatusSeverity']>, string][] = [
getSyncStatus.mockReturnValue(of({status: 'MISSING'}));
component.book = createBook(3);
expect(getSidecarContent).not.toHaveBeenCalled();
expect(component.syncStatus).toBe('MISSING');
expect(component.sidecarContent).toBeNull();
expect(component.loading()).toBe(false);
getSyncStatus.mockReturnValue(of({status: 'NOT_APPLICABLE'}));
component.book = createBook(4);
expect(getSidecarContent).not.toHaveBeenCalled();
expect(component.syncStatus).toBe('NOT_APPLICABLE');
expect(component.loading()).toBe(false);
});
it('falls back to NOT_APPLICABLE when sync status lookup fails', () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
getSyncStatus.mockReturnValue(throwError(() => new Error('boom')));
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
component.book = createBook(5);
expect(component.syncStatus).toBe('NOT_APPLICABLE');
expect(component.sidecarContent).toBeNull();
expect(component.loading()).toBe(false);
expect(consoleError).toHaveBeenCalledOnce();
});
it('suppresses console noise for missing sidecar content but logs other load failures', () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
getSyncStatus.mockReturnValue(of({status: 'OUTDATED'}));
getSidecarContent.mockReturnValue(throwError(() => ({status: 404})));
component.book = createBook(6);
expect(component.sidecarContent).toBeNull();
expect(component.loading()).toBe(false);
expect(consoleError).not.toHaveBeenCalled();
getSidecarContent.mockReturnValue(throwError(() => ({status: 500})));
component.loadSidecarData(6);
expect(consoleError).toHaveBeenCalledOnce();
});
it('exports to sidecar, shows a success toast, and reloads the current book data', () => {
exportToSidecar.mockReturnValue(of({message: 'ok'}));
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
const reload = vi.spyOn(component, 'loadSidecarData').mockImplementation(() => undefined);
component.currentBookId = 9;
component.exportToSidecar();
expect(exportToSidecar).toHaveBeenCalledWith(9);
expect(messageAdd).toHaveBeenCalledWith({
severity: 'success',
summary: 'translated:metadata.sidecar.toast.exportSuccessSummary',
detail: 'translated:metadata.sidecar.toast.exportSuccessDetail',
});
expect(reload).toHaveBeenCalledWith(9);
expect(component.exporting()).toBe(false);
});
it('shows an error toast when export fails and ignores export without a selected book', () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
exportToSidecar.mockReturnValue(throwError(() => new Error('export failed')));
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
component.exportToSidecar();
expect(exportToSidecar).not.toHaveBeenCalled();
component.currentBookId = 11;
component.exportToSidecar();
expect(messageAdd).toHaveBeenCalledWith({
severity: 'error',
summary: 'translated:metadata.sidecar.toast.exportFailedSummary',
detail: 'translated:metadata.sidecar.toast.exportFailedDetail',
});
expect(component.exporting()).toBe(false);
expect(consoleError).toHaveBeenCalledOnce();
});
it('imports from sidecar, shows success or error toasts, and reloads when needed', () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
importFromSidecar.mockReturnValueOnce(of({message: 'ok'})).mockReturnValueOnce(throwError(() => new Error('import failed')));
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
const reload = vi.spyOn(component, 'loadSidecarData').mockImplementation(() => undefined);
component.currentBookId = 12;
component.importFromSidecar();
expect(messageAdd).toHaveBeenCalledWith({
severity: 'success',
summary: 'translated:metadata.sidecar.toast.importSuccessSummary',
detail: 'translated:metadata.sidecar.toast.importSuccessDetail',
});
expect(reload).toHaveBeenCalledWith(12);
expect(component.importing()).toBe(false);
component.importFromSidecar();
expect(messageAdd).toHaveBeenLastCalledWith({
severity: 'error',
summary: 'translated:metadata.sidecar.toast.importFailedSummary',
detail: 'translated:metadata.sidecar.toast.importFailedDetail',
});
expect(component.importing()).toBe(false);
expect(consoleError).toHaveBeenCalledOnce();
});
it('maps sync status severities and labels across all branches', () => {
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
const cases: [SidecarSyncStatus | 'UNKNOWN', string, string][] = [
['IN_SYNC', 'success', 'translated:metadata.sidecar.syncStatusInSync'], ['IN_SYNC', 'success', 'translated:metadata.sidecar.syncStatusInSync'],
['OUTDATED', 'warn', 'translated:metadata.sidecar.syncStatusOutdated'], ['OUTDATED', 'warn', 'translated:metadata.sidecar.syncStatusOutdated'],
['CONFLICT', 'danger', 'translated:metadata.sidecar.syncStatusConflict'], ['CONFLICT', 'danger', 'translated:metadata.sidecar.syncStatusConflict'],
['MISSING', 'secondary', 'translated:metadata.sidecar.syncStatusMissing'], ['MISSING', 'secondary', 'translated:metadata.sidecar.syncStatusMissing'],
['NOT_APPLICABLE', 'info', 'translated:metadata.sidecar.syncStatusNA'], ['NOT_APPLICABLE', 'info', 'translated:metadata.sidecar.syncStatusNA'],
['UNKNOWN', 'info', 'translated:metadata.sidecar.syncStatusUnknown'],
]; ];
for (const [status, severity, label] of cases) { for (const [index, [nextStatus, severity, label]] of cases.entries()) {
component.syncStatus = status as SidecarSyncStatus; status = nextStatus;
expect(component.getSyncStatusSeverity()).toBe(severity); const component = await createComponent(index + 20);
expect(component.getSyncStatusLabel()).toBe(label); expect(component.syncStatusSeverity()).toBe(severity);
expect(component.syncStatusLabel()).toBe(label);
} }
}); });
it('shows a status read failure and retries it without claiming the sidecar is inapplicable', async () => {
statusError = new Error('Status unavailable');
const component = await createComponent();
expect(component.syncStatus()).toBeNull();
expect(component.failed()).toBe(true);
expect(contentQuery).not.toHaveBeenCalled();
expect(fixture.nativeElement.querySelector('[role="alert"]')?.textContent).toContain('metadata.sidecar.readFailed');
statusError = null;
component.retryRead();
await vi.waitFor(() => expect(component.sidecarContent()).toEqual(content));
await fixture.whenStable();
expect(component.failed()).toBe(false);
expect(component.syncStatus()).toBe('IN_SYNC');
expect(fixture.nativeElement.querySelector('[role="alert"]')).toBeNull();
});
it('shows a content read failure separately from missing sidecar data', async () => {
contentError = new Error('Content unavailable');
const component = await createComponent();
expect(component.syncStatus()).toBe('IN_SYNC');
expect(component.failed()).toBe(true);
expect(component.sidecarContent()).toBeNull();
expect(fixture.nativeElement.querySelector('[role="alert"]')?.textContent).toContain('metadata.sidecar.readFailed');
});
it('exports with a success toast and invalidates the book sidecar key', async () => {
const component = await createComponent(12);
const invalidate = vi.spyOn(queryClient, 'invalidateQueries');
component.exportToSidecar();
expect(messageAdd).toHaveBeenCalledWith(expect.objectContaining({severity: 'success'}));
expect(invalidate).toHaveBeenCalledWith({queryKey: metadataSourceKeys.sidecar(12)});
});
it('reports an export error', async () => {
exportToSidecar.mockReturnValue(throwError(() => new Error('export failed')));
const component = await createComponent(12);
component.exportToSidecar();
expect(messageAdd).toHaveBeenCalledWith(expect.objectContaining({severity: 'error'}));
});
it('imports with a success toast and invalidates the book sidecar key', async () => {
const component = await createComponent(12);
const invalidate = vi.spyOn(queryClient, 'invalidateQueries');
component.importFromSidecar();
expect(messageAdd).toHaveBeenCalledWith(expect.objectContaining({severity: 'success'}));
expect(invalidate).toHaveBeenCalledWith({queryKey: metadataSourceKeys.sidecar(12)});
});
it('reports an import error', async () => {
importFromSidecar.mockReturnValue(throwError(() => new Error('import failed')));
const component = await createComponent(12);
component.importFromSidecar();
expect(messageAdd).toHaveBeenCalledWith(expect.objectContaining({severity: 'error'}));
});
}); });
@@ -1,100 +1,108 @@
import {Component, inject, Input, OnDestroy, signal} from '@angular/core'; import {Component, computed, inject, input, OnDestroy, signal} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators'; import {takeUntil} from 'rxjs/operators';
import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {Book} from '../../../../book/model/book.model'; import {Book} from '../../../../book/model/book.model';
import {SidecarMetadata, SidecarService, SidecarSyncStatus} from '../../../service/sidecar.service'; import {SidecarService} from '../../../service/sidecar.service';
import {SidecarMetadata, SidecarSyncStatus} from '../../../sources/sidecar.models';
import {metadataSourceKeys, MetadataSourceQueryService} from '../../../sources/metadata-source-query.service';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {Tag} from '@openng/optimus-ui/tag'; import {Tag} from '@openng/optimus-ui/tag';
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {DatePipe, JsonPipe} from '@angular/common'; import {DatePipe, JsonPipe} from '@angular/common';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
@Component({ @Component({
selector: 'app-sidecar-viewer', selector: 'app-sidecar-viewer',
standalone: true, standalone: true,
templateUrl: './sidecar-viewer.component.html', templateUrl: './sidecar-viewer.component.html',
styleUrls: ['./sidecar-viewer.component.scss'], styleUrls: ['./sidecar-viewer.component.scss'],
imports: [Button, Tag, Tooltip, JsonPipe, DatePipe, TranslocoDirective] imports: [Button, Tag, Tooltip, JsonPipe, DatePipe, TranslocoDirective, TranslocoPipe]
}) })
export class SidecarViewerComponent implements OnDestroy { export class SidecarViewerComponent implements OnDestroy {
@Input() readonly book = input<Book | null>(null);
set book(value: Book | null) { readonly currentBookId = computed(() => this.book()?.id ?? null);
if (!value) {
this.currentBookId = null;
this.sidecarContent = null;
this.syncStatus = 'NOT_APPLICABLE';
this.loading.set(false);
this.error = null;
return;
}
this.currentBookId = value.id; private readonly sidecarService = inject(SidecarService);
this.loadSidecarData(value.id); private readonly sources = inject(MetadataSourceQueryService);
} private readonly queryClient = inject(QueryClient);
private readonly messageService = inject(MessageService);
private sidecarService = inject(SidecarService);
private messageService = inject(MessageService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
sidecarContent: SidecarMetadata | null = null; private readonly statusQuery = injectQuery(() => ({
syncStatus: SidecarSyncStatus = 'NOT_APPLICABLE'; ...this.sources.sidecarStatus(this.currentBookId() ?? 0),
loading = signal(false); enabled: this.currentBookId() !== null,
exporting = signal(false); }));
importing = signal(false);
currentBookId: number | null = null;
error: string | null = null;
loadSidecarData(bookId: number): void { readonly syncStatus = computed<SidecarSyncStatus | null>(() =>
this.loading.set(true); this.statusQuery.isError() ? null : this.statusQuery.data()?.status ?? null
this.error = null; );
readonly syncStatusSeverity = computed(() => {
switch (this.syncStatus()) {
case 'IN_SYNC':
return 'success';
case 'OUTDATED':
return 'warn';
case 'CONFLICT':
return 'danger';
case 'MISSING':
return 'secondary';
default:
return 'info';
}
});
readonly syncStatusLabel = computed(() => {
const lang = this.activeLang();
switch (this.syncStatus()) {
case 'IN_SYNC':
return this.t.translate('metadata.sidecar.syncStatusInSync', {}, lang);
case 'OUTDATED':
return this.t.translate('metadata.sidecar.syncStatusOutdated', {}, lang);
case 'CONFLICT':
return this.t.translate('metadata.sidecar.syncStatusConflict', {}, lang);
case 'MISSING':
return this.t.translate('metadata.sidecar.syncStatusMissing', {}, lang);
case 'NOT_APPLICABLE':
return this.t.translate('metadata.sidecar.syncStatusNA', {}, lang);
default:
return this.t.translate('metadata.sidecar.syncStatusUnknown', {}, lang);
}
});
private readonly hasSidecar = computed(() => {
const status = this.syncStatus();
return status !== null && status !== 'MISSING' && status !== 'NOT_APPLICABLE';
});
this.sidecarService.getSyncStatus(bookId).pipe( private readonly contentQuery = injectQuery(() => ({
takeUntil(this.destroy$) ...this.sources.sidecar(this.currentBookId() ?? 0),
).subscribe({ enabled: this.currentBookId() !== null && this.hasSidecar(),
next: (response) => { }));
this.syncStatus = response.status;
if (response.status !== 'MISSING' && response.status !== 'NOT_APPLICABLE') { readonly sidecarContent = computed<SidecarMetadata | null>(() =>
this.loadSidecarContent(bookId); this.hasSidecar() && !this.contentQuery.isError() ? this.contentQuery.data() ?? null : null
} else { );
this.sidecarContent = null; readonly loading = computed(() => this.statusQuery.isLoading() || this.contentQuery.isLoading());
this.loading.set(false); readonly failed = computed(() => this.statusQuery.isError() || (this.hasSidecar() && this.contentQuery.isError()));
} readonly exporting = signal(false);
}, readonly importing = signal(false);
error: (err) => {
this.syncStatus = 'NOT_APPLICABLE';
this.sidecarContent = null;
this.loading.set(false);
console.error('Failed to get sync status:', err);
}
});
}
private loadSidecarContent(bookId: number): void { retryRead(): void {
this.sidecarService.getSidecarContent(bookId).pipe( const bookId = this.currentBookId();
takeUntil(this.destroy$) if (bookId !== null) {
).subscribe({ void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
next: (content) => { }
this.sidecarContent = content;
this.loading.set(false);
},
error: (err) => {
this.sidecarContent = null;
this.loading.set(false);
if (err.status !== 404) {
console.error('Failed to load sidecar content:', err);
}
}
});
} }
exportToSidecar(): void { exportToSidecar(): void {
if (!this.currentBookId) return; const bookId = this.currentBookId();
if (!bookId) return;
this.exporting.set(true); this.exporting.set(true);
this.sidecarService.exportToSidecar(this.currentBookId).pipe( this.sidecarService.exportToSidecar(bookId).pipe(
takeUntil(this.destroy$) takeUntil(this.destroy$)
).subscribe({ ).subscribe({
next: () => { next: () => {
@@ -103,7 +111,7 @@ export class SidecarViewerComponent implements OnDestroy {
summary: this.t.translate('metadata.sidecar.toast.exportSuccessSummary'), summary: this.t.translate('metadata.sidecar.toast.exportSuccessSummary'),
detail: this.t.translate('metadata.sidecar.toast.exportSuccessDetail') detail: this.t.translate('metadata.sidecar.toast.exportSuccessDetail')
}); });
this.loadSidecarData(this.currentBookId!); void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
this.exporting.set(false); this.exporting.set(false);
}, },
error: (err) => { error: (err) => {
@@ -119,10 +127,11 @@ export class SidecarViewerComponent implements OnDestroy {
} }
importFromSidecar(): void { importFromSidecar(): void {
if (!this.currentBookId) return; const bookId = this.currentBookId();
if (!bookId) return;
this.importing.set(true); this.importing.set(true);
this.sidecarService.importFromSidecar(this.currentBookId).pipe( this.sidecarService.importFromSidecar(bookId).pipe(
takeUntil(this.destroy$) takeUntil(this.destroy$)
).subscribe({ ).subscribe({
next: () => { next: () => {
@@ -131,7 +140,7 @@ export class SidecarViewerComponent implements OnDestroy {
summary: this.t.translate('metadata.sidecar.toast.importSuccessSummary'), summary: this.t.translate('metadata.sidecar.toast.importSuccessSummary'),
detail: this.t.translate('metadata.sidecar.toast.importSuccessDetail') detail: this.t.translate('metadata.sidecar.toast.importSuccessDetail')
}); });
this.loadSidecarData(this.currentBookId!); void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
this.importing.set(false); this.importing.set(false);
}, },
error: (err) => { error: (err) => {
@@ -146,38 +155,6 @@ export class SidecarViewerComponent implements OnDestroy {
}); });
} }
getSyncStatusSeverity(): 'success' | 'info' | 'warn' | 'danger' | 'secondary' | 'contrast' {
switch (this.syncStatus) {
case 'IN_SYNC':
return 'success';
case 'OUTDATED':
return 'warn';
case 'CONFLICT':
return 'danger';
case 'MISSING':
return 'secondary';
default:
return 'info';
}
}
getSyncStatusLabel(): string {
switch (this.syncStatus) {
case 'IN_SYNC':
return this.t.translate('metadata.sidecar.syncStatusInSync');
case 'OUTDATED':
return this.t.translate('metadata.sidecar.syncStatusOutdated');
case 'CONFLICT':
return this.t.translate('metadata.sidecar.syncStatusConflict');
case 'MISSING':
return this.t.translate('metadata.sidecar.syncStatusMissing');
case 'NOT_APPLICABLE':
return this.t.translate('metadata.sidecar.syncStatusNA');
default:
return this.t.translate('metadata.sidecar.syncStatusUnknown');
}
}
ngOnDestroy(): void { ngOnDestroy(): void {
this.destroy$.next(); this.destroy$.next();
this.destroy$.complete(); this.destroy$.complete();
@@ -96,21 +96,27 @@
<p-progressSpinner strokeWidth="3" animationDuration="1s"></p-progressSpinner> <p-progressSpinner strokeWidth="3" animationDuration="1s"></p-progressSpinner>
<p>{{ t('searchingForCovers') }}</p> <p>{{ t('searchingForCovers') }}</p>
</div> </div>
} @else if (coverImages.length === 0) { } @else if (coverImages().length === 0 || failed()) {
<!-- No Results State --> <!-- No Results State -->
<div class="empty-state no-results"> <div class="empty-state no-results">
<div class="empty-state-icon warning"> <div class="empty-state-icon warning">
<i class="pi pi-search"></i> <i class="pi pi-search"></i>
</div> </div>
<h3>{{ t('noCoversFound') }}</h3> @if (failed()) {
<p>{{ t('noCoversFoundDescription') }}</p> <h3>{{ t('searchFailed') }}</h3>
} @else {
<h3>{{ t('noCoversFound') }}</h3>
<p>{{ t('noCoversFoundDescription') }}</p>
}
</div> </div>
} @else { }
@if (!loading() && coverImages().length > 0) {
<!-- Results Grid --> <!-- Results Grid -->
<div class="results-header"> <div class="results-header">
<span class="results-count"> <span class="results-count">
<i class="pi pi-images"></i> <i class="pi pi-images"></i>
{{ coverImages.length === 1 ? t('coversFoundSingular', { count: coverImages.length }) : t('coversFoundPlural', { count: coverImages.length }) }} {{ coverImages().length === 1 ? t('coversFoundSingular', { count: coverImages().length }) : t('coversFoundPlural', { count: coverImages().length }) }}
</span> </span>
<span class="results-hint"> <span class="results-hint">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
@@ -119,7 +125,7 @@
</div> </div>
<div class="covers-grid"> <div class="covers-grid">
@for (cover of coverImages; track cover.url; let i = $index) { @for (cover of coverImages(); track cover.url; let i = $index) {
<div class="cover-card"> <div class="cover-card">
<div class="cover-image-wrapper"> <div class="cover-image-wrapper">
<p-image <p-image
@@ -1,25 +1,26 @@
import {Component, inject, Input, OnInit, signal} from '@angular/core'; import {Component, computed, inject, signal} from '@angular/core';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from '@angular/forms'; import {FormBuilder, ReactiveFormsModule, Validators} from '@angular/forms';
import {BookCoverService, CoverFetchRequest, CoverImage} from '../../../../shared/services/book-cover.service'; import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {finalize} from 'rxjs/operators';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {InputText} from '@openng/optimus-ui/inputtext'; import {InputText} from '@openng/optimus-ui/inputtext';
import {ProgressSpinner} from '@openng/optimus-ui/progressspinner'; import {ProgressSpinner} from '@openng/optimus-ui/progressspinner';
import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog'; import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
import {BookService} from '../../../book/service/book.service'; import {BookService} from '../../../book/service/book.service';
import {BookMetadataManageService} from '../../../book/service/book-metadata-manage.service'; import {BookMetadataManageService} from '../../../book/service/book-metadata-manage.service';
import {CoverImage, CoverSearchParams, MetadataSourceQueryService} from '../../sources/metadata-source-query.service';
import {Image} from '@openng/optimus-ui/image'; import {Image} from '@openng/optimus-ui/image';
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
const NO_SEARCH: CoverSearchParams = {bookId: 0, coverType: 'ebook'};
@Component({ @Component({
selector: 'app-cover-search', selector: 'app-cover-search',
templateUrl: './cover-search.component.html', templateUrl: './cover-search.component.html',
imports: [ imports: [
Button, Button,
ReactiveFormsModule, ReactiveFormsModule,
FormsModule,
InputText, InputText,
ProgressSpinner, ProgressSpinner,
Image, Image,
@@ -28,47 +29,41 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
], ],
styleUrls: ['./cover-search.component.scss'] styleUrls: ['./cover-search.component.scss']
}) })
export class CoverSearchComponent implements OnInit { export class CoverSearchComponent {
@Input() bookId!: number; private readonly fb = inject(FormBuilder);
searchForm: FormGroup; private readonly dynamicDialogConfig = inject(DynamicDialogConfig);
coverImages: CoverImage[] = []; protected readonly dynamicDialogRef = inject(DynamicDialogRef);
loading = signal(false); private readonly bookService = inject(BookService);
hasSearched = signal(false); private readonly bookMetadataManageService = inject(BookMetadataManageService);
coverType: 'ebook' | 'audiobook' = 'ebook'; private readonly sources = inject(MetadataSourceQueryService);
private readonly queryClient = inject(QueryClient);
private fb = inject(FormBuilder); private readonly messageService = inject(MessageService);
private bookCoverService = inject(BookCoverService);
private dynamicDialogConfig = inject(DynamicDialogConfig);
protected dynamicDialogRef = inject(DynamicDialogRef);
protected bookService = inject(BookService);
private bookMetadataManageService = inject(BookMetadataManageService);
private messageService = inject(MessageService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
private readonly bookId: number = this.dynamicDialogConfig.data.bookId;
private readonly book = this.bookService.findBookById(this.bookId);
readonly searchForm = this.fb.nonNullable.group({
title: ['', Validators.required],
author: ['']
});
readonly coverType: 'ebook' | 'audiobook' = this.dynamicDialogConfig.data.coverType ??
(this.book?.primaryFile?.bookType === 'AUDIOBOOK' ? 'audiobook' : 'ebook');
private readonly search = signal<CoverSearchParams | null>(null);
private readonly query = injectQuery(() => ({
...this.sources.coverSearch(this.search() ?? NO_SEARCH),
enabled: this.search() !== null,
}));
readonly coverImages = computed(() => [...(this.query.data() ?? [])].sort((a, b) => a.index - b.index));
readonly loading = this.query.isFetching;
readonly failed = computed(() => this.query.isError());
readonly hasSearched = computed(() => this.search() !== null);
constructor() { constructor() {
this.searchForm = this.fb.group({ if (this.book) {
title: ['', Validators.required],
author: ['']
});
}
ngOnInit() {
this.bookId = this.dynamicDialogConfig.data.bookId;
const book = this.bookService.findBookById(this.bookId);
// Use explicitly provided coverType, or auto-detect based on primary file
if (this.dynamicDialogConfig.data.coverType) {
this.coverType = this.dynamicDialogConfig.data.coverType;
} else if (book?.primaryFile?.bookType === 'AUDIOBOOK') {
this.coverType = 'audiobook';
} else {
this.coverType = 'ebook';
}
if (book) {
this.searchForm.patchValue({ this.searchForm.patchValue({
title: book.metadata?.title || '', title: this.book.metadata?.title || '',
author: book.metadata?.authors && book.metadata?.authors.length > 0 ? book.metadata?.authors[0] : '' author: this.book.metadata?.authors?.[0] ?? ''
}); });
if (this.searchForm.valid) { if (this.searchForm.valid) {
@@ -78,36 +73,16 @@ export class CoverSearchComponent implements OnInit {
} }
onSearch() { onSearch() {
if (this.searchForm.valid) { if (!this.searchForm.valid) return;
this.loading.set(true);
this.coverImages = [];
const request: CoverFetchRequest = {
bookId: this.bookId,
title: this.searchForm.value.title,
author: this.searchForm.value.author,
coverType: this.coverType
};
this.bookCoverService.fetchBookCovers(request) const params: CoverSearchParams = {
.pipe(finalize(() => { bookId: this.bookId,
this.loading.set(false); title: this.searchForm.value.title,
this.hasSearched.set(true); author: this.searchForm.value.author,
})) coverType: this.coverType,
.subscribe({ };
next: (image) => { void this.queryClient.resetQueries({queryKey: this.sources.coverSearch(params).queryKey, exact: true});
this.coverImages.push(image); this.search.set(params);
this.coverImages.sort((a, b) => a.index - b.index);
},
error: (error) => {
console.error('Error fetching covers:', error);
}
});
} else {
console.log('Form invalid', {
formErrors: this.searchForm.errors,
titleErrors: this.searchForm.get('title')?.errors
});
}
} }
selectAndSave(image: CoverImage) { selectAndSave(image: CoverImage) {
@@ -138,7 +113,6 @@ export class CoverSearchComponent implements OnInit {
onClear() { onClear() {
this.searchForm.reset(); this.searchForm.reset();
this.coverImages = []; this.search.set(null);
this.hasSearched.set(false);
} }
} }
@@ -34,29 +34,33 @@
<td class="metadata-table-cell" style="max-width: 70px; width: 70px;"></td> <td class="metadata-table-cell" style="max-width: 70px; width: 70px;"></td>
<td class="metadata-table-cell set-all-label" style="max-width: 127px; width: 127px;">{{ t('setAll') }}</td> <td class="metadata-table-cell set-all-label" style="max-width: 127px; width: 127px;">{{ t('setAll') }}</td>
<td class="metadata-table-cell"> <td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP1" <p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP1"
(ngModelChange)="setBulkProvider('p1', $event)" (ngModelChange)="setBulkProvider('p1', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP1')" appendTo="body" [placeholder]="t('setAllP1')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell"> <td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP2" <p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP2"
(ngModelChange)="setBulkProvider('p2', $event)" (ngModelChange)="setBulkProvider('p2', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP2')" appendTo="body" [placeholder]="t('setAllP2')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell"> <td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP3" <p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP3"
(ngModelChange)="setBulkProvider('p3', $event)" (ngModelChange)="setBulkProvider('p3', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP3')" appendTo="body" [placeholder]="t('setAllP3')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell"> <td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP4" <p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP4"
(ngModelChange)="setBulkProvider('p4', $event)" (ngModelChange)="setBulkProvider('p4', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP4')" appendTo="body" [placeholder]="t('setAllP4')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
@@ -73,28 +77,36 @@
</td> </td>
<td class="metadata-table-cell-sm field-label" style="max-width: 127px; width: 127px;">{{ formatLabel(field) }}</td> <td class="metadata-table-cell-sm field-label" style="max-width: 127px; width: 127px;">{{ formatLabel(field) }}</td>
<td class="metadata-table-cell-sm"> <td class="metadata-table-cell-sm">
<p-select [options]="providers" [(ngModel)]="fieldOptions[field].p1" <p-select [options]="providerOptionsFor(fieldOptions[field].p1)" [(ngModel)]="fieldOptions[field].p1"
optionDisabled="disabled"
optionLabel="label" optionValue="value"
[disabled]="!enabledFields[field]" [disabled]="!enabledFields[field]"
[placeholder]="t('unset')" appendTo="body" [placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell-sm"> <td class="metadata-table-cell-sm">
<p-select [options]="providers" [(ngModel)]="fieldOptions[field].p2" <p-select [options]="providerOptionsFor(fieldOptions[field].p2)" [(ngModel)]="fieldOptions[field].p2"
optionDisabled="disabled"
optionLabel="label" optionValue="value"
[disabled]="!enabledFields[field]" [disabled]="!enabledFields[field]"
[placeholder]="t('unset')" appendTo="body" [placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell-sm"> <td class="metadata-table-cell-sm">
<p-select [options]="providers" [(ngModel)]="fieldOptions[field].p3" <p-select [options]="providerOptionsFor(fieldOptions[field].p3)" [(ngModel)]="fieldOptions[field].p3"
optionDisabled="disabled"
optionLabel="label" optionValue="value"
[disabled]="!enabledFields[field]" [disabled]="!enabledFields[field]"
[placeholder]="t('unset')" appendTo="body" [placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
</p-select> </p-select>
</td> </td>
<td class="metadata-table-cell-sm"> <td class="metadata-table-cell-sm">
<p-select [options]="providers" [(ngModel)]="fieldOptions[field].p4" <p-select [options]="providerOptionsFor(fieldOptions[field].p4)" [(ngModel)]="fieldOptions[field].p4"
optionDisabled="disabled"
optionLabel="label" optionValue="value"
[disabled]="!enabledFields[field]" [disabled]="!enabledFields[field]"
[placeholder]="t('unset')" appendTo="body" [placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small"> class="select-full-width" size="small">
@@ -109,7 +121,7 @@
<h3 class="section-title">{{ t('providerSpecificFields') }}</h3> <h3 class="section-title">{{ t('providerSpecificFields') }}</h3>
<p class="section-description">{{ t('providerSpecificDescription') }}</p> <p class="section-description">{{ t('providerSpecificDescription') }}</p>
<div class="fields-grid"> <div class="fields-grid">
@for (field of providerSpecificFields; track field) { @for (field of providerSpecificFields(); track field) {
<div class="field-card"> <div class="field-card">
<p-checkbox [(ngModel)]="enabledFields[field]" [binary]="true" <p-checkbox [(ngModel)]="enabledFields[field]" [binary]="true"
[pTooltip]="t('enableFieldTooltip')" [pTooltip]="t('enableFieldTooltip')"
@@ -1,4 +1,7 @@
import {SimpleChange} from '@angular/core'; import {of} from 'rxjs';
import {METADATA_PROVIDER_LIST, type MetadataProviderId} from '../../../../../shared/metadata/metadata-providers';
import {MetadataSourceQueryService} from '../../../sources/metadata-source-query.service';
import {computed, signal, SimpleChange} from '@angular/core';
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
import {beforeEach, describe, expect, it, vi} from 'vitest'; import {beforeEach, describe, expect, it, vi} from 'vitest';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
@@ -7,18 +10,28 @@ import {TranslocoService} from '@jsverse/transloco';
import {FieldOptions, MetadataRefreshOptions} from '../../../model/request/metadata-refresh-options.model'; import {FieldOptions, MetadataRefreshOptions} from '../../../model/request/metadata-refresh-options.model';
import {MetadataAdvancedFetchOptionsComponent} from './metadata-advanced-fetch-options.component'; import {MetadataAdvancedFetchOptionsComponent} from './metadata-advanced-fetch-options.component';
function providersWhereEnabled(isEnabled: (id: MetadataProviderId) => boolean) {
return METADATA_PROVIDER_LIST.map(provider => ({...provider, enabled: isEnabled(provider.id)}));
}
describe('MetadataAdvancedFetchOptionsComponent', () => { describe('MetadataAdvancedFetchOptionsComponent', () => {
const providers = signal(providersWhereEnabled(() => true));
const add = vi.fn(); const add = vi.fn();
const translate = vi.fn((key: string) => `translated:${key}`); const translate = vi.fn((key: string) => `translated:${key}`);
beforeEach(() => { beforeEach(() => {
providers.set(providersWhereEnabled(() => true));
add.mockClear(); add.mockClear();
translate.mockClear(); translate.mockClear();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{provide: MetadataSourceQueryService, useValue: {
providers: providers.asReadonly(),
enabledProviders: computed(() => providers().filter(provider => provider.enabled)),
}},
{provide: MessageService, useValue: {add}}, {provide: MessageService, useValue: {add}},
{provide: TranslocoService, useValue: {translate}}, {provide: TranslocoService, useValue: {translate, langChanges$: of('en'), getActiveLang: () => 'en'}},
] ]
}); });
}); });
@@ -66,8 +79,13 @@ describe('MetadataAdvancedFetchOptionsComponent', () => {
it('emits metadata options when all enabled non-provider fields have a provider', () => { it('emits metadata options when all enabled non-provider fields have a provider', () => {
const component = createComponent(); const component = createComponent();
const emit = vi.spyOn(component.metadataOptionsSubmitted, 'emit'); const emit = vi.spyOn(component.metadataOptionsSubmitted, 'emit');
providers.set(providersWhereEnabled(id => id === 'GoodReads'));
expect(component.providerOptionsFor('Google')).toEqual([
{value: 'GoodReads', label: 'translated:metadata.providers.goodReads'},
{value: 'Google', label: 'translated:metadata.advancedFetchOptions.inactiveProvider', disabled: true},
]);
for (const field of component.fields) { for (const field of component.fields()) {
component.enabledFields[field] = false; component.enabledFields[field] = false;
} }
component.fieldOptions.title.p1 = 'Google'; component.fieldOptions.title.p1 = 'Google';
@@ -1,4 +1,5 @@
import {Component, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges} from '@angular/core'; import {Component, computed, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {Select} from '@openng/optimus-ui/select'; import {Select} from '@openng/optimus-ui/select';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
@@ -13,6 +14,10 @@ import {
import {Tooltip} from '@openng/optimus-ui/tooltip'; import {Tooltip} from '@openng/optimus-ui/tooltip';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {MetadataProviderFieldsService} from '../../../../../shared/metadata';
import type {MetadataProviderId} from '../../../../../shared/metadata/metadata-providers';
import {MetadataSourceQueryService} from '../../../sources/metadata-source-query.service';
@Component({ @Component({
selector: 'app-metadata-advanced-fetch-options', selector: 'app-metadata-advanced-fetch-options',
templateUrl: './metadata-advanced-fetch-options.component.html', templateUrl: './metadata-advanced-fetch-options.component.html',
@@ -22,72 +27,50 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
}) })
export class MetadataAdvancedFetchOptionsComponent implements OnChanges { export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
private messageService = inject(MessageService);
private readonly t = inject(TranslocoService);
private readonly sources = inject(MetadataSourceQueryService);
private readonly providerFields = inject(MetadataProviderFieldsService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
@Output() metadataOptionsSubmitted = new EventEmitter<MetadataRefreshOptions>(); @Output() metadataOptionsSubmitted = new EventEmitter<MetadataRefreshOptions>();
@Input() currentMetadataOptions!: MetadataRefreshOptions; @Input() currentMetadataOptions!: MetadataRefreshOptions;
@Input() submitButtonLabel!: string; @Input() submitButtonLabel!: string;
fields: (keyof FieldOptions)[] = [
'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate',
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover', 'pageCount',
'openlibraryId',
'asin', 'amazonRating', 'amazonReviewCount',
'googleId',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating',
'audibleId', 'audibleRating', 'audibleReviewCount',
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
];
providerSpecificFields: (keyof FieldOptions)[] = [
'openlibraryId',
'asin', 'amazonRating', 'amazonReviewCount',
'googleId',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating',
'audibleId', 'audibleRating', 'audibleReviewCount',
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
];
nonProviderSpecificFields: (keyof FieldOptions)[] = [ nonProviderSpecificFields: (keyof FieldOptions)[] = [
'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate', 'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate',
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10', 'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover', 'pageCount', 'language', 'categories', 'cover', 'pageCount',
]; ];
providers: string[] = [ readonly providerSpecificFields = computed<(keyof FieldOptions)[]>(() => [
'OpenLibrary', ...this.providerFields.fields().map(field => field.name),
'Amazon', 'moods', 'tags',
'Google', ]);
'GoodReads',
'Hardcover', readonly fields = computed<(keyof FieldOptions)[]>(() => [...this.nonProviderSpecificFields, ...this.providerSpecificFields()]);
'Comicvine',
'Douban', readonly providerOptions = computed(() => this.sources.enabledProviders().map(provider => ({
'Lubimyczytac', value: provider.id,
'Ranobedb', label: this.t.translate(provider.labelKey, {}, this.activeLang()),
'Audible', })));
'AppleBooks' readonly providerOptionsWithClear = computed(() => [
]; {value: 'Clear All', label: 'Clear All'},
providersWithClear: string[] = [ ...this.providerOptions(),
'Clear All', ]);
'OpenLibrary',
'Amazon', providerOptionsFor(selected: string | null) {
'Google', const enabled = this.providerOptions();
'GoodReads', if (!selected || enabled.some(option => option.value === selected)) return enabled;
'Hardcover',
'Comicvine', const provider = this.sources.providers().find(provider => provider.id === selected);
'Douban', const label = provider ? this.t.translate(provider.labelKey, {}, this.activeLang()) : selected;
'Lubimyczytac', return [...enabled, {
'Ranobedb', value: selected,
'Audible', label: this.t.translate('metadata.advancedFetchOptions.inactiveProvider', {provider: label}, this.activeLang()),
'AppleBooks' disabled: true,
]; }];
}
refreshCovers: boolean = false; refreshCovers: boolean = false;
mergeCategories: boolean = false; mergeCategories: boolean = false;
@@ -110,55 +93,17 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
bulkP3: string | null = null; bulkP3: string | null = null;
bulkP4: string | null = null; bulkP4: string | null = null;
private messageService = inject(MessageService);
private readonly t = inject(TranslocoService);
private justSubmitted = false; private justSubmitted = false;
private providerSpecificFieldsList = [
// OpenLibrary
'openlibraryId',
// Amazon
'asin', 'amazonRating', 'amazonReviewCount',
// Google
'googleId',
// Goodreads
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
// Hardcover
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
// Comicvine
'comicvineId',
// Lubimyczytac
'lubimyczytacId', 'lubimyczytacRating',
// Ranobedb
'ranobedbId', 'ranobedbRating',
// Audible
'audibleId', 'audibleRating', 'audibleReviewCount',
// Apple Books
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
// Generic provider-specific
'moods', 'tags'
];
private initializeFieldOptions(): FieldOptions { private initializeFieldOptions(): FieldOptions {
return this.fields.reduce((acc, field) => { return this.fields().reduce((acc, field) => {
acc[field] = {p1: null, p2: null, p3: null, p4: null}; acc[field] = {p1: null, p2: null, p3: null, p4: null};
return acc; return acc;
}, {} as FieldOptions); }, {} as FieldOptions);
} }
private initializeEnabledFields(): Record<keyof FieldOptions, boolean> { private initializeEnabledFields(): Record<keyof FieldOptions, boolean> {
return this.fields.reduce((acc, field) => { return this.fields().reduce((acc, field) => {
acc[field] = true; acc[field] = true;
return acc; return acc;
}, {} as Record<keyof FieldOptions, boolean>); }, {} as Record<keyof FieldOptions, boolean>);
@@ -172,7 +117,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
this.replaceMode = this.currentMetadataOptions.replaceMode || 'REPLACE_MISSING'; this.replaceMode = this.currentMetadataOptions.replaceMode || 'REPLACE_MISSING';
const backendFieldOptions = this.deepCloneFieldOptions(this.currentMetadataOptions.fieldOptions as FieldOptions || {}); const backendFieldOptions = this.deepCloneFieldOptions(this.currentMetadataOptions.fieldOptions as FieldOptions || {});
for (const field of this.fields) { for (const field of this.fields()) {
if (!backendFieldOptions[field]) { if (!backendFieldOptions[field]) {
backendFieldOptions[field] = {p1: null, p2: null, p3: null, p4: null}; backendFieldOptions[field] = {p1: null, p2: null, p3: null, p4: null};
} else { } else {
@@ -191,7 +136,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
private deepCloneFieldOptions(fieldOptions: FieldOptions): FieldOptions { private deepCloneFieldOptions(fieldOptions: FieldOptions): FieldOptions {
const cloned = {} as FieldOptions; const cloned = {} as FieldOptions;
for (const field of this.fields) { for (const field of this.fields()) {
cloned[field] = { cloned[field] = {
p1: fieldOptions[field]?.p1 || null, p1: fieldOptions[field]?.p1 || null,
p2: fieldOptions[field]?.p2 || null, p2: fieldOptions[field]?.p2 || null,
@@ -237,7 +182,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
} }
} }
setBulkProvider(priority: 'p1' | 'p2' | 'p3' | 'p4', provider: string | null): void { setBulkProvider(priority: 'p1' | 'p2' | 'p3' | 'p4', provider: MetadataProviderId | 'Clear All' | null): void {
if (!provider) return; if (!provider) return;
const value = provider === 'Clear All' ? null : provider; const value = provider === 'Clear All' ? null : provider;
@@ -303,37 +248,19 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'pageCount': 'Page Count', 'pageCount': 'Page Count',
'rating': 'Rating', 'rating': 'Rating',
'reviewCount': 'Review Count', 'reviewCount': 'Review Count',
'openlibraryId': 'OpenLibrary ID',
'asin': 'Amazon ASIN',
'goodreadsId': 'Goodreads ID',
'comicvineId': 'Comicvine ID',
'hardcoverId': 'Hardcover ID',
'hardcoverBookId': 'Hardcover Book ID',
'googleId': 'Google Books ID',
'amazonRating': 'Amazon Rating',
'amazonReviewCount': 'Amazon Review Count',
'goodreadsRating': 'Goodreads Rating',
'goodreadsReviewCount': 'Goodreads Review Count',
'hardcoverRating': 'Hardcover Rating',
'hardcoverReviewCount': 'Hardcover Review Count',
'lubimyczytacId': 'Lubimyczytac ID',
'lubimyczytacRating': 'Lubimyczytac Rating',
'ranobedbId': 'Ranobedb ID',
'ranobedbRating': 'Ranobedb Rating',
'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)', 'moods': 'Moods (Hardcover)',
'tags': 'Tags (Hardcover)' 'tags': 'Tags (Hardcover)'
}; };
return fieldLabels[field] || field.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase()).trim(); if (fieldLabels[field]) return fieldLabels[field];
const providerField = this.providerFields.fields().find(providerField => providerField.name === field);
return providerField
? this.providerFields.label(providerField.name)
: field.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase()).trim();
} }
isProviderSpecificField(field: keyof FieldOptions): boolean { isProviderSpecificField(field: keyof FieldOptions): boolean {
return this.providerSpecificFieldsList.includes(field as string); return this.providerSpecificFields().includes(field);
} }
} }
@@ -12,21 +12,21 @@
<div class="section-body"> <div class="section-body">
<div class="provider-groups-container"> <div class="provider-groups-container">
@for (group of providerGroups; track group.labelKey) { @for (group of providerGroups(); track group.label) {
<div class="provider-group"> <div class="provider-group">
<div class="group-header"> <div class="group-header">
<span class="group-icon pi pi-database"></span> <span class="group-icon pi pi-database"></span>
<h4 class="group-label">{{ getProviderLabel(group.labelKey) }}</h4> <h4 class="group-label">{{ group.label }}</h4>
</div> </div>
<div class="field-list"> <div class="field-list">
@for (field of group.fields; track field) { @for (field of group.fields; track field.name) {
<div class="field-item"> <div class="field-item">
<p-toggleswitch <p-toggleswitch
[inputId]="field" [inputId]="field.name"
[ngModel]="selectedFields.includes(field)" [ngModel]="selectedFields.includes(field.name)"
(ngModelChange)="toggleField(field, $event)"> (ngModelChange)="toggleField(field.name, $event)">
</p-toggleswitch> </p-toggleswitch>
<label [for]="field">{{ getFieldLabel(field) }}</label> <label [for]="field.name">{{ field.label }}</label>
</div> </div>
} }
</div> </div>
@@ -64,12 +64,17 @@ describe('MetadataProviderFieldSelectorComponent', () => {
}]); }]);
}); });
it('translates provider and field labels through Transloco', () => { it('groups the provider fields by provider, with translated labels', () => {
const fixture = TestBed.createComponent(MetadataProviderFieldSelectorComponent); const fixture = TestBed.createComponent(MetadataProviderFieldSelectorComponent);
const component = fixture.componentInstance; const component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
expect(component.getProviderLabel('amazon')).toBe('Amazon'); const amazon = component.providerGroups().find(group => group.label === 'Amazon');
expect(component.getFieldLabel('asin')).toBeDefined();
expect(amazon?.fields).toEqual([
{name: 'asin', label: 'Amazon ASIN'},
{name: 'amazonRating', label: 'Amazon Rating'},
{name: 'amazonReviewCount', label: 'Amazon Review Count'},
]);
}); });
}); });
@@ -1,8 +1,11 @@
import {Component, effect, inject, Input} from '@angular/core'; import {Component, computed, effect, inject, Input} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {ToggleSwitch} from '@openng/optimus-ui/toggleswitch'; import {ToggleSwitch} from '@openng/optimus-ui/toggleswitch';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {AppSettingKey, MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model'; import {AppSettingKey, MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model';
import {MetadataProviderFieldsService, providerFieldRecord} from '../../../../shared/metadata';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
@Component({ @Component({
@@ -17,40 +20,25 @@ export class MetadataProviderFieldSelectorComponent {
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private t = inject(TranslocoService); private t = inject(TranslocoService);
private catalog = inject(MetadataCatalogService);
private providerFields = inject(MetadataProviderFieldsService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
providerGroups: { labelKey: string, fields: string[] }[] = [ readonly providerGroups = computed(() => {
{labelKey: 'openlibrary', fields: ['openlibraryId']}, const lang = this.activeLang();
{labelKey: 'amazon', fields: ['asin', 'amazonRating', 'amazonReviewCount']}, return this.catalog.providers()
{labelKey: 'googleBooks', fields: ['googleId']}, .filter(provider => provider.book)
{labelKey: 'goodreads', fields: ['goodreadsId', 'goodreadsRating', 'goodreadsReviewCount']}, .map(provider => ({
{labelKey: 'hardcover', fields: ['hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount']}, label: this.t.translate(provider.labelKey, {}, lang),
{labelKey: 'audible', fields: ['audibleId', 'audibleRating', 'audibleReviewCount']}, fields: this.providerFields.fields()
{labelKey: 'applebooks', fields: ['applebooksId', 'applebooksRating', 'applebooksReviewCount']}, .filter(field => field.provider === provider.id)
{labelKey: 'comicvine', fields: ['comicvineId']}, .map(field => ({name: field.name, label: this.providerFields.label(field.name)})),
{labelKey: 'lubimyczytac', fields: ['lubimyczytacId', 'lubimyczytacRating']}, }));
{labelKey: 'ranobedb', fields: ['ranobedbId', 'ranobedbRating']} });
];
getProviderLabel(key: string): string { private readonly allFieldNames = computed<(keyof MetadataProviderSpecificFields)[]>(
return this.t.translate('settingsMeta.fieldSelector.providers.' + key); () => this.providerFields.fields().map(field => field.name),
} );
getFieldLabel(field: string): string {
return this.t.translate('settingsMeta.fieldSelector.fields.' + field);
}
private readonly allFieldNames: (keyof MetadataProviderSpecificFields)[] = [
'openlibraryId',
'asin', 'amazonRating', 'amazonReviewCount',
'googleId',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating',
'audibleId', 'audibleRating', 'audibleReviewCount',
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
];
private readonly syncSettingsEffect = effect(() => { private readonly syncSettingsEffect = effect(() => {
const settings = this.appSettingsService.appSettings(); const settings = this.appSettingsService.appSettings();
@@ -81,10 +69,6 @@ export class MetadataProviderFieldSelectorComponent {
} }
private toFieldState(selectedFields: string[]): MetadataProviderSpecificFields { private toFieldState(selectedFields: string[]): MetadataProviderSpecificFields {
const fieldState = {} as MetadataProviderSpecificFields; return providerFieldRecord(this.providerFields.fields(), field => selectedFields.includes(field.name));
for (const field of this.allFieldNames) {
fieldState[field] = selectedFields.includes(field);
}
return fieldState;
} }
} }
@@ -1,4 +0,0 @@
export interface MetadataProvider {
name: string;
enabled: boolean;
}
@@ -1,19 +0,0 @@
import {describe, expect, expectTypeOf, it} from 'vitest';
import {FetchMetadataRequest} from './fetch-metadata-request.model';
describe('fetch-metadata-request.model', () => {
it('captures the metadata fetch payload shape', () => {
const request: FetchMetadataRequest = {
bookId: 12,
providers: ['google', 'hardcover'],
title: 'A Wizard of Earthsea',
author: 'Ursula K. Le Guin',
isbn: '9780547773742'
};
expect(request.providers).toContain('google');
expect(request.bookId).toBe(12);
expectTypeOf(request.providers).toEqualTypeOf<string[]>();
});
});
@@ -1,7 +0,0 @@
export interface FetchMetadataRequest {
bookId: number,
providers: string[],
title: string,
author: string,
isbn: string
}
@@ -1,4 +1,5 @@
import {describe, expect, expectTypeOf, it} from 'vitest'; import {describe, expect, expectTypeOf, it} from 'vitest';
import type {MetadataProviderId} from '../../../../shared/metadata/metadata-providers';
import { import {
FieldOptions, FieldOptions,
@@ -7,7 +8,7 @@ import {
MetadataReplaceMode MetadataReplaceMode
} from './metadata-refresh-options.model'; } from './metadata-refresh-options.model';
const provider = (value: string | null): FieldProvider => ({ const provider = (value: MetadataProviderId | null): FieldProvider => ({
p4: value, p4: value,
p3: value, p3: value,
p2: value, p2: value,
@@ -17,46 +18,46 @@ const provider = (value: string | null): FieldProvider => ({
describe('metadata-refresh-options.model', () => { describe('metadata-refresh-options.model', () => {
it('supports replace-mode driven refresh settings', () => { it('supports replace-mode driven refresh settings', () => {
const fieldOptions: FieldOptions = { const fieldOptions: FieldOptions = {
openlibraryId: provider('openlibrary'), openlibraryId: provider('OpenLibrary'),
title: provider('google'), title: provider('Google'),
description: provider('google'), description: provider('Google'),
authors: provider('google'), authors: provider('Google'),
categories: provider('google'), categories: provider('Google'),
cover: provider('google'), cover: provider('Google'),
subtitle: provider('google'), subtitle: provider('Google'),
publisher: provider('google'), publisher: provider('Google'),
publishedDate: provider('google'), publishedDate: provider('Google'),
seriesName: provider('google'), seriesName: provider('Google'),
seriesNumber: provider('google'), seriesNumber: provider('Google'),
seriesTotal: provider('google'), seriesTotal: provider('Google'),
isbn13: provider('google'), isbn13: provider('Google'),
isbn10: provider('google'), isbn10: provider('Google'),
language: provider('google'), language: provider('Google'),
pageCount: provider('google'), pageCount: provider('Google'),
asin: provider('google'), asin: provider('Google'),
goodreadsId: provider('goodreads'), goodreadsId: provider('GoodReads'),
comicvineId: provider(null), comicvineId: provider(null),
hardcoverId: provider('hardcover'), hardcoverId: provider('Hardcover'),
hardcoverBookId: provider('hardcover'), hardcoverBookId: provider('Hardcover'),
googleId: provider('google'), googleId: provider('Google'),
lubimyczytacId: provider(null), lubimyczytacId: provider(null),
amazonRating: provider('amazon'), amazonRating: provider('Amazon'),
amazonReviewCount: provider('amazon'), amazonReviewCount: provider('Amazon'),
goodreadsRating: provider('goodreads'), goodreadsRating: provider('GoodReads'),
goodreadsReviewCount: provider('goodreads'), goodreadsReviewCount: provider('GoodReads'),
hardcoverRating: provider('hardcover'), hardcoverRating: provider('Hardcover'),
hardcoverReviewCount: provider('hardcover'), hardcoverReviewCount: provider('Hardcover'),
lubimyczytacRating: provider(null), lubimyczytacRating: provider(null),
ranobedbId: provider(null), ranobedbId: provider(null),
ranobedbRating: provider(null), ranobedbRating: provider(null),
audibleId: provider('audible'), audibleId: provider('Audible'),
audibleRating: provider('audible'), audibleRating: provider('Audible'),
audibleReviewCount: provider('audible'), audibleReviewCount: provider('Audible'),
applebooksId: provider('applebooks'), applebooksId: provider('AppleBooks'),
applebooksRating: provider('applebooks'), applebooksRating: provider('AppleBooks'),
applebooksReviewCount: provider('applebooks'), applebooksReviewCount: provider('AppleBooks'),
moods: provider('google'), moods: provider('Google'),
tags: provider('google') tags: provider('Google')
}; };
const options: MetadataRefreshOptions = { const options: MetadataRefreshOptions = {
@@ -110,7 +111,7 @@ describe('metadata-refresh-options.model', () => {
} }
}; };
expect(options.fieldOptions?.title.p4).toBe('google'); expect(options.fieldOptions?.title.p4).toBe('Google');
expect(options.enabledFields?.subtitle).toBe(false); expect(options.enabledFields?.subtitle).toBe(false);
expectTypeOf(options.replaceMode).toEqualTypeOf<MetadataReplaceMode | undefined>(); expectTypeOf(options.replaceMode).toEqualTypeOf<MetadataReplaceMode | undefined>();
}); });
@@ -1,3 +1,5 @@
import type {MetadataProviderFieldRecord} from '../../../../shared/metadata/metadata-provider-fields';
export type MetadataReplaceMode = 'REPLACE_ALL' | 'REPLACE_MISSING' | 'REPLACE_WHEN_PROVIDED'; export type MetadataReplaceMode = 'REPLACE_ALL' | 'REPLACE_MISSING' | 'REPLACE_WHEN_PROVIDED';
export interface MetadataRefreshOptions { export interface MetadataRefreshOptions {
@@ -22,7 +24,7 @@ export interface FieldProvider {
p1: string | null; p1: string | null;
} }
export interface FieldOptions { interface GenericFieldOptions {
title: FieldProvider; title: FieldProvider;
description: FieldProvider; description: FieldProvider;
authors: FieldProvider; authors: FieldProvider;
@@ -38,29 +40,8 @@ export interface FieldOptions {
isbn10: FieldProvider; isbn10: FieldProvider;
language: FieldProvider; language: FieldProvider;
pageCount: FieldProvider; pageCount: FieldProvider;
openlibraryId: FieldProvider;
asin: FieldProvider;
goodreadsId: FieldProvider;
comicvineId: FieldProvider;
hardcoverId: FieldProvider;
hardcoverBookId: FieldProvider;
googleId: FieldProvider;
lubimyczytacId: FieldProvider;
amazonRating: FieldProvider;
amazonReviewCount: FieldProvider;
goodreadsRating: FieldProvider;
goodreadsReviewCount: FieldProvider;
hardcoverRating: FieldProvider;
hardcoverReviewCount: FieldProvider;
lubimyczytacRating: FieldProvider;
ranobedbId: FieldProvider;
ranobedbRating: FieldProvider;
audibleId: FieldProvider;
audibleRating: FieldProvider;
audibleReviewCount: FieldProvider;
applebooksId: FieldProvider;
applebooksRating: FieldProvider;
applebooksReviewCount: FieldProvider;
moods: FieldProvider; moods: FieldProvider;
tags: FieldProvider; tags: FieldProvider;
} }
export type FieldOptions = GenericFieldOptions & MetadataProviderFieldRecord<FieldProvider>;
@@ -1,48 +0,0 @@
import {provideHttpClient} from '@angular/common/http';
import {HttpTestingController, provideHttpClientTesting} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {AuthService} from '../../../shared/service/auth.service';
import {MetadataProviderService} from './metadata-provider.service';
describe('MetadataProviderService', () => {
let service: MetadataProviderService;
let httpTestingController: HttpTestingController;
let authService: {getInternalAccessToken: ReturnType<typeof vi.fn>};
beforeEach(() => {
authService = {
getInternalAccessToken: vi.fn(() => 'token-123'),
};
TestBed.configureTestingModule({
providers: [
provideHttpClient(),
provideHttpClientTesting(),
MetadataProviderService,
{provide: AuthService, useValue: authService},
],
});
service = TestBed.inject(MetadataProviderService);
httpTestingController = TestBed.inject(HttpTestingController);
});
afterEach(() => {
httpTestingController.verify();
TestBed.resetTestingModule();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
it('requests provider detail through HTTP endpoints', () => {
service.fetchMetadataDetail('google', 'abc123').subscribe();
const detailRequest = httpTestingController.expectOne(req =>
req.url.endsWith('v1/metadata/providers/google/fetch/abc123')
);
expect(detailRequest.request.method).toBe('GET');
detailRequest.flush({});
});
});
@@ -1,20 +0,0 @@
import {inject, Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {API_CONFIG} from '../../../core/config/api-config';
import {BookMetadata} from '../../book/model/book.model';
import {MetadataProvider} from '../model/metadata-provider.model';
import {HttpClient} from '@angular/common/http';
@Injectable({providedIn: 'root'})
export class MetadataProviderService {
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/metadata/providers`;
private http = inject(HttpClient);
fetchMetadataProviders(): Observable<MetadataProvider[]> {
return this.http.get<MetadataProvider[]>(`${this.url}`);
}
fetchMetadataDetail(provider: string, providerItemId: string): Observable<BookMetadata> {
return this.http.get<BookMetadata>(`${this.url}/${provider}/fetch/${providerItemId}`);
}
}
@@ -35,31 +35,6 @@ describe('SidecarService', () => {
TestBed.resetTestingModule(); TestBed.resetTestingModule();
}); });
it('fetches sidecar content for a book', () => {
service.getSidecarContent(42).subscribe(response => {
expect(response.metadata.title).toBe('Book');
});
const request = httpTestingController.expectOne(`${API_CONFIG.BASE_URL}/api/v1/books/42/sidecar`);
expect(request.request.method).toBe('GET');
request.flush({
version: '1',
generatedAt: '2026-03-26T00:00:00Z',
generatedBy: 'test',
metadata: {title: 'Book'},
});
});
it('fetches the sidecar sync status', () => {
service.getSyncStatus(42).subscribe(response => {
expect(response).toEqual({status: 'CONFLICT'});
});
const request = httpTestingController.expectOne(`${API_CONFIG.BASE_URL}/api/v1/books/42/sidecar/status`);
expect(request.request.method).toBe('GET');
request.flush({status: 'CONFLICT'});
});
it('exports a sidecar for a book', () => { it('exports a sidecar for a book', () => {
service.exportToSidecar(42).subscribe(response => { service.exportToSidecar(42).subscribe(response => {
expect(response).toEqual({message: 'ok'}); expect(response).toEqual({message: 'ok'});
@@ -7,78 +7,6 @@ import {API_CONFIG} from '../../../core/config/api-config';
import {invalidateAllBookCaches, invalidateBooksById} from '../../book/service/legacy-book-cache'; import {invalidateAllBookCaches, invalidateBooksById} from '../../book/service/legacy-book-cache';
import {invalidateAuthorsQuery} from '../../author-browser/service/author-query-cache'; import {invalidateAuthorsQuery} from '../../author-browser/service/author-query-cache';
export interface SidecarCoverInfo {
source: string;
path: string;
}
export interface SidecarSeries {
name?: string;
number?: number;
total?: number;
}
export interface SidecarIdentifiers {
asin?: string;
goodreadsId?: string;
googleId?: string;
hardcoverId?: string;
comicvineId?: string;
lubimyczytacId?: string;
ranobedbId?: string;
audibleId?: string;
applebooksId?: string;
openlibraryId?: string;
}
export interface SidecarRating {
average?: number;
count?: number;
}
export interface SidecarRatings {
amazon?: SidecarRating;
goodreads?: SidecarRating;
hardcover?: SidecarRating;
lubimyczytac?: SidecarRating;
ranobedb?: SidecarRating;
audible?: SidecarRating;
applebooks?: SidecarRating;
}
export interface SidecarBookMetadata {
title?: string;
subtitle?: string;
authors?: string[];
publisher?: string;
publishedDate?: string;
description?: string;
isbn10?: string;
isbn13?: string;
language?: string;
pageCount?: number;
categories?: string[];
moods?: string[];
tags?: string[];
series?: SidecarSeries;
identifiers?: SidecarIdentifiers;
ratings?: SidecarRatings;
ageRating?: number;
contentRating?: string;
narrator?: string;
abridged?: boolean;
}
export interface SidecarMetadata {
version: string;
generatedAt: string;
generatedBy: string;
metadata: SidecarBookMetadata;
cover?: SidecarCoverInfo;
}
export type SidecarSyncStatus = 'IN_SYNC' | 'OUTDATED' | 'MISSING' | 'CONFLICT' | 'NOT_APPLICABLE';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -87,14 +15,6 @@ export class SidecarService {
private queryClient = inject(QueryClient); private queryClient = inject(QueryClient);
private readonly apiUrl = `${API_CONFIG.BASE_URL}/api/v1`; private readonly apiUrl = `${API_CONFIG.BASE_URL}/api/v1`;
getSidecarContent(bookId: number): Observable<SidecarMetadata> {
return this.http.get<SidecarMetadata>(`${this.apiUrl}/books/${bookId}/sidecar`);
}
getSyncStatus(bookId: number): Observable<{status: SidecarSyncStatus}> {
return this.http.get<{status: SidecarSyncStatus}>(`${this.apiUrl}/books/${bookId}/sidecar/status`);
}
exportToSidecar(bookId: number): Observable<{message: string}> { exportToSidecar(bookId: number): Observable<{message: string}> {
return this.http.post<{message: string}>(`${this.apiUrl}/books/${bookId}/sidecar/export`, {}); return this.http.post<{message: string}>(`${this.apiUrl}/books/${bookId}/sidecar/export`, {});
} }
@@ -116,29 +116,17 @@
</div> </div>
} }
@if (metadata?.rating || metadata?.goodreadsRating || metadata?.amazonRating) { @if (providerRatings.length > 0) {
<div class="metadata-group"> <div class="metadata-group">
<h3 class="section-title">{{ t('ratings') }}</h3> <h3 class="section-title">{{ t('ratings') }}</h3>
@if (metadata?.goodreadsRating) { @for (entry of providerRatings; track entry.labelKey) {
<div class="metadata-item"> <div class="metadata-item">
<span class="label">Goodreads</span> <span class="label">{{ entry.labelKey | transloco }}</span>
<span class="value"> <span class="value">
&#11088; {{ metadata?.goodreadsRating?.toFixed(2) }} &#11088; {{ entry.rating.toFixed(2) }}
@if (metadata?.goodreadsReviewCount) { @if (entry.reviewCount) {
<span class="review-count">({{ metadata?.goodreadsReviewCount }} {{ t('reviews') }})</span> <span class="review-count">({{ entry.reviewCount }} {{ t('reviews') }})</span>
}
</span>
</div>
}
@if (metadata?.amazonRating) {
<div class="metadata-item">
<span class="label">Amazon</span>
<span class="value">
&#11088; {{ metadata?.amazonRating?.toFixed(2) }}
@if (metadata?.amazonReviewCount) {
<span class="review-count">({{ metadata?.amazonReviewCount }} {{ t('reviews') }})</span>
} }
</span> </span>
</div> </div>
@@ -17,7 +17,9 @@ describe('ReaderBookMetadataDialogComponent', () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ReaderBookMetadataDialogComponent, getTranslocoModule()], imports: [ReaderBookMetadataDialogComponent, getTranslocoModule()],
providers: [{provide: UrlHelperService, useValue: urlHelperService}], providers: [
{provide: UrlHelperService, useValue: urlHelperService},
],
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(ReaderBookMetadataDialogComponent); fixture = TestBed.createComponent(ReaderBookMetadataDialogComponent);
@@ -57,4 +59,5 @@ describe('ReaderBookMetadataDialogComponent', () => {
it('returns the raw date when parsing falls back after an invalid date string', () => { it('returns the raw date when parsing falls back after an invalid date string', () => {
expect(component.formatDate('not-a-date')).toBe('Invalid Date'); expect(component.formatDate('not-a-date')).toBe('Invalid Date');
}); });
}); });
@@ -1,14 +1,15 @@
import {Component, EventEmitter, inject, Input, Output} from '@angular/core'; import {Component, EventEmitter, inject, Input, Output} from '@angular/core';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
import {Book} from '../../../book/model/book.model'; import {Book} from '../../../book/model/book.model';
import {UrlHelperService} from '../../../../shared/service/url-helper.service'; import {UrlHelperService} from '../../../../shared/service/url-helper.service';
import {LanguageResolverService} from '../../../../shared/service/language-resolver.service'; import {LanguageResolverService} from '../../../../shared/service/language-resolver.service';
import {CoverComponent} from '../../../../shared/components/cover/cover.component'; import {CoverComponent} from '../../../../shared/components/cover/cover.component';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
@Component({ @Component({
selector: 'app-reader-book-metadata-dialog', selector: 'app-reader-book-metadata-dialog',
standalone: true, standalone: true,
imports: [TranslocoDirective, CoverComponent], imports: [TranslocoDirective, TranslocoPipe, CoverComponent],
templateUrl: './metadata-dialog.component.html', templateUrl: './metadata-dialog.component.html',
styleUrls: ['./metadata-dialog.component.scss'] styleUrls: ['./metadata-dialog.component.scss']
}) })
@@ -18,12 +19,23 @@ export class ReaderBookMetadataDialogComponent {
private urlHelperService = inject(UrlHelperService); private urlHelperService = inject(UrlHelperService);
private readonly t = inject(TranslocoService); private readonly t = inject(TranslocoService);
protected readonly catalog = inject(MetadataCatalogService);
protected readonly languageResolver = inject(LanguageResolverService); protected readonly languageResolver = inject(LanguageResolverService);
get metadata() { get metadata() {
return this.book?.metadata; return this.book?.metadata;
} }
get providerRatings() {
const metadata = this.metadata;
return this.catalog.providers().flatMap(provider => {
const rating = provider.book?.rating ? metadata?.[provider.book.rating] : undefined;
if (typeof rating !== 'number') return [];
const reviewCount = provider.book?.reviewCount ? metadata?.[provider.book.reviewCount] : undefined;
return [{labelKey: provider.labelKey, rating, reviewCount}];
});
}
get bookCoverUrl(): string | null { get bookCoverUrl(): string | null {
if (!this.book?.id) return null; if (!this.book?.id) return null;
const coverUpdatedOn = this.book.metadata?.coverUpdatedOn; const coverUpdatedOn = this.book.metadata?.coverUpdatedOn;
@@ -36,7 +36,7 @@
<form [formGroup]="form" class="weights-form"> <form [formGroup]="form" class="weights-form">
<div class="weights-grid"> <div class="weights-grid">
@for (key of orderedKeys; track key) { @for (key of orderedKeys(); track key) {
<div class="weight-field"> <div class="weight-field">
<label class="field-label" [for]="'metadata-weight-' + key">{{ getFieldLabel(key) }}</label> <label class="field-label" [for]="'metadata-weight-' + key">{{ getFieldLabel(key) }}</label>
<p-inputNumber <p-inputNumber
@@ -56,7 +56,7 @@ describe('MetadataMatchWeightsComponent', () => {
expect(component.form.get('title')?.value).toBe(10); expect(component.form.get('title')?.value).toBe(10);
expect(component.form.get('authors')?.value).toBe(9); expect(component.form.get('authors')?.value).toBe(9);
expect(component.orderedKeys[0]).toBe('title'); expect(component.orderedKeys()[0]).toBe('title');
}); });
it('hydrates the reactive form when weights resolve after initial render', () => { it('hydrates the reactive form when weights resolve after initial render', () => {
@@ -1,4 +1,4 @@
import {Component, DestroyRef, effect, inject} from '@angular/core'; import {Component, computed, DestroyRef, effect, inject} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms'; import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
@@ -7,8 +7,17 @@ import {Button} from '@openng/optimus-ui/button';
import {AppSettingKey, MetadataMatchWeights} from '../../../../shared/model/app-settings.model'; import {AppSettingKey, MetadataMatchWeights} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {InputNumber} from '@openng/optimus-ui/inputnumber'; import {InputNumber} from '@openng/optimus-ui/inputnumber';
import {MetadataProviderFieldsService} from '../../../../shared/metadata';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
const GENERIC_WEIGHT_KEYS = [
'title', 'subtitle', 'authors', 'description', 'publisher', 'publishedDate',
'categories', 'coverImage', 'seriesName', 'seriesNumber', 'seriesTotal',
'language', 'isbn13', 'isbn10', 'pageCount',
];
const DOUBAN_WEIGHT_KEYS = ['doubanRating', 'doubanReviewCount'];
@Component({ @Component({
selector: 'app-metadata-match-weights-component', selector: 'app-metadata-match-weights-component',
imports: [ imports: [
@@ -22,26 +31,24 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
}) })
export class MetadataMatchWeightsComponent { export class MetadataMatchWeightsComponent {
readonly orderedFieldKeys: string[] = [
'title', 'subtitle', 'authors', 'description', 'publisher', 'publishedDate',
'categories', 'coverImage', 'seriesName', 'seriesNumber', 'seriesTotal',
'language', 'isbn13', 'isbn10', 'pageCount',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'audibleRating', 'audibleReviewCount',
'doubanRating', 'doubanReviewCount', 'ranobedbRating'
];
private fb = inject(FormBuilder); private fb = inject(FormBuilder);
form: FormGroup = this.buildForm();
isSaving = false;
isRecalculating = false;
private weightsService = inject(MetadataMatchWeightsService); private weightsService = inject(MetadataMatchWeightsService);
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService); private messageService = inject(MessageService);
private t = inject(TranslocoService); private t = inject(TranslocoService);
private providerFields = inject(MetadataProviderFieldsService);
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
readonly orderedKeys = computed(() => [
...GENERIC_WEIGHT_KEYS,
...this.providerFields.scoreFields().map(field => field.name),
...DOUBAN_WEIGHT_KEYS,
]);
form: FormGroup = this.buildForm();
isSaving = false;
isRecalculating = false;
private readonly syncSettingsEffect = effect(() => { private readonly syncSettingsEffect = effect(() => {
const settings = this.appSettingsService.appSettings(); const settings = this.appSettingsService.appSettings();
if (settings?.metadataMatchWeights) { if (settings?.metadataMatchWeights) {
@@ -50,42 +57,14 @@ export class MetadataMatchWeightsComponent {
}); });
private buildForm(): FormGroup { private buildForm(): FormGroup {
return this.fb.group({ return this.fb.group(Object.fromEntries(
title: [0, [Validators.required, Validators.min(0)]], this.orderedKeys().map(key => [key, [0, [Validators.required, Validators.min(0)]]]),
subtitle: [0, [Validators.required, Validators.min(0)]], ));
description: [0, [Validators.required, Validators.min(0)]],
publisher: [0, [Validators.required, Validators.min(0)]],
publishedDate: [0, [Validators.required, Validators.min(0)]],
authors: [0, [Validators.required, Validators.min(0)]],
categories: [0, [Validators.required, Validators.min(0)]],
seriesName: [0, [Validators.required, Validators.min(0)]],
seriesNumber: [0, [Validators.required, Validators.min(0)]],
seriesTotal: [0, [Validators.required, Validators.min(0)]],
isbn13: [0, [Validators.required, Validators.min(0)]],
isbn10: [0, [Validators.required, Validators.min(0)]],
pageCount: [0, [Validators.required, Validators.min(0)]],
language: [0, [Validators.required, Validators.min(0)]],
amazonRating: [0, [Validators.required, Validators.min(0)]],
amazonReviewCount: [0, [Validators.required, Validators.min(0)]],
goodreadsRating: [0, [Validators.required, Validators.min(0)]],
goodreadsReviewCount: [0, [Validators.required, Validators.min(0)]],
hardcoverRating: [0, [Validators.required, Validators.min(0)]],
hardcoverReviewCount: [0, [Validators.required, Validators.min(0)]],
doubanRating: [0, [Validators.required, Validators.min(0)]],
doubanReviewCount: [0, [Validators.required, Validators.min(0)]],
ranobedbRating: [0, [Validators.required, Validators.min(0)]],
audibleRating: [0, [Validators.required, Validators.min(0)]],
audibleReviewCount: [0, [Validators.required, Validators.min(0)]],
coverImage: [0, [Validators.required, Validators.min(0)]],
});
}
get orderedKeys(): string[] {
return this.orderedFieldKeys;
} }
getFieldLabel(key: string): string { getFieldLabel(key: string): string {
return this.t.translate('settingsMeta.matchWeights.fields.' + key); const providerField = this.providerFields.fields().find(field => field.name === key);
return providerField ? this.providerFields.label(providerField.name) : this.t.translate('settingsMeta.matchWeights.fields.' + key);
} }
save(): void { save(): void {
@@ -16,177 +16,145 @@
<h4 class="provider-group-title">{{ t('configurableTitle') }}</h4> <h4 class="provider-group-title">{{ t('configurableTitle') }}</h4>
<div class="configurable-providers-list"> <div class="configurable-providers-list">
<div class="setting-item"> @for (provider of configurableProviders(); track provider.id) {
<div class="setting-header"> <div class="setting-item">
<p-toggleswitch [(ngModel)]="amazonEnabled"></p-toggleswitch> <div class="setting-header">
<span class="setting-label">Amazon</span> <p-toggleswitch [(ngModel)]="enabled[provider.id]" [disabled]="isToggleDisabled(provider.id)"></p-toggleswitch>
</div> <span class="setting-label">{{ provider.labelKey | transloco }}</span>
@if (amazonEnabled) {
<div class="setting-options">
<div class="config-field">
<span class="config-label">{{ t('region') }}</span>
<p-select
[options]="amazonDomains"
[(ngModel)]="selectedAmazonDomain"
[placeholder]="t('selectDomain')"
class="config-select">
</p-select>
</div>
<div class="config-field">
<div class="config-label-row">
<span class="config-label">{{ t('cookieLabel') }}</span>
<app-external-doc-link docType="amazonCookie"></app-external-doc-link>
</div>
<p class="config-description">{{ t('cookieDesc') }}</p>
<input
type="text"
pInputText
[placeholder]="t('cookiePlaceholder')"
[(ngModel)]="amazonCookie"
class="config-input"/>
</div>
</div> </div>
} @switch (provider.id) {
</div> @case ('Amazon') {
@if (enabled.Amazon) {
<div class="setting-item"> <div class="setting-options">
<div class="setting-header"> <div class="config-field">
<p-toggleswitch <span class="config-label">{{ t('region') }}</span>
[(ngModel)]="googleEnabled" <p-select
[disabled]="!googleApiKeyConfigured"> [options]="amazonDomains"
</p-toggleswitch> [(ngModel)]="selectedAmazonDomain"
<span class="setting-label">Google Books</span> [placeholder]="t('selectDomain')"
</div> class="config-select">
<div class="setting-options"> </p-select>
@if (googleEnabled) { </div>
<div class="config-field"> <div class="config-field">
<span class="config-label">{{ t('languageRestriction') }}</span> <div class="config-label-row">
<p-select <span class="config-label">{{ t('cookieLabel') }}</span>
[options]="googleLanguages" <app-external-doc-link docType="amazonCookie"></app-external-doc-link>
[(ngModel)]="selectedGoogleLanguage" </div>
[showClear]="!!selectedGoogleLanguage" <p class="config-description">{{ t('cookieDesc') }}</p>
[placeholder]="t('selectLanguage')" <input
class="config-select"> type="text"
</p-select> pInputText
</div> [placeholder]="t('cookiePlaceholder')"
[(ngModel)]="amazonCookie"
class="config-input"/>
</div>
</div>
}
}
@case ('Google') {
<div class="setting-options">
@if (enabled.Google) {
<div class="config-field">
<span class="config-label">{{ t('languageRestriction') }}</span>
<p-select
[options]="googleLanguages"
[(ngModel)]="selectedGoogleLanguage"
[showClear]="!!selectedGoogleLanguage"
[placeholder]="t('selectLanguage')"
class="config-select">
</p-select>
</div>
}
<div class="config-field">
<span class="config-label">{{ t('googleApiLabel') }}</span>
<p class="config-description">{{ t('googleApiDesc') }}</p>
<input
type="text"
pInputText
[placeholder]="t('googleApiPlaceholder')"
[(ngModel)]="googleApiKey"
(ngModelChange)="onKeyChange('Google', $event)"
class="config-input"/>
</div>
</div>
}
@case ('Hardcover') {
<div class="setting-options">
<div class="config-field">
<div class="config-label-row">
<span class="config-label">{{ t('apiToken') }}</span>
<app-external-doc-link docType="hardcover"></app-external-doc-link>
</div>
<input
type="text"
pInputText
[placeholder]="t('hardcoverPlaceholder')"
[(ngModel)]="hardcoverToken"
(ngModelChange)="onKeyChange('Hardcover', $event)"
class="config-input"/>
</div>
</div>
}
@case ('Comicvine') {
<div class="setting-options">
<div class="config-field">
<span class="config-label">{{ t('apiToken') }}</span>
<input
type="text"
pInputText
[placeholder]="t('comicvinePlaceholder')"
[(ngModel)]="comicvineToken"
(ngModelChange)="onKeyChange('Comicvine', $event)"
class="config-input"/>
</div>
</div>
}
@case ('Ranobedb') {
@if (enabled.Ranobedb) {
<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>
</div>
}
}
@case ('Audible') {
@if (enabled.Audible) {
<div class="setting-options">
<div class="config-field">
<span class="config-label">{{ t('region') }}</span>
<p-select
[options]="audibleDomains"
[(ngModel)]="selectedAudibleDomain"
[placeholder]="t('selectDomain')"
class="config-select">
</p-select>
</div>
</div>
}
}
@case ('AppleBooks') {
@if (enabled.AppleBooks) {
<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 class="config-field">
<span class="config-label">{{ t('googleApiLabel') }}</span>
<p class="config-description">{{ t('googleApiDesc') }}</p>
<input
type="text"
pInputText
[placeholder]="t('googleApiPlaceholder')"
[(ngModel)]="googleApiKey"
class="config-input"/>
</div>
</div> </div>
</div> }
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch
[(ngModel)]="hardcoverEnabled"
[disabled]="!hardcoverToken">
</p-toggleswitch>
<span class="setting-label">Hardcover</span>
</div>
<div class="setting-options">
<div class="config-field">
<div class="config-label-row">
<span class="config-label">{{ t('apiToken') }}</span>
<app-external-doc-link docType="hardcover"></app-external-doc-link>
</div>
<input
type="text"
pInputText
[placeholder]="t('hardcoverPlaceholder')"
[(ngModel)]="hardcoverToken"
(ngModelChange)="onTokenChange($event)"
class="config-input"/>
</div>
</div>
</div>
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="comicvineEnabled"></p-toggleswitch>
<span class="setting-label">Comic Vine</span>
</div>
@if (comicvineEnabled) {
<div class="setting-options">
<div class="config-field">
<span class="config-label">{{ t('apiToken') }}</span>
<input
type="text"
pInputText
[placeholder]="t('comicvinePlaceholder')"
[(ngModel)]="comicvineToken"
(ngModelChange)="onComicTokenChange($event)"
class="config-input"/>
</div>
</div>
}
</div>
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="audibleEnabled"></p-toggleswitch>
<span class="setting-label">Audible</span>
</div>
@if (audibleEnabled) {
<div class="setting-options">
<div class="config-field">
<span class="config-label">{{ t('region') }}</span>
<p-select
[options]="audibleDomains"
[(ngModel)]="selectedAudibleDomain"
[placeholder]="t('selectDomain')"
class="config-select">
</p-select>
</div>
</div>
}
</div>
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="ranobedbEnabled"></p-toggleswitch>
<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>
<p class="config-description">{{ t('ranobedbPreferRomajiDesc') }}</p>
</div>
</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> </div>
</div> </div>
@@ -194,33 +162,14 @@
<h4 class="provider-group-title">{{ t('readyToUseTitle') }}</h4> <h4 class="provider-group-title">{{ t('readyToUseTitle') }}</h4>
<div class="simple-providers-grid"> <div class="simple-providers-grid">
<div class="setting-item simple-provider"> @for (provider of simpleProviders(); track provider.id) {
<div class="setting-header"> <div class="setting-item simple-provider">
<p-toggleswitch [(ngModel)]="openLibraryEnabled"></p-toggleswitch> <div class="setting-header">
<span class="setting-label">OpenLibrary</span> <p-toggleswitch [(ngModel)]="enabled[provider.id]"></p-toggleswitch>
<span class="setting-label">{{ provider.labelKey | transloco }}</span>
</div>
</div> </div>
</div> }
<div class="setting-item simple-provider">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="goodreadsEnabled"></p-toggleswitch>
<span class="setting-label">Goodreads</span>
</div>
</div>
<div class="setting-item simple-provider">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="doubanEnabled"></p-toggleswitch>
<span class="setting-label">Douban</span>
</div>
</div>
<div class="setting-item simple-provider">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="lubimyCzytacEnabled"></p-toggleswitch>
<span class="setting-label">Lubimyczytac</span>
</div>
</div>
</div> </div>
</div> </div>
@@ -8,6 +8,9 @@ import {MessageService} from '@openng/optimus-ui/api';
import {getTranslocoModule} from '../../../../core/testing/transloco-testing'; import {getTranslocoModule} from '../../../../core/testing/transloco-testing';
import {type AppSettings, AppSettingKey} from '../../../../shared/model/app-settings.model'; import {type AppSettings, AppSettingKey} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
import {METADATA_PROVIDER_LIST} from '../../../../shared/metadata/metadata-providers';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {MetadataProviderSettingsComponent} from './metadata-provider-settings.component'; import {MetadataProviderSettingsComponent} from './metadata-provider-settings.component';
describe('MetadataProviderSettingsComponent', () => { describe('MetadataProviderSettingsComponent', () => {
@@ -15,14 +18,21 @@ describe('MetadataProviderSettingsComponent', () => {
let component: MetadataProviderSettingsComponent; let component: MetadataProviderSettingsComponent;
let appSettingsSignal: WritableSignal<AppSettings | null>; let appSettingsSignal: WritableSignal<AppSettings | null>;
let saveSettings: ReturnType<typeof vi.fn>; let saveSettings: ReturnType<typeof vi.fn>;
let refreshProviders: ReturnType<typeof vi.fn>;
beforeEach(async () => { beforeEach(async () => {
appSettingsSignal = signal<AppSettings | null>(null); appSettingsSignal = signal<AppSettings | null>(null);
saveSettings = vi.fn(() => of(void 0)); saveSettings = vi.fn(() => of(void 0));
refreshProviders = vi.fn(() => Promise.resolve());
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [MetadataProviderSettingsComponent, getTranslocoModule()], imports: [MetadataProviderSettingsComponent, getTranslocoModule()],
providers: [ providers: [
{provide: MetadataCatalogService, useValue: {providers: () => METADATA_PROVIDER_LIST}},
{
provide: MetadataSourceQueryService,
useValue: {refreshProviders},
},
{ {
provide: AppSettingsService, provide: AppSettingsService,
useValue: { useValue: {
@@ -43,24 +53,8 @@ describe('MetadataProviderSettingsComponent', () => {
vi.restoreAllMocks(); vi.restoreAllMocks();
}); });
it('does not hydrate Google Books as enabled without an API key', () => {
appSettingsSignal.set(buildSettings({enabled: true, apiKey: ''}));
fixture.detectChanges();
expect(component.googleEnabled).toBe(false);
expect(component.googleApiKeyConfigured).toBe(false);
});
it('hydrates Google Books as enabled with an API key', () => {
appSettingsSignal.set(buildSettings({enabled: true, apiKey: 'valid-key'}));
fixture.detectChanges();
expect(component.googleEnabled).toBe(true);
expect(component.googleApiKeyConfigured).toBe(true);
});
it('persists Google Books as enabled when an API key is configured', () => { it('persists Google Books as enabled when an API key is configured', () => {
component.googleEnabled = true; component.enabled.Google = true;
component.googleApiKey = ' configured-key '; component.googleApiKey = ' configured-key ';
component.saveSettings(); component.saveSettings();
@@ -73,10 +67,12 @@ describe('MetadataProviderSettingsComponent', () => {
}); });
}); });
it('does not persist Google Books as enabled without an API key', () => { it('switches a provider off when its required key is cleared', () => {
component.googleEnabled = true; component.googleApiKey = 'configured-key';
component.googleApiKey = ''; component.enabled.Google = true;
component.googleApiKey = '';
component.onKeyChange('Google', '');
component.saveSettings(); component.saveSettings();
expect(getSavedProviderSettings().google.enabled).toBe(false); expect(getSavedProviderSettings().google.enabled).toBe(false);
@@ -92,14 +88,3 @@ describe('MetadataProviderSettingsComponent', () => {
return payload[0].newValue; return payload[0].newValue;
} }
}); });
function buildSettings(google: {enabled: boolean; apiKey: string}): AppSettings {
return {
metadataProviderSettings: {
google: {
...google,
language: '',
},
},
} as AppSettings;
}
@@ -1,4 +1,4 @@
import {Component, DestroyRef, effect, inject} from '@angular/core'; import {Component, computed, DestroyRef, effect, inject} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {TableModule} from '@openng/optimus-ui/table'; import {TableModule} from '@openng/optimus-ui/table';
@@ -6,11 +6,14 @@ import {InputText} from '@openng/optimus-ui/inputtext';
import {Button} from '@openng/optimus-ui/button'; import {Button} from '@openng/optimus-ui/button';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {MessageService} from '@openng/optimus-ui/api'; import {MessageService} from '@openng/optimus-ui/api';
import {AppSettingKey} from '../../../../shared/model/app-settings.model'; import {AppSettingKey, type MetadataProviderSettings} from '../../../../shared/model/app-settings.model';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
import type {MetadataProviderId} from '../../../../shared/metadata/metadata-providers';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {Select} from '@openng/optimus-ui/select'; import {Select} from '@openng/optimus-ui/select';
import {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component'; import {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component';
import { ToggleSwitch } from '@openng/optimus-ui/toggleswitch'; import { ToggleSwitch } from '@openng/optimus-ui/toggleswitch';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
@Component({ @Component({
selector: 'app-metadata-provider-settings', selector: 'app-metadata-provider-settings',
@@ -23,12 +26,18 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
Select, Select,
ExternalDocLinkComponent, ExternalDocLinkComponent,
ToggleSwitch, ToggleSwitch,
TranslocoDirective TranslocoDirective,
TranslocoPipe
], ],
templateUrl: './metadata-provider-settings.component.html', templateUrl: './metadata-provider-settings.component.html',
styleUrl: './metadata-provider-settings.component.scss' styleUrl: './metadata-provider-settings.component.scss'
}) })
export class MetadataProviderSettingsComponent { export class MetadataProviderSettingsComponent {
private readonly catalog = inject(MetadataCatalogService);
private readonly sourceQuery = inject(MetadataSourceQueryService);
readonly configurableProviders = computed(() => this.catalog.providers().filter(provider => provider.hasOptions));
readonly simpleProviders = computed(() => this.catalog.providers().filter(provider => !provider.hasOptions));
readonly enabled: Partial<Record<MetadataProviderId, boolean>> = {};
amazonDomains = [ amazonDomains = [
{label: 'amazon.com', value: 'com'}, {label: 'amazon.com', value: 'com'},
@@ -97,23 +106,12 @@ export class MetadataProviderSettingsComponent {
selectedAppleBooksCountry = 'US'; selectedAppleBooksCountry = 'US';
selectedAudibleDomain = 'com'; selectedAudibleDomain = 'com';
audibleEnabled: boolean = false;
hardcoverToken: string = ''; hardcoverToken: string = '';
amazonCookie: string = ''; amazonCookie: string = '';
hardcoverEnabled: boolean = false;
amazonEnabled: boolean = false;
openLibraryEnabled: boolean = false;
goodreadsEnabled: boolean = false;
googleEnabled: boolean = false;
comicvineEnabled: boolean = false;
comicvineToken: string = ''; comicvineToken: string = '';
doubanEnabled: boolean = false;
lubimyCzytacEnabled: boolean = false;
ranobedbEnabled: boolean = false;
ranobedbPreferRomaji: boolean = false; ranobedbPreferRomaji: boolean = false;
googleApiKey: string = ''; googleApiKey: string = '';
appleBooksEnabled: boolean = false;
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService); private messageService = inject(MessageService);
@@ -129,97 +127,70 @@ export class MetadataProviderSettingsComponent {
private applySettings(settings: NonNullable<ReturnType<typeof this.appSettingsService.appSettings>>): void { private applySettings(settings: NonNullable<ReturnType<typeof this.appSettingsService.appSettings>>): void {
const metadataProviderSettings = settings.metadataProviderSettings; const metadataProviderSettings = settings.metadataProviderSettings;
this.openLibraryEnabled = metadataProviderSettings?.openLibrary?.enabled ?? false;
this.amazonEnabled = metadataProviderSettings?.amazon?.enabled ?? false;
this.amazonCookie = metadataProviderSettings?.amazon?.cookie ?? ""; this.amazonCookie = metadataProviderSettings?.amazon?.cookie ?? "";
this.selectedAmazonDomain = metadataProviderSettings?.amazon?.domain ?? 'com'; this.selectedAmazonDomain = metadataProviderSettings?.amazon?.domain ?? 'com';
this.goodreadsEnabled = metadataProviderSettings?.goodReads?.enabled ?? false;
this.selectedGoogleLanguage = metadataProviderSettings?.google?.language ?? ''; this.selectedGoogleLanguage = metadataProviderSettings?.google?.language ?? '';
this.googleApiKey = metadataProviderSettings?.google?.apiKey ?? ''; this.googleApiKey = metadataProviderSettings?.google?.apiKey ?? '';
this.googleEnabled = (metadataProviderSettings?.google?.enabled ?? false) && this.googleApiKeyConfigured;
this.hardcoverToken = metadataProviderSettings?.hardcover?.apiKey ?? ''; this.hardcoverToken = metadataProviderSettings?.hardcover?.apiKey ?? '';
this.hardcoverEnabled = metadataProviderSettings?.hardcover?.enabled ?? false;
this.comicvineEnabled = metadataProviderSettings?.comicvine?.enabled ?? false;
this.comicvineToken = metadataProviderSettings?.comicvine?.apiKey ?? ''; this.comicvineToken = metadataProviderSettings?.comicvine?.apiKey ?? '';
this.doubanEnabled = metadataProviderSettings?.douban?.enabled ?? false;
this.lubimyCzytacEnabled = metadataProviderSettings?.lubimyczytac?.enabled ?? false;
this.ranobedbEnabled = metadataProviderSettings?.ranobedb?.enabled ?? false;
this.ranobedbPreferRomaji = metadataProviderSettings?.ranobedb?.preferRomaji ?? false; this.ranobedbPreferRomaji = metadataProviderSettings?.ranobedb?.preferRomaji ?? false;
this.audibleEnabled = metadataProviderSettings?.audible?.enabled ?? false;
this.selectedAudibleDomain = metadataProviderSettings?.audible?.domain ?? 'com'; this.selectedAudibleDomain = metadataProviderSettings?.audible?.domain ?? 'com';
this.appleBooksEnabled = metadataProviderSettings?.appleBooks?.enabled ?? false;
this.selectedAppleBooksCountry = metadataProviderSettings?.appleBooks?.country ?? 'US'; this.selectedAppleBooksCountry = metadataProviderSettings?.appleBooks?.country ?? 'US';
} for (const provider of this.catalog.providers()) {
this.enabled[provider.id] = !!metadataProviderSettings?.[provider.settingsKey]?.enabled && !this.isToggleDisabled(provider.id);
onTokenChange(newToken: string): void {
this.hardcoverToken = newToken;
if (!newToken.trim()) {
this.hardcoverEnabled = false;
} }
} }
onComicTokenChange(newToken: string): void { private readonly requiredKey: Partial<Record<MetadataProviderId, () => string>> = {
this.comicvineToken = newToken; Google: () => this.googleApiKey,
Hardcover: () => this.hardcoverToken,
Comicvine: () => this.comicvineToken,
};
isToggleDisabled(id: MetadataProviderId): boolean {
const key = this.requiredKey[id];
return key !== undefined && !key().trim();
} }
get googleApiKeyConfigured(): boolean { onKeyChange(id: MetadataProviderId, key: string): void {
return this.googleApiKey.trim().length > 0; if (!key.trim()) {
this.enabled[id] = false;
}
} }
saveSettings(): void { saveSettings(): void {
const options: {
[Id in MetadataProviderId]?: Omit<MetadataProviderSettings[Uncapitalize<Id>], 'enabled'>;
} = {
Amazon: {cookie: this.amazonCookie, domain: this.selectedAmazonDomain},
Google: {language: this.selectedGoogleLanguage, apiKey: this.googleApiKey.trim()},
Hardcover: {apiKey: this.hardcoverToken.trim()},
Comicvine: {apiKey: this.comicvineToken.trim()},
Ranobedb: {preferRomaji: this.ranobedbPreferRomaji},
Audible: {domain: this.selectedAudibleDomain},
AppleBooks: {country: this.selectedAppleBooksCountry},
};
const payload = [ const payload = [
{ {
key: AppSettingKey.METADATA_PROVIDER_SETTINGS, key: AppSettingKey.METADATA_PROVIDER_SETTINGS,
newValue: { newValue: Object.fromEntries(this.catalog.providers().map(provider => [
openLibrary: { provider.settingsKey,
enabled: this.openLibraryEnabled, {enabled: this.enabled[provider.id] ?? false, ...options[provider.id]},
}, ])),
amazon: {
enabled: this.amazonEnabled,
cookie: this.amazonCookie,
domain: this.selectedAmazonDomain
},
comicvine: {
enabled: this.comicvineEnabled,
apiKey: this.comicvineToken.trim()
},
goodReads: {enabled: this.goodreadsEnabled},
google: {
enabled: this.googleEnabled && this.googleApiKeyConfigured,
language: this.selectedGoogleLanguage,
apiKey: this.googleApiKey.trim()
},
hardcover: {
enabled: this.hardcoverEnabled,
apiKey: this.hardcoverToken.trim()
},
douban: {enabled: this.doubanEnabled},
lubimyczytac: {enabled: this.lubimyCzytacEnabled},
ranobedb: {
enabled: this.ranobedbEnabled,
preferRomaji: this.ranobedbPreferRomaji
},
audible: {
enabled: this.audibleEnabled,
domain: this.selectedAudibleDomain
},
appleBooks: {
enabled: this.appleBooksEnabled,
country: this.selectedAppleBooksCountry,
},
}
} }
]; ];
this.appSettingsService.saveSettings(payload).pipe( this.appSettingsService.saveSettings(payload).pipe(
takeUntilDestroyed(this.destroyRef) takeUntilDestroyed(this.destroyRef)
).subscribe({ ).subscribe({
next: () => next: () => {
void this.sourceQuery.refreshProviders();
this.messageService.add({ this.messageService.add({
severity: 'success', severity: 'success',
summary: this.t.translate('common.success'), summary: this.t.translate('common.success'),
detail: this.t.translate('settingsMeta.providers.saveSuccess') detail: this.t.translate('settingsMeta.providers.saveSuccess')
}), });
},
error: () => error: () =>
this.messageService.add({ this.messageService.add({
severity: 'error', severity: 'error',
@@ -10,6 +10,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {Library} from '../../book/model/library.model'; import {Library} from '../../book/model/library.model';
import {LibraryService} from '../../book/service/library.service'; import {LibraryService} from '../../book/service/library.service';
import {MetadataRefreshOptions} from '../../metadata/model/request/metadata-refresh-options.model'; import {MetadataRefreshOptions} from '../../metadata/model/request/metadata-refresh-options.model';
import {MetadataProviderFieldsService, providerFieldRecord} from '../../../shared/metadata';
import {AppSettingKey, AppSettings} from '../../../shared/model/app-settings.model'; import {AppSettingKey, AppSettings} from '../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../shared/service/app-settings.service';
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component'; import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
@@ -30,6 +31,7 @@ export class LibraryMetadataSettingsComponent {
private sidecarService = inject(SidecarService); private sidecarService = inject(SidecarService);
private t = inject(TranslocoService); private t = inject(TranslocoService);
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
private providerFields = inject(MetadataProviderFieldsService);
defaultMetadataOptions: MetadataRefreshOptions = this.getDefaultMetadataOptions(); defaultMetadataOptions: MetadataRefreshOptions = this.getDefaultMetadataOptions();
libraryMetadataOptions: Record<number, MetadataRefreshOptions> = {}; libraryMetadataOptions: Record<number, MetadataRefreshOptions> = {};
@@ -221,31 +223,9 @@ export class LibraryMetadataSettingsComponent {
categories: {p1: null, p2: null, p3: null, p4: null}, categories: {p1: null, p2: null, p3: null, p4: null},
cover: {p1: null, p2: null, p3: null, p4: null}, cover: {p1: null, p2: null, p3: null, p4: null},
pageCount: {p1: null, p2: null, p3: null, p4: null}, pageCount: {p1: null, p2: null, p3: null, p4: null},
openlibraryId: {p1: null, p2: null, p3: null, p4: null},
asin: {p1: null, p2: null, p3: null, p4: null},
goodreadsId: {p1: null, p2: null, p3: null, p4: null},
comicvineId: {p1: null, p2: null, p3: null, p4: null},
hardcoverId: {p1: null, p2: null, p3: null, p4: null},
hardcoverBookId: {p1: null, p2: null, p3: null, p4: null},
googleId: {p1: null, p2: null, p3: null, p4: null},
amazonRating: {p1: null, p2: null, p3: null, p4: null},
amazonReviewCount: {p1: null, p2: null, p3: null, p4: null},
goodreadsRating: {p1: null, p2: null, p3: null, p4: null},
goodreadsReviewCount: {p1: null, p2: null, p3: null, p4: null},
hardcoverRating: {p1: null, p2: null, p3: null, p4: null},
hardcoverReviewCount: {p1: null, p2: null, p3: null, p4: null},
lubimyczytacId: {p1: null, p2: null, p3: null, p4: null},
lubimyczytacRating: {p1: null, p2: null, p3: null, p4: null},
ranobedbId: {p1: null, p2: null, p3: null, p4: null},
ranobedbRating: {p1: null, p2: null, p3: null, p4: null},
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}, moods: {p1: null, p2: null, p3: null, p4: null},
tags: {p1: null, p2: null, p3: null, p4: null} tags: {p1: null, p2: null, p3: null, p4: null},
...providerFieldRecord(this.providerFields.fields(), () => ({p1: null, p2: null, p3: null, p4: null})),
} }
}; };
} }
@@ -48,7 +48,8 @@
[formControl]="provider.controls.enabled" [formControl]="provider.controls.enabled"
(onChange)="onProviderToggle(provider.controls.provider.value, $event.checked)"> (onChange)="onProviderToggle(provider.controls.provider.value, $event.checked)">
</p-toggleswitch> </p-toggleswitch>
<span class="provider-label">{{ provider.controls.provider.value }}</span> @let descriptor = catalog.provider(provider.controls.provider.value);
<span class="provider-label">{{ descriptor ? (descriptor.labelKey | transloco) : provider.controls.provider.value }}</span>
</div> </div>
@if (provider.controls.enabled.value) { @if (provider.controls.enabled.value) {
<div class="max-reviews-control"> <div class="max-reviews-control">
@@ -37,7 +37,7 @@ describe('PublicReviewsSettingsComponent', () => {
TestBed.resetTestingModule(); TestBed.resetTestingModule();
}); });
it('hydrates saved review settings and ensures all required providers exist', async () => { it('preserves saved preferences and adds supported review providers as disabled choices', async () => {
appSettingsSignal.set({ appSettingsSignal.set({
metadataPublicReviewsSettings: { metadataPublicReviewsSettings: {
downloadEnabled: false, downloadEnabled: false,
@@ -52,10 +52,12 @@ describe('PublicReviewsSettingsComponent', () => {
expect(component.publicReviewSettings.providers).toEqual( expect(component.publicReviewSettings.providers).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({provider: 'Amazon', enabled: true, maxReviews: 7}), expect.objectContaining({provider: 'Amazon', enabled: true, maxReviews: 7}),
expect.objectContaining({provider: 'GoodReads', enabled: false, maxReviews: 10}), expect.objectContaining({provider: 'GoodReads', enabled: false, maxReviews: 5}),
expect.objectContaining({provider: 'Douban', enabled: false, maxReviews: 10}), expect.objectContaining({provider: 'Douban', enabled: false, maxReviews: 5}),
]) ])
); );
expect(component.publicReviewSettings.providers).toHaveLength(3);
expect(settingsHelper.saveSetting).not.toHaveBeenCalled();
}); });
it('hydrates when review settings resolve after initial render', async () => { it('hydrates when review settings resolve after initial render', async () => {
@@ -4,15 +4,8 @@ import {ToggleSwitch} from "@openng/optimus-ui/toggleswitch";
import {AppSettingKey, AppSettings, PublicReviewSettings, ReviewProviderConfig} from '../../../../shared/model/app-settings.model'; import {AppSettingKey, AppSettings, PublicReviewSettings, ReviewProviderConfig} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {SettingsHelperService} from '../../../../shared/service/settings-helper.service'; import {SettingsHelperService} from '../../../../shared/service/settings-helper.service';
import {TranslocoDirective} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe} from '@jsverse/transloco';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
const DEFAULT_PROVIDERS: readonly ReviewProviderConfig[] = [
{provider: 'Amazon', enabled: true, maxReviews: 5},
{provider: 'GoodReads', enabled: false, maxReviews: 5},
{provider: 'Douban', enabled: false, maxReviews: 5}
] as const;
const REQUIRED_PROVIDERS = ['Amazon', 'GoodReads', 'Douban'] as const;
type ReviewProviderFormGroup = FormGroup<{ type ReviewProviderFormGroup = FormGroup<{
provider: FormControl<string>; provider: FormControl<string>;
@@ -22,7 +15,7 @@ type ReviewProviderFormGroup = FormGroup<{
@Component({ @Component({
selector: 'app-public-reviews-settings-component', selector: 'app-public-reviews-settings-component',
imports: [ReactiveFormsModule, ToggleSwitch, TranslocoDirective], imports: [ReactiveFormsModule, ToggleSwitch, TranslocoDirective, TranslocoPipe],
templateUrl: './public-reviews-settings-component.html', templateUrl: './public-reviews-settings-component.html',
styleUrl: './public-reviews-settings-component.scss' styleUrl: './public-reviews-settings-component.scss'
}) })
@@ -31,6 +24,7 @@ export class PublicReviewsSettingsComponent {
private readonly fb = inject(FormBuilder); private readonly fb = inject(FormBuilder);
private readonly appSettingsService = inject(AppSettingsService); private readonly appSettingsService = inject(AppSettingsService);
private readonly settingsHelper = inject(SettingsHelperService); private readonly settingsHelper = inject(SettingsHelperService);
protected readonly catalog = inject(MetadataCatalogService);
readonly form = this.fb.nonNullable.group({ readonly form = this.fb.nonNullable.group({
downloadEnabled: [{value: true, disabled: true}], downloadEnabled: [{value: true, disabled: true}],
@@ -117,24 +111,20 @@ export class PublicReviewsSettingsComponent {
} }
private buildReviewSettings(settings: AppSettings): PublicReviewSettings { private buildReviewSettings(settings: AppSettings): PublicReviewSettings {
const baseSettings = settings.metadataPublicReviewsSettings const saved = settings.metadataPublicReviewsSettings;
? { const baseSettings = {
...settings.metadataPublicReviewsSettings, downloadEnabled: saved.downloadEnabled,
providers: settings.metadataPublicReviewsSettings.providers.map(provider => ({...provider})) autoDownloadEnabled: saved.autoDownloadEnabled,
} providers: saved.providers.map(provider => ({...provider})),
: { };
downloadEnabled: true,
autoDownloadEnabled: false,
providers: DEFAULT_PROVIDERS.map(provider => ({...provider}))
};
REQUIRED_PROVIDERS.forEach(providerName => { this.catalog.reviewProviders().forEach(provider => {
const exists = baseSettings.providers.some(provider => provider.provider === providerName); const exists = baseSettings.providers.some(config => config.provider === provider.id);
if (!exists) { if (!exists) {
baseSettings.providers.push({ baseSettings.providers.push({
provider: providerName, provider: provider.id,
enabled: false, enabled: false,
maxReviews: 10 maxReviews: 5
}); });
} }
}); });
@@ -2,6 +2,8 @@ import {describe, expect, it} from 'vitest';
import {hasMetadataWriter, isFieldEmbeddable} from './embeddable-fields.config'; import {hasMetadataWriter, isFieldEmbeddable} from './embeddable-fields.config';
const NO_PROVIDER_FIELDS: ReadonlySet<string> = new Set();
describe('embeddable-fields.config', () => { describe('embeddable-fields.config', () => {
it('reports writer support only for embeddable book types', () => { it('reports writer support only for embeddable book types', () => {
expect(hasMetadataWriter('EPUB')).toBe(true); expect(hasMetadataWriter('EPUB')).toBe(true);
@@ -13,10 +15,19 @@ describe('embeddable-fields.config', () => {
}); });
it('checks embeddable field membership by book type', () => { it('checks embeddable field membership by book type', () => {
expect(isFieldEmbeddable('EPUB', 'title')).toBe(true); expect(isFieldEmbeddable('EPUB', 'title', NO_PROVIDER_FIELDS)).toBe(true);
expect(isFieldEmbeddable('EPUB', 'narrator')).toBe(false); expect(isFieldEmbeddable('EPUB', 'narrator', NO_PROVIDER_FIELDS)).toBe(false);
expect(isFieldEmbeddable('AUDIOBOOK', 'narrator')).toBe(true); expect(isFieldEmbeddable('AUDIOBOOK', 'narrator', NO_PROVIDER_FIELDS)).toBe(true);
expect(isFieldEmbeddable('CBX', 'comicIssueNumber')).toBe(true); expect(isFieldEmbeddable('CBX', 'comicIssueNumber', NO_PROVIDER_FIELDS)).toBe(true);
expect(isFieldEmbeddable(undefined, 'title')).toBe(false); expect(isFieldEmbeddable(undefined, 'title', NO_PROVIDER_FIELDS)).toBe(false);
});
it('embeds the provider fields it is given into ebooks only', () => {
const providerFieldNames = new Set(['goodreadsId']);
expect(isFieldEmbeddable('EPUB', 'goodreadsId', providerFieldNames)).toBe(true);
expect(isFieldEmbeddable('PDF', 'goodreadsId', providerFieldNames)).toBe(true);
expect(isFieldEmbeddable('CBX', 'goodreadsId', providerFieldNames)).toBe(false);
expect(isFieldEmbeddable('EPUB', 'goodreadsId', NO_PROVIDER_FIELDS)).toBe(false);
}); });
}); });
@@ -5,13 +5,6 @@ const EBOOK_EMBEDDABLE: ReadonlySet<string> = new Set([
'title', 'subtitle', 'authors', 'publisher', 'publishedDate', 'language', 'title', 'subtitle', 'authors', 'publisher', 'publishedDate', 'language',
'categories', 'description', 'seriesName', 'seriesNumber', 'seriesTotal', 'categories', 'description', 'seriesName', 'seriesNumber', 'seriesTotal',
'isbn10', 'isbn13', 'moods', 'tags', 'ageRating', 'contentRating', 'pageCount', 'isbn10', 'isbn13', 'moods', 'tags', 'ageRating', 'contentRating', 'pageCount',
'openlibraryId', 'asin', 'amazonRating', 'amazonReviewCount', 'googleId',
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
'lubimyczytacId', 'lubimyczytacRating',
'comicvineId', 'ranobedbId', 'ranobedbRating',
'audibleId', 'audibleRating', 'audibleReviewCount',
]); ]);
const CBX_EMBEDDABLE: ReadonlySet<string> = new Set([ const CBX_EMBEDDABLE: ReadonlySet<string> = new Set([
@@ -33,9 +26,12 @@ const EMBEDDABLE_FIELDS: Partial<Record<BookType, ReadonlySet<string>>> = {
AUDIOBOOK: AUDIOBOOK_EMBEDDABLE, AUDIOBOOK: AUDIOBOOK_EMBEDDABLE,
}; };
export function isFieldEmbeddable(bookType: BookType | undefined, controlName: string): boolean { const PROVIDER_EMBEDDABLE_TYPES: ReadonlySet<BookType> = new Set<BookType>(['EPUB', 'PDF']);
export function isFieldEmbeddable(bookType: BookType | undefined, controlName: string, providerFieldNames: ReadonlySet<string>): boolean {
if (!bookType) return false; if (!bookType) return false;
return EMBEDDABLE_FIELDS[bookType]?.has(controlName) ?? false; if (EMBEDDABLE_FIELDS[bookType]?.has(controlName)) return true;
return PROVIDER_EMBEDDABLE_TYPES.has(bookType) && providerFieldNames.has(controlName);
} }
export function hasMetadataWriter(bookType: BookType | undefined): boolean { export function hasMetadataWriter(bookType: BookType | undefined): boolean {
@@ -1,4 +1,6 @@
export * from './metadata-field.config'; export * from './metadata-field.config';
export * from './metadata-provider-fields';
export * from './metadata-provider-fields.service';
export * from './metadata-utils.service'; export * from './metadata-utils.service';
export * from './metadata-form.builder'; export * from './metadata-form.builder';
export * from './embeddable-fields.config'; export * from './embeddable-fields.config';
@@ -2,8 +2,9 @@ import {describe, expect, it} from 'vitest';
import { import {
ALL_COMIC_METADATA_FIELDS, ALL_COMIC_METADATA_FIELDS,
ALL_METADATA_FIELDS, allMetadataFields,
COMIC_FORM_TO_MODEL_LOCK, COMIC_FORM_TO_MODEL_LOCK,
GENERIC_METADATA_FIELDS,
getArrayFields, getArrayFields,
getBookDetailsFields, getBookDetailsFields,
getBottomFields, getBottomFields,
@@ -12,6 +13,10 @@ import {
getTextareaFields, getTextareaFields,
getTopFields getTopFields
} from './metadata-field.config'; } from './metadata-field.config';
import {providerFieldsOf} from './metadata-provider-fields';
import {METADATA_PROVIDER_LIST} from './metadata-providers';
const allFields = allMetadataFields(providerFieldsOf(METADATA_PROVIDER_LIST));
describe('metadata-field.config', () => { describe('metadata-field.config', () => {
it('exposes stable grouped field selectors', () => { it('exposes stable grouped field selectors', () => {
@@ -66,13 +71,13 @@ describe('metadata-field.config', () => {
applebooksReviewCount: false, applebooksReviewCount: false,
}; };
expect(getProviderFields(enabledFields).map((field) => field.controlName)).toEqual(['googleId']); expect(getProviderFields(allFields, enabledFields).map((field) => field.controlName)).toEqual(['googleId']);
expect(getBottomFields(enabledFields).some((field) => field.controlName === 'googleId')).toBe(true); expect(getBottomFields(allFields, enabledFields).some((field) => field.controlName === 'googleId')).toBe(true);
}); });
it('keeps comic metadata fields and lock mappings aligned', () => { it('keeps comic metadata fields and lock mappings aligned', () => {
expect(ALL_COMIC_METADATA_FIELDS.length).toBeGreaterThan(0); expect(ALL_COMIC_METADATA_FIELDS.length).toBeGreaterThan(0);
expect(COMIC_FORM_TO_MODEL_LOCK['comicIssueNumberLocked']).toBe('issueNumberLocked'); expect(COMIC_FORM_TO_MODEL_LOCK['comicIssueNumberLocked']).toBe('issueNumberLocked');
expect(ALL_METADATA_FIELDS.some((field) => field.controlName === 'title')).toBe(true); expect(GENERIC_METADATA_FIELDS.some((field) => field.controlName === 'title')).toBe(true);
}); });
}); });
@@ -1,9 +1,10 @@
import { MetadataProviderSpecificFields } from '../model/app-settings.model'; import { MetadataProviderSpecificFields } from '../model/app-settings.model';
import type { MetadataProviderField } from './metadata-provider-fields';
export type FieldType = 'string' | 'number' | 'array' | 'textarea' | 'boolean'; export type FieldType = 'string' | 'number' | 'array' | 'textarea' | 'boolean';
export interface MetadataFieldConfig { export interface MetadataFieldConfig {
label: string; label?: string;
controlName: string; controlName: string;
lockedKey: string; lockedKey: string;
fetchedKey: string; fetchedKey: string;
@@ -11,7 +12,7 @@ export interface MetadataFieldConfig {
providerKey?: keyof MetadataProviderSpecificFields; providerKey?: keyof MetadataProviderSpecificFields;
} }
export const ALL_METADATA_FIELDS: MetadataFieldConfig[] = [ export const GENERIC_METADATA_FIELDS: MetadataFieldConfig[] = [
{ label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title', type: 'string' }, { label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title', type: 'string' },
{ label: 'Subtitle', controlName: 'subtitle', lockedKey: 'subtitleLocked', fetchedKey: 'subtitle', type: 'string' }, { label: 'Subtitle', controlName: 'subtitle', lockedKey: 'subtitleLocked', fetchedKey: 'subtitle', type: 'string' },
{ label: 'Publisher', controlName: 'publisher', lockedKey: 'publisherLocked', fetchedKey: 'publisher', type: 'string' }, { label: 'Publisher', controlName: 'publisher', lockedKey: 'publisherLocked', fetchedKey: 'publisher', type: 'string' },
@@ -28,31 +29,21 @@ export const ALL_METADATA_FIELDS: MetadataFieldConfig[] = [
{ label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10', type: 'string' }, { label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10', type: 'string' },
{ label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13', type: 'string' }, { label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13', type: 'string' },
{ label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount', type: 'number' }, { label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount', type: 'number' },
{ label: 'OpenLibrary ID', controlName: 'openlibraryId', lockedKey: 'openlibraryIdLocked', fetchedKey: 'openlibraryId', type: 'string', providerKey: 'openlibraryId' },
{ label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId', type: 'string', providerKey: 'googleId' },
{ label: 'ASIN', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin', type: 'string', providerKey: 'asin' },
{ label: 'Amazon #', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount', type: 'number', providerKey: 'amazonReviewCount' },
{ label: 'Amazon ★', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating', type: 'number', providerKey: 'amazonRating' },
{ label: 'Goodreads ID', controlName: 'goodreadsId', lockedKey: 'goodreadsIdLocked', fetchedKey: 'goodreadsId', type: 'string', providerKey: 'goodreadsId' },
{ label: 'Goodreads #', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount', type: 'number', providerKey: 'goodreadsReviewCount' },
{ label: 'Goodreads ★', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating', type: 'number', providerKey: 'goodreadsRating' },
{ label: 'HC Book ID', controlName: 'hardcoverBookId', lockedKey: 'hardcoverBookIdLocked', fetchedKey: 'hardcoverBookId', type: 'number', providerKey: 'hardcoverBookId' },
{ label: 'Hardcover ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId', type: 'string', providerKey: 'hardcoverId' },
{ label: 'Hardcover #', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount', type: 'number', providerKey: 'hardcoverReviewCount' },
{ label: 'Hardcover ★', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating', type: 'number', providerKey: 'hardcoverRating' },
{ label: 'Comicvine ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId', type: 'string', providerKey: 'comicvineId' },
{ label: 'LB ID', controlName: 'lubimyczytacId', lockedKey: 'lubimyczytacIdLocked', fetchedKey: 'lubimyczytacId', type: 'string', providerKey: 'lubimyczytacId' },
{ label: 'LB ★', controlName: 'lubimyczytacRating', lockedKey: 'lubimyczytacRatingLocked', fetchedKey: 'lubimyczytacRating', type: 'number', providerKey: 'lubimyczytacRating' },
{ label: 'Ranobedb ID', controlName: 'ranobedbId', lockedKey: 'ranobedbIdLocked', fetchedKey: 'ranobedbId', type: 'string', providerKey: 'ranobedbId' },
{ 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: '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' },
]; ];
export function allMetadataFields(providerFields: readonly MetadataProviderField[]): MetadataFieldConfig[] {
return [
...GENERIC_METADATA_FIELDS,
...providerFields.map(field => ({
controlName: field.name,
lockedKey: field.lockName,
fetchedKey: field.name,
type: field.valueType,
providerKey: field.name,
})),
];
}
// Audiobook content metadata fields (narrator/abridged) - now stored at top level of BookMetadata // Audiobook content metadata fields (narrator/abridged) - now stored at top level of BookMetadata
export const AUDIOBOOK_METADATA_FIELDS: MetadataFieldConfig[] = [ export const AUDIOBOOK_METADATA_FIELDS: MetadataFieldConfig[] = [
{ label: 'Narrator', controlName: 'narrator', lockedKey: 'narratorLocked', fetchedKey: 'narrator', type: 'string' }, { label: 'Narrator', controlName: 'narrator', lockedKey: 'narratorLocked', fetchedKey: 'narrator', type: 'string' },
@@ -132,27 +123,27 @@ export const SERIES_FIELD_NAMES = ['seriesName', 'seriesNumber', 'seriesTotal'];
export const BOOK_DETAILS_FIELD_NAMES = ['language', 'isbn10', 'isbn13', 'pageCount']; export const BOOK_DETAILS_FIELD_NAMES = ['language', 'isbn10', 'isbn13', 'pageCount'];
export function getTopFields(): MetadataFieldConfig[] { export function getTopFields(): MetadataFieldConfig[] {
return ALL_METADATA_FIELDS.filter(f => TOP_FIELD_NAMES.includes(f.controlName)); return GENERIC_METADATA_FIELDS.filter(f => TOP_FIELD_NAMES.includes(f.controlName));
} }
export function getArrayFields(): MetadataFieldConfig[] { export function getArrayFields(): MetadataFieldConfig[] {
return ALL_METADATA_FIELDS.filter(f => f.type === 'array'); return GENERIC_METADATA_FIELDS.filter(f => f.type === 'array');
} }
export function getTextareaFields(): MetadataFieldConfig[] { export function getTextareaFields(): MetadataFieldConfig[] {
return ALL_METADATA_FIELDS.filter(f => f.type === 'textarea'); return GENERIC_METADATA_FIELDS.filter(f => f.type === 'textarea');
} }
export function getSeriesFields(): MetadataFieldConfig[] { export function getSeriesFields(): MetadataFieldConfig[] {
return ALL_METADATA_FIELDS.filter(f => SERIES_FIELD_NAMES.includes(f.controlName)); return GENERIC_METADATA_FIELDS.filter(f => SERIES_FIELD_NAMES.includes(f.controlName));
} }
export function getBookDetailsFields(): MetadataFieldConfig[] { export function getBookDetailsFields(): MetadataFieldConfig[] {
return ALL_METADATA_FIELDS.filter(f => BOOK_DETAILS_FIELD_NAMES.includes(f.controlName)); return GENERIC_METADATA_FIELDS.filter(f => BOOK_DETAILS_FIELD_NAMES.includes(f.controlName));
} }
export function getProviderFields(enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] { export function getProviderFields(fields: MetadataFieldConfig[], enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] {
const providerFields = ALL_METADATA_FIELDS.filter(f => !!f.providerKey); const providerFields = fields.filter(f => !!f.providerKey);
if (enabledProviderFields) { if (enabledProviderFields) {
return providerFields.filter(field => return providerFields.filter(field =>
@@ -163,8 +154,8 @@ export function getProviderFields(enabledProviderFields?: MetadataProviderSpecif
return providerFields; return providerFields;
} }
export function getBottomFields(enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] { export function getBottomFields(fields: MetadataFieldConfig[], enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] {
const bottomFields = ALL_METADATA_FIELDS.filter(f => const bottomFields = fields.filter(f =>
!TOP_FIELD_NAMES.includes(f.controlName) && !TOP_FIELD_NAMES.includes(f.controlName) &&
!ARRAY_FIELD_NAMES.includes(f.controlName) && !ARRAY_FIELD_NAMES.includes(f.controlName) &&
!TEXTAREA_FIELD_NAMES.includes(f.controlName) !TEXTAREA_FIELD_NAMES.includes(f.controlName)
@@ -56,7 +56,10 @@ describe('MetadataFormBuilder', () => {
titleLocked: true, titleLocked: true,
narratorLocked: true, narratorLocked: true,
comicIssueNumberLocked: false, comicIssueNumberLocked: false,
}); }, [
{label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title', type: 'string'},
{label: 'Authors', controlName: 'authors', lockedKey: 'authorsLocked', fetchedKey: 'authors', type: 'array'},
]);
expect(form.get('title')?.disabled).toBe(true); expect(form.get('title')?.disabled).toBe(true);
expect(form.get('authors')?.enabled).toBe(true); expect(form.get('authors')?.enabled).toBe(true);
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {FormControl, FormGroup} from '@angular/forms'; import {FormControl, FormGroup} from '@angular/forms';
import {ALL_COMIC_METADATA_FIELDS, ALL_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELDS, MetadataFieldConfig} from './metadata-field.config'; import {ALL_COMIC_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELDS, MetadataFieldConfig} from './metadata-field.config';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -8,8 +8,8 @@ import {ALL_COMIC_METADATA_FIELDS, ALL_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELD
export class MetadataFormBuilder { export class MetadataFormBuilder {
buildForm( buildForm(
includeLockedControls: boolean = true, includeLockedControls: boolean,
fields: MetadataFieldConfig[] = ALL_METADATA_FIELDS fields: MetadataFieldConfig[]
): FormGroup { ): FormGroup {
const controls: Record<string, FormControl> = {}; const controls: Record<string, FormControl> = {};
@@ -66,7 +66,7 @@ export class MetadataFormBuilder {
applyLockStates( applyLockStates(
metadataForm: FormGroup, metadataForm: FormGroup,
lockedFields: Record<string, boolean>, lockedFields: Record<string, boolean>,
fields: MetadataFieldConfig[] = ALL_METADATA_FIELDS fields: MetadataFieldConfig[]
): void { ): void {
for (const key of Object.keys(metadataForm.controls)) { for (const key of Object.keys(metadataForm.controls)) {
if (!key.endsWith('Locked')) { if (!key.endsWith('Locked')) {
@@ -0,0 +1,24 @@
import {computed, inject, Injectable} from '@angular/core';
import {TranslocoService} from '@jsverse/transloco';
import {MetadataCatalogService} from './metadata-catalog.service';
import {providerFieldsOf, providerScoreFieldsOf} from './metadata-provider-fields';
import type {MetadataProviderFieldName} from './metadata-providers';
@Injectable({providedIn: 'root'})
export class MetadataProviderFieldsService {
private readonly catalog = inject(MetadataCatalogService);
private readonly t = inject(TranslocoService);
readonly fields = computed(() => providerFieldsOf(this.catalog.providers()));
readonly scoreFields = computed(() => providerScoreFieldsOf(this.fields()));
private readonly byName = computed(() => new Map(this.fields().map(field => [field.name, field])));
label(name: MetadataProviderFieldName): string {
const field = this.byName().get(name);
if (!field) return name;
return this.t.translate<string>(field.labelKey, {provider: this.t.translate<string>(field.providerLabelKey)});
}
}
@@ -0,0 +1,41 @@
import {describe, expect, it} from 'vitest';
import {providerFieldsOf} from './metadata-provider-fields';
import {METADATA_PROVIDER_LIST} from './metadata-providers';
const fields = providerFieldsOf(METADATA_PROVIDER_LIST);
describe('provider fields', () => {
it('covers every provider field exactly once, in catalog order', () => {
expect(fields.map(field => field.name)).toEqual([
'openlibraryId',
'asin', 'amazonRating', 'amazonReviewCount',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'googleId',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating',
'audibleId', 'audibleRating', 'audibleReviewCount',
'applebooksId', 'applebooksRating', 'applebooksReviewCount',
]);
});
it('names each lock after its field and types IDs as strings', () => {
for (const field of fields) {
expect(field.lockName).toBe(`${field.name}Locked`);
expect(field.valueType).toBe(field.role === 'id' ? 'string' : 'number');
}
});
it('labels by role, except where the definition names its own key', () => {
const byName = new Map(fields.map(field => [field.name, field]));
expect(byName.get('goodreadsRating')).toMatchObject({
labelKey: 'metadata.providerFields.rating',
providerLabelKey: 'metadata.providers.goodReads',
});
expect(byName.get('asin')?.labelKey).toBe('metadata.providerFields.asin');
expect(byName.get('hardcoverBookId')?.labelKey).toBe('metadata.providerFields.hardcoverBookId');
});
});
@@ -0,0 +1,67 @@
import type {
MetadataProviderDescriptor,
MetadataProviderFieldName,
MetadataProviderId,
MetadataProviderIdFieldName,
MetadataProviderRatingFieldName,
MetadataProviderReviewCountFieldName,
} from './metadata-providers';
export type MetadataProviderFieldRecord<T> = Record<MetadataProviderFieldName, T>;
export type MetadataProviderFieldRole = 'id' | 'rating' | 'reviewCount';
interface ProviderFieldOf<Name extends MetadataProviderFieldName, Role extends MetadataProviderFieldRole> {
readonly name: Name;
readonly provider: MetadataProviderId;
readonly providerLabelKey: string;
readonly role: Role;
readonly lockName: `${Name}Locked`;
readonly valueType: 'string' | 'number';
readonly labelKey: string;
}
export type MetadataProviderScoreField =
| ProviderFieldOf<MetadataProviderRatingFieldName, 'rating'>
| ProviderFieldOf<MetadataProviderReviewCountFieldName, 'reviewCount'>;
export type MetadataProviderField = ProviderFieldOf<MetadataProviderIdFieldName, 'id'> | MetadataProviderScoreField;
export function providerFieldsOf(
providers: readonly MetadataProviderDescriptor[],
): readonly MetadataProviderField[] {
return providers.flatMap(provider => {
const book = provider.book;
if (!book) return [];
const field = <Name extends MetadataProviderFieldName, Role extends MetadataProviderFieldRole>(
name: Name,
role: Role,
): ProviderFieldOf<Name, Role> => ({
name,
provider: provider.id,
providerLabelKey: provider.labelKey,
role,
lockName: `${name}Locked`,
valueType: role === 'id' ? 'string' : 'number',
labelKey: book.labelKeys?.[name] ?? `metadata.providerFields.${role}`,
});
return [
...book.ids.map(name => field(name, 'id')),
...(book.rating ? [field(book.rating, 'rating')] : []),
...(book.reviewCount ? [field(book.reviewCount, 'reviewCount')] : []),
];
});
}
export function providerScoreFieldsOf(
fields: readonly MetadataProviderField[],
): readonly MetadataProviderScoreField[] {
return fields.flatMap(field => (field.role === 'id' ? [] : [field]));
}
export function providerFieldRecord<Field extends MetadataProviderField, T>(
fields: readonly Field[],
value: (field: Field) => T,
): Record<Field['name'], T> {
return Object.fromEntries(fields.map(field => [field.name, value(field)])) as Record<Field['name'], T>;
}
@@ -42,6 +42,8 @@ describe('app-settings.model', () => {
ranobedbRating: 1, ranobedbRating: 1,
audibleRating: 1, audibleRating: 1,
audibleReviewCount: 1, audibleReviewCount: 1,
applebooksRating: 1,
applebooksReviewCount: 1,
coverImage: 6 coverImage: 6
}; };
@@ -1,6 +1,8 @@
import {MetadataRefreshOptions} from '../../features/metadata/model/request/metadata-refresh-options.model'; import {MetadataRefreshOptions} from '../../features/metadata/model/request/metadata-refresh-options.model';
import type {MetadataProviderFieldRecord} from '../metadata/metadata-provider-fields';
import type {MetadataProviderScoreFieldName} from '../metadata/metadata-providers';
export interface MetadataMatchWeights { interface GenericMatchWeights {
title: number; title: number;
subtitle: number; subtitle: number;
description: number; description: number;
@@ -15,21 +17,13 @@ export interface MetadataMatchWeights {
language: number; language: number;
pageCount: number; pageCount: number;
categories: number; categories: number;
amazonRating: number;
amazonReviewCount: number;
goodreadsRating: number;
goodreadsReviewCount: number;
hardcoverRating: number;
hardcoverReviewCount: number;
doubanRating: number; doubanRating: number;
doubanReviewCount: number; doubanReviewCount: number;
lubimyczytacRating: number;
ranobedbRating: number;
audibleRating: number;
audibleReviewCount: number;
coverImage: number; coverImage: number;
} }
export type MetadataMatchWeights = GenericMatchWeights & Record<MetadataProviderScoreFieldName, number>;
export interface OidcProviderDetails { export interface OidcProviderDetails {
providerName: string; providerName: string;
clientId: string; clientId: string;
@@ -213,31 +207,7 @@ export interface AppSettings {
diskType: string; diskType: string;
} }
export interface MetadataProviderSpecificFields { export type MetadataProviderSpecificFields = MetadataProviderFieldRecord<boolean>;
openlibraryId: boolean;
asin: boolean;
amazonRating: boolean;
amazonReviewCount: boolean;
googleId: boolean;
goodreadsId: boolean;
goodreadsRating: boolean;
goodreadsReviewCount: boolean;
hardcoverId: boolean;
hardcoverBookId: boolean;
hardcoverRating: boolean;
hardcoverReviewCount: boolean;
comicvineId: boolean;
lubimyczytacId: boolean;
lubimyczytacRating: boolean;
ranobedbId: boolean;
ranobedbRating: boolean;
audibleId: boolean;
audibleRating: boolean;
audibleReviewCount: boolean;
applebooksId: boolean;
applebooksRating: boolean;
applebooksReviewCount: boolean;
}
export enum AppSettingKey { export enum AppSettingKey {
QUICK_BOOK_MATCH = 'QUICK_BOOK_MATCH', QUICK_BOOK_MATCH = 'QUICK_BOOK_MATCH',
@@ -1,85 +0,0 @@
import {provideHttpClient} from '@angular/common/http';
import {provideHttpClientTesting} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {BookCoverService, CoverFetchRequest, CoverImage} from './book-cover.service';
import {AuthService} from '../service/auth.service';
describe('BookCoverService', () => {
let service: BookCoverService;
let authService: {getInternalAccessToken: ReturnType<typeof vi.fn>};
beforeEach(() => {
authService = {
getInternalAccessToken: vi.fn(() => 'token-123'),
};
TestBed.configureTestingModule({
providers: [
provideHttpClient(),
provideHttpClientTesting(),
BookCoverService,
{provide: AuthService, useValue: authService},
],
});
service = TestBed.inject(BookCoverService);
});
afterEach(() => {
TestBed.resetTestingModule();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
it('streams covers over SSE with auth headers', async () => {
const requestBody: CoverFetchRequest = {
bookId: 123,
title: 'Dune',
author: 'Frank Herbert',
coverType: 'ebook',
};
const mockImage = {url: 'https://example.test/cover-1.jpg', index: 1};
const encoder = new TextEncoder();
const dataChunk = encoder.encode(`data: ${JSON.stringify(mockImage)}\n`);
const mockReader = {
read: vi.fn()
.mockResolvedValueOnce({done: false, value: dataChunk})
.mockResolvedValueOnce({done: true, value: undefined}),
releaseLock: vi.fn()
};
const mockResponse = {
ok: true,
body: {
getReader: () => mockReader
}
};
const fetchSpy = vi.fn().mockResolvedValue(mockResponse);
vi.stubGlobal('fetch', fetchSpy);
let result: CoverImage | undefined;
service.fetchBookCovers(requestBody).subscribe(value => {
result = value;
});
// Wait for the stream to process
await new Promise(resolve => setTimeout(resolve, 0));
expect(fetchSpy).toHaveBeenCalledWith(
expect.stringMatching(/\/api\/v1\/books\/123\/metadata\/covers$/),
expect.objectContaining({
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer token-123'
},
body: JSON.stringify(requestBody)
})
);
expect(result).toEqual(mockImage);
});
});
@@ -1,123 +0,0 @@
import {inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {API_CONFIG} from '../../core/config/api-config';
import {AuthService} from '../service/auth.service';
export interface CoverImage {
url: string;
source?: string;
width?: number;
height?: number;
index: number;
}
export interface CoverFetchRequest {
bookId?: number;
title?: string;
author?: string;
coverType?: 'ebook' | 'audiobook';
}
@Injectable({
providedIn: 'root'
})
export class BookCoverService {
private readonly baseUrl = `${API_CONFIG.BASE_URL}/api/v1/books`;
private http = inject(HttpClient);
private authService = inject(AuthService);
fetchBookCovers(request: CoverFetchRequest): Observable<CoverImage> {
const token = this.authService.getInternalAccessToken();
return new Observable<CoverImage>(subscriber => {
if (!request.bookId) {
subscriber.error(new Error('bookId is required for fetching covers'));
return;
}
const abortController = new AbortController();
fetch(`${this.baseUrl}/${request.bookId}/metadata/covers`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify(request),
signal: abortController.signal
})
.then(async response => {
if (!response.ok) {
subscriber.error(new Error(`HTTP error! status: ${response.status}`));
return;
}
const reader = response.body?.getReader();
if (!reader) {
subscriber.error(new Error('Response body is null'));
return;
}
const decoder = new TextDecoder();
let buffer = '';
const emitLine = (line: string) => {
if (!line.startsWith('data:')) {
return;
}
const data = line.slice(5).trim();
if (!data) {
return;
}
try {
const image = JSON.parse(data) as CoverImage;
subscriber.next(image);
} catch (e) {
console.error('Error parsing SSE data:', e);
}
};
try {
while (true) {
const {done, value} = await reader.read();
if (done) break;
buffer += decoder.decode(value, {stream: true});
const lines = buffer.split('\n');
buffer = lines.pop() || '';
for (const line of lines) {
emitLine(line);
}
}
if (buffer) {
emitLine(buffer);
}
subscriber.complete();
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
// Silently handle abort
} else {
subscriber.error(error);
}
} finally {
reader.releaseLock();
}
})
.catch(error => {
if (error instanceof Error && error.name === 'AbortError') {
return;
}
subscriber.error(error);
});
return () => {
abortController.abort();
};
});
}
}
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "Seitenzahl", "pageCount": "Seitenzahl",
"amazonRating": "Amazon Bewertung",
"amazonReviewCount": "Amazon Bewertung #",
"goodreadsRating": "Goodreads Bewertung",
"goodreadsReviewCount": "Goodreads Bewertung #",
"hardcoverRating": "Hardcover Bewertung",
"hardcoverReviewCount": "Hardcover Bewertung #",
"audibleRating": "Audible Bewertung",
"audibleReviewCount": "Audible Bewertung #",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Douban Bewertung", "doubanRating": "Douban Bewertung",
"doubanReviewCount": "Douban Bewertung #", "doubanReviewCount": "Douban Bewertung #"
"ranobedbRating": "Ranobedb Bewertung"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Aktivierte Felder im Metadaten-Editor und -Picker", "sectionTitle": "Aktivierte Felder im Metadaten-Editor und -Picker",
"sectionDesc": "Wählen Sie, welche Metadatenfelder beim Bearbeiten von Buchinformationen oder beim Auswählen von Metadaten von Anbietern angezeigt werden. Deaktivierte Felder werden in der Oberfläche ausgeblendet.", "sectionDesc": "Wählen Sie, welche Metadatenfelder beim Bearbeiten von Buchinformationen oder beim Auswählen von Metadaten von Anbietern angezeigt werden. Deaktivierte Felder werden in der Oberfläche ausgeblendet."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "Amazon Bewertung",
"amazonReviewCount": "Anzahl der Amazon-Bewertungen",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "Goodreads Bewertung",
"goodreadsReviewCount": "Anzahl der Goodreads-Bewertungen",
"hardcoverId": "",
"hardcoverBookId": "Hardcover Buch ID",
"hardcoverRating": "Hardcover Bewertung",
"hardcoverReviewCount": "Anzahl der Hardcover Bewertungen",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "Lubimyczytac Bewertung",
"ranobedbId": "",
"ranobedbRating": "Ranobedb Bewertung",
"audibleId": "",
"audibleRating": "Audible Bewertung",
"audibleReviewCount": "Anzahl der Audible-Bewertungen",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Hörbuch-Details", "audiobookDetails": "Hörbuch-Details",
"comicBookDetails": "Comic-Details", "comicBookDetails": "Comic-Details",
"providerMetadata": "Anbieter-Metadaten", "providerMetadata": "Anbieter-Metadaten",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "Hardcover Buch ID",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Schließen", "closeBtn": "Schließen",
"previousBookBtn": "Vorheriges Buch", "previousBookBtn": "Vorheriges Buch",
"nextBookBtn": "Nächstes Buch", "nextBookBtn": "Nächstes Buch",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Vollständige Metadaten werden geladen...",
"columnCurrent": "Aktuell", "columnCurrent": "Aktuell",
"columnFetched": "Abgerufen", "columnFetched": "Abgerufen",
"copyMissingTooltip": "Fehlende Felder kopieren", "copyMissingTooltip": "Fehlende Felder kopieren",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Geben Sie oben Ihre Suchkriterien ein und klicken Sie auf Suchen, um Metadaten zu finden", "readyToSearchHint": "Geben Sie oben Ihre Suchkriterien ein und klicken Sie auf Suchen, um Metadaten zu finden",
"noResultsFound": "Keine Ergebnisse gefunden", "noResultsFound": "Keine Ergebnisse gefunden",
"noResultsHint": "Passen Sie Ihre Suchkriterien an oder wählen Sie andere Anbieter", "noResultsHint": "Passen Sie Ihre Suchkriterien an oder wählen Sie andere Anbieter",
"unknownProvider": "",
"selectOverlay": "Auswählen" "selectOverlay": "Auswählen"
}, },
"tabs": { "tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Dateigröße (Kb)", "fileSize": "Dateigröße (Kb)",
"fileType": "Dateityp", "fileType": "Dateityp",
"subtitle": "Untertitel", "subtitle": "Untertitel",
"amazonRating": "Amazon-Bewertung",
"amazonReviewCount": "Amazon-Rezensionen",
"goodreadsRating": "Goodreads-Bewertung",
"goodreadsReviewCount": "Goodreads-Rezensionen",
"hardcoverRating": "Hardcover-Bewertung",
"hardcoverReviewCount": "Hardcover-Rezensionen",
"ranobedbRating": "Ranobedb-Bewertung",
"genre": "", "genre": "",
"addedOn": "Hinzugefügt am", "addedOn": "Hinzugefügt am",
"lubimyczytacRating": "Lubimyczytac-Bewertung",
"description": "Beschreibung", "description": "Beschreibung",
"narrator": "Sprecher", "narrator": "Sprecher",
"ageRating": "Altersfreigabe", "ageRating": "Altersfreigabe",
"contentRating": "Inhaltsbewertung", "contentRating": "Inhaltsbewertung",
"audibleRating": "Audible-Bewertung",
"audibleReviewCount": "Audible-Rezensionen",
"abridged": "Gekürzt", "abridged": "Gekürzt",
"audiobookDuration": "Hörbuchdauer (s)", "audiobookDuration": "Hörbuchdauer (s)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Seriengesamt", "seriesTotal": "Seriengesamt",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Altersfreigabe", "ageRating": "Altersfreigabe",
"contentRating": "Inhaltsbewertung", "contentRating": "Inhaltsbewertung",
"personalRating": "Persönliche Bewertung", "personalRating": "Persönliche Bewertung",
"amazonRating": "Amazon-Bewertung",
"goodreadsRating": "Goodreads-Bewertung",
"hardcoverRating": "Hardcover-Bewertung",
"ranobedbRating": "Ranobedb-Bewertung",
"lubimyczytacRating": "Lubimyczytac-Bewertung",
"audibleRating": "Audible-Bewertung",
"applebooksRating": "",
"amazonReviewCount": "Amazon-Rezensionen",
"goodreadsReviewCount": "Goodreads-Rezensionen",
"hardcoverReviewCount": "Hardcover-Rezensionen",
"audibleReviewCount": "Audible-Rezensionen",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "Goodreads-ID",
"hardcoverId": "Hardcover-ID",
"googleId": "Google-ID",
"audibleId": "Audible-ID",
"applebooksId": "",
"lubimyczytacId": "Lubimyczytac-ID",
"ranobedbId": "Ranobedb-ID",
"comicvineId": "ComicVine-ID",
"narrator": "Sprecher", "narrator": "Sprecher",
"abridged": "Gekürzt", "abridged": "Gekürzt",
"audiobookDuration": "Dauer", "audiobookDuration": "Dauer",
+17 -111
View File
@@ -712,7 +712,7 @@
}, },
"publicReviews": { "publicReviews": {
"sectionTitle": "Public Reviews", "sectionTitle": "Public Reviews",
"sectionDesc": "Configure automatic downloading of user reviews from external platforms. Reviews can be fetched from Amazon, Goodreads, and Hardcover for offline access.", "sectionDesc": "Configure automatic downloading of user reviews from external platforms for offline access.",
"downloadLabel": "Download Public Reviews", "downloadLabel": "Download Public Reviews",
"autoDownloadLabel": "Auto Download on Book Open", "autoDownloadLabel": "Auto Download on Book Open",
"autoDownloadDesc": "Automatically fetch reviews when you open a book's details page. When disabled, reviews will only be downloaded manually or during metadata refresh.", "autoDownloadDesc": "Automatically fetch reviews when you open a book's details page. When disabled, reviews will only be downloaded manually or during metadata refresh.",
@@ -751,62 +751,13 @@
"isbn13": "ISBN-13", "isbn13": "ISBN-13",
"isbn10": "ISBN-10", "isbn10": "ISBN-10",
"pageCount": "Page Count", "pageCount": "Page Count",
"amazonRating": "Amazon Rating",
"amazonReviewCount": "Amazon Rating #",
"goodreadsRating": "Goodreads Rating",
"goodreadsReviewCount": "Goodreads Rating #",
"hardcoverRating": "Hardcover Rating",
"hardcoverReviewCount": "Hardcover Rating #",
"audibleRating": "Audible Rating",
"audibleReviewCount": "Audible Rating #",
"applebooksId": "Apple Books ID",
"applebooksRating": "Apple Books ★",
"applebooksReviewCount": "Apple Books #",
"doubanRating": "Douban Rating", "doubanRating": "Douban Rating",
"doubanReviewCount": "Douban Rating #", "doubanReviewCount": "Douban Rating #"
"ranobedbRating": "Ranobedb Rating"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Enabled Fields in Metadata Editor & Picker", "sectionTitle": "Enabled Fields in Metadata Editor & Picker",
"sectionDesc": "Select which metadata fields to display when editing book information or picking metadata from providers. Disabled fields will be hidden from the interface.", "sectionDesc": "Select which metadata fields to display when editing book information or picking metadata from providers. Disabled fields will be hidden from the interface."
"providers": {
"openlibrary": "OpenLibrary",
"amazon": "Amazon",
"googleBooks": "Google Books",
"goodreads": "Goodreads",
"hardcover": "Hardcover",
"audible": "Audible",
"applebooks": "Apple Books",
"comicvine": "Comicvine",
"lubimyczytac": "Lubimyczytac",
"ranobedb": "Ranobedb"
},
"fields": {
"openlibraryId": "OpenLibrary ID",
"asin": "Amazon ASIN",
"amazonRating": "Amazon Rating",
"amazonReviewCount": "Amazon Review Count",
"googleId": "Google Books ID",
"goodreadsId": "Goodreads ID",
"goodreadsRating": "Goodreads Rating",
"goodreadsReviewCount": "Goodreads Review Count",
"hardcoverId": "Hardcover ID",
"hardcoverBookId": "Hardcover Book ID",
"hardcoverRating": "Hardcover Rating",
"hardcoverReviewCount": "Hardcover Review Count",
"comicvineId": "Comicvine ID",
"lubimyczytacId": "Lubimyczytac ID",
"lubimyczytacRating": "LubimyCzytac Rating",
"ranobedbId": "Ranobedb ID",
"ranobedbRating": "Ranobedb Rating",
"audibleId": "Audible ID",
"audibleRating": "Audible Rating",
"audibleReviewCount": "Audible Review Count",
"applebooksId": "Apple Books ID",
"applebooksRating": "Apple Books Rating",
"applebooksReviewCount": "Apple Books Review Count"
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2260,29 +2211,6 @@
"audiobookDetails": "Audiobook Details", "audiobookDetails": "Audiobook Details",
"comicBookDetails": "Comic Book Details", "comicBookDetails": "Comic Book Details",
"providerMetadata": "Provider Metadata", "providerMetadata": "Provider Metadata",
"openlibraryId": "OpenLibrary ID",
"amazonAsin": "Amazon ASIN",
"amazonRating": "Amazon ★",
"amazonReviewCount": "Amazon #",
"googleBooksId": "Google Books ID",
"goodreadsId": "Goodreads ID",
"goodreadsRating": "Goodreads ★",
"goodreadsReviewCount": "Goodreads #",
"hardcoverId": "Hardcover ID",
"hardcoverBookId": "Hardcover Book ID",
"hardcoverRating": "Hardcover ★",
"hardcoverReviewCount": "Hardcover #",
"lubimyczytacId": "Lubimyczytac ID",
"lubimyczytacRating": "Lubimyczytac ★",
"comicvineId": "Comicvine ID",
"ranobedbId": "Ranobedb ID",
"ranobedbRating": "Ranobedb ★",
"audibleId": "Audible ID",
"audibleRating": "Audible ★",
"audibleReviewCount": "Audible #",
"applebooksId": "Apple Books ID",
"applebooksRating": "Apple Books ★",
"applebooksReviewCount": "Apple Books #",
"closeBtn": "Close", "closeBtn": "Close",
"previousBookBtn": "Previous Book", "previousBookBtn": "Previous Book",
"nextBookBtn": "Next Book", "nextBookBtn": "Next Book",
@@ -2343,7 +2271,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Loading complete metadata...",
"columnCurrent": "Current", "columnCurrent": "Current",
"columnFetched": "Fetched", "columnFetched": "Fetched",
"copyMissingTooltip": "Copy missing fields", "copyMissingTooltip": "Copy missing fields",
@@ -2404,9 +2331,10 @@
"fetching": "Fetching...", "fetching": "Fetching...",
"readyToSearch": "Ready to Search", "readyToSearch": "Ready to Search",
"readyToSearchHint": "Enter your search criteria above and click Search to find metadata", "readyToSearchHint": "Enter your search criteria above and click Search to find metadata",
"noProviders": "No metadata providers are available",
"noResultsFound": "No Results Found", "noResultsFound": "No Results Found",
"noResultsHint": "Try adjusting your search criteria or selecting different providers", "noResultsHint": "Try adjusting your search criteria or selecting different providers",
"unknownProvider": "Unknown Provider", "searchFailed": "Search failed",
"selectOverlay": "Select" "selectOverlay": "Select"
}, },
"tabs": { "tabs": {
@@ -2519,6 +2447,8 @@
"goToPreviousBook": "Go to Previous Book", "goToPreviousBook": "Go to Previous Book",
"goToNextBook": "Go to Next Book", "goToNextBook": "Go to Next Book",
"personalRating": "Personal Rating", "personalRating": "Personal Rating",
"ratingTooltip": "★ {{rating}} | {{reviews}} reviews",
"ratingTooltipNoReviews": "★ {{rating}}",
"loadingBookDetails": "Loading book details...", "loadingBookDetails": "Loading book details...",
"readStatusUnread": "Unread", "readStatusUnread": "Unread",
"readStatusPaused": "Paused", "readStatusPaused": "Paused",
@@ -2624,6 +2554,7 @@
"byLabel": "By:", "byLabel": "By:",
"coverFileLabel": "Cover file:", "coverFileLabel": "Cover file:",
"loading": "Loading sidecar data...", "loading": "Loading sidecar data...",
"readFailed": "Could not load sidecar metadata. Please try again.",
"syncStatusInSync": "In Sync", "syncStatusInSync": "In Sync",
"syncStatusOutdated": "Outdated", "syncStatusOutdated": "Outdated",
"syncStatusConflict": "Conflict", "syncStatusConflict": "Conflict",
@@ -2657,6 +2588,7 @@
"searchingForCovers": "Searching for covers...", "searchingForCovers": "Searching for covers...",
"noCoversFound": "No Covers Found", "noCoversFound": "No Covers Found",
"noCoversFoundDescription": "Try adjusting your search terms or check the spelling.", "noCoversFoundDescription": "Try adjusting your search terms or check the spelling.",
"searchFailed": "Search failed",
"coversFoundSingular": "{{ count }} cover found", "coversFoundSingular": "{{ count }} cover found",
"coversFoundPlural": "{{ count }} covers found", "coversFoundPlural": "{{ count }} covers found",
"resultsHint": "Click on an image to preview, or select to apply", "resultsHint": "Click on an image to preview, or select to apply",
@@ -2801,7 +2733,8 @@
"toast": { "toast": {
"providerRequiredSummary": "Error", "providerRequiredSummary": "Error",
"providerRequiredDetail": "At least one provider (P1-P4) must be selected for each enabled book field." "providerRequiredDetail": "At least one provider (P1-P4) must be selected for each enabled book field."
} },
"inactiveProvider": "{{provider}} (disabled)"
}, },
"fetchOptions": { "fetchOptions": {
"startRefresh": "Start Refresh" "startRefresh": "Start Refresh"
@@ -2820,6 +2753,9 @@
"appleBooks": "Apple Books" "appleBooks": "Apple Books"
}, },
"providerFields": { "providerFields": {
"id": "{{ provider }} ID",
"rating": "{{ provider }} Rating",
"reviewCount": "{{ provider }} Review Count",
"asin": "Amazon ASIN", "asin": "Amazon ASIN",
"hardcoverBookId": "Hardcover Book ID" "hardcoverBookId": "Hardcover Book ID"
} }
@@ -3347,7 +3283,9 @@
"validationReady": "Ready to create", "validationReady": "Ready to create",
"cancelButton": "Cancel", "cancelButton": "Cancel",
"addButton": "Add Physical Book", "addButton": "Add Physical Book",
"fetchMetadataTooltip": "Fetch metadata by ISBN" "fetchMetadataTooltip": "Fetch metadata by ISBN",
"metadataNotFound": "No metadata found for this ISBN. You can enter the book details manually.",
"metadataLookupFailed": "Could not fetch metadata. Please try again or enter the book details manually."
}, },
"bulkIsbnImport": { "bulkIsbnImport": {
"title": "Import ISBNs", "title": "Import ISBNs",
@@ -5145,22 +5083,12 @@
"fileSize": "File Size (Kb)", "fileSize": "File Size (Kb)",
"fileType": "File Type", "fileType": "File Type",
"subtitle": "Subtitle", "subtitle": "Subtitle",
"amazonRating": "Amazon Rating",
"amazonReviewCount": "Amazon Review Count",
"goodreadsRating": "Goodreads Rating",
"goodreadsReviewCount": "Goodreads Review Count",
"hardcoverRating": "Hardcover Rating",
"hardcoverReviewCount": "Hardcover Review Count",
"ranobedbRating": "Ranobedb Rating",
"genre": "Genre", "genre": "Genre",
"addedOn": "Date Added", "addedOn": "Date Added",
"lubimyczytacRating": "LubimyCzytac Rating",
"description": "Description", "description": "Description",
"narrator": "Narrator", "narrator": "Narrator",
"ageRating": "Age Rating", "ageRating": "Age Rating",
"contentRating": "Content Rating", "contentRating": "Content Rating",
"audibleRating": "Audible Rating",
"audibleReviewCount": "Audible Review Count",
"abridged": "Abridged", "abridged": "Abridged",
"audiobookDuration": "Audiobook Duration (s)", "audiobookDuration": "Audiobook Duration (s)",
"audiobookCodec": "Codec", "audiobookCodec": "Codec",
@@ -5290,31 +5218,9 @@
"seriesTotal": "Series Total", "seriesTotal": "Series Total",
"isbn13": "ISBN-13", "isbn13": "ISBN-13",
"isbn10": "ISBN-10", "isbn10": "ISBN-10",
"asin": "ASIN",
"ageRating": "Age Rating", "ageRating": "Age Rating",
"contentRating": "Content Rating", "contentRating": "Content Rating",
"personalRating": "Personal Rating", "personalRating": "Personal Rating",
"amazonRating": "Amazon Rating",
"goodreadsRating": "Goodreads Rating",
"hardcoverRating": "Hardcover Rating",
"ranobedbRating": "Ranobedb Rating",
"lubimyczytacRating": "LubimyCzytac Rating",
"audibleRating": "Audible Rating",
"applebooksRating": "Apple Books Rating",
"amazonReviewCount": "Amazon Reviews",
"goodreadsReviewCount": "Goodreads Reviews",
"hardcoverReviewCount": "Hardcover Reviews",
"audibleReviewCount": "Audible Reviews",
"applebooksReviewCount": "Apple Books Review Count",
"openlibraryId": "OpenLibrary ID",
"goodreadsId": "Goodreads ID",
"hardcoverId": "Hardcover ID",
"googleId": "Google ID",
"audibleId": "Audible ID",
"applebooksId": "Apple Books ID",
"lubimyczytacId": "Lubimyczytac ID",
"ranobedbId": "Ranobedb ID",
"comicvineId": "ComicVine ID",
"narrator": "Narrator", "narrator": "Narrator",
"abridged": "Abridged", "abridged": "Abridged",
"audiobookDuration": "Duration", "audiobookDuration": "Duration",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "Número de páginas", "pageCount": "Número de páginas",
"amazonRating": "Valoración de Amazon",
"amazonReviewCount": "Valoración de Amazon #",
"goodreadsRating": "Valoración de Goodreads",
"goodreadsReviewCount": "Valoración de Goodreads #",
"hardcoverRating": "Valoración de Hardcover",
"hardcoverReviewCount": "Valoración de Hardcover #",
"audibleRating": "Valoración de Audible",
"audibleReviewCount": "Valoración de Audible #",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Valoración de Douban", "doubanRating": "Valoración de Douban",
"doubanReviewCount": "Valoración de Douban #", "doubanReviewCount": "Valoración de Douban #"
"ranobedbRating": "Valoración de Ranobedb"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Campos habilitados en el editor y selector de metadatos", "sectionTitle": "Campos habilitados en el editor y selector de metadatos",
"sectionDesc": "Selecciona qué campos de metadatos mostrar al editar información del libro o seleccionar metadatos de proveedores. Los campos deshabilitados se ocultarán de la interfaz.", "sectionDesc": "Selecciona qué campos de metadatos mostrar al editar información del libro o seleccionar metadatos de proveedores. Los campos deshabilitados se ocultarán de la interfaz."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "Valoración de Amazon",
"amazonReviewCount": "Reseñas de Amazon",
"googleId": "ID de Google Books",
"goodreadsId": "ID de Goodreads",
"goodreadsRating": "Valoración de Goodreads",
"goodreadsReviewCount": "Reseñas de Goodreads",
"hardcoverId": "ID de Hardcover",
"hardcoverBookId": "ID de libro Hardcover",
"hardcoverRating": "Valoración de Hardcover",
"hardcoverReviewCount": "Reseñas de Hardcover",
"comicvineId": "ID de Comicvine",
"lubimyczytacId": "ID de Lubimyczytac",
"lubimyczytacRating": "Valoración de Lubimyczytac",
"ranobedbId": "ID de Ranobedb",
"ranobedbRating": "Valoración de Ranobedb",
"audibleId": "ID de Audible",
"audibleRating": "Valoración de Audible",
"audibleReviewCount": "Reseñas de Audible",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalles del audiolibro", "audiobookDetails": "Detalles del audiolibro",
"comicBookDetails": "Detalles del cómic", "comicBookDetails": "Detalles del cómic",
"providerMetadata": "Metadatos del proveedor", "providerMetadata": "Metadatos del proveedor",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "ID de Google Books",
"goodreadsId": "ID de Goodreads",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "ID de Hardcover",
"hardcoverBookId": "ID de libro Hardcover",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "ID de Lubimyczytac",
"lubimyczytacRating": "",
"comicvineId": "ID de Comicvine",
"ranobedbId": "ID de Ranobedb",
"ranobedbRating": "",
"audibleId": "ID de Audible",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Cerrar", "closeBtn": "Cerrar",
"previousBookBtn": "Libro anterior", "previousBookBtn": "Libro anterior",
"nextBookBtn": "Libro siguiente", "nextBookBtn": "Libro siguiente",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Cargando metadatos completos...",
"columnCurrent": "Actual", "columnCurrent": "Actual",
"columnFetched": "Obtenido", "columnFetched": "Obtenido",
"copyMissingTooltip": "Copiar campos faltantes", "copyMissingTooltip": "Copiar campos faltantes",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Ingresa tus criterios de búsqueda arriba y haz clic en Buscar para encontrar metadatos", "readyToSearchHint": "Ingresa tus criterios de búsqueda arriba y haz clic en Buscar para encontrar metadatos",
"noResultsFound": "No se encontraron resultados", "noResultsFound": "No se encontraron resultados",
"noResultsHint": "Intenta ajustar tus criterios de búsqueda o seleccionar otros proveedores", "noResultsHint": "Intenta ajustar tus criterios de búsqueda o seleccionar otros proveedores",
"unknownProvider": "",
"selectOverlay": "Seleccionar" "selectOverlay": "Seleccionar"
}, },
"tabs": { "tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Tamaño del Archivo (Kb)", "fileSize": "Tamaño del Archivo (Kb)",
"fileType": "Tipo de Archivo", "fileType": "Tipo de Archivo",
"subtitle": "Subtítulo", "subtitle": "Subtítulo",
"amazonRating": "Calificación de Amazon",
"amazonReviewCount": "Cantidad de Reseñas de Amazon",
"goodreadsRating": "Calificación de Goodreads",
"goodreadsReviewCount": "Cantidad de Reseñas de Goodreads",
"hardcoverRating": "Calificación de Hardcover",
"hardcoverReviewCount": "Cantidad de Reseñas de Hardcover",
"ranobedbRating": "Calificación de Ranobedb",
"genre": "Género", "genre": "Género",
"addedOn": "Fecha de Agregado", "addedOn": "Fecha de Agregado",
"lubimyczytacRating": "Calificación de Lubimyczytac",
"description": "Descripción", "description": "Descripción",
"narrator": "Narrador", "narrator": "Narrador",
"ageRating": "Clasificación por Edad", "ageRating": "Clasificación por Edad",
"contentRating": "Clasificación de Contenido", "contentRating": "Clasificación de Contenido",
"audibleRating": "Calificación de Audible",
"audibleReviewCount": "Cantidad de Reseñas de Audible",
"abridged": "Abreviado", "abridged": "Abreviado",
"audiobookDuration": "Duración del Audiolibro (s)", "audiobookDuration": "Duración del Audiolibro (s)",
"audiobookCodec": "Códec", "audiobookCodec": "Códec",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Total de la Serie", "seriesTotal": "Total de la Serie",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Clasificación por Edad", "ageRating": "Clasificación por Edad",
"contentRating": "Clasificación de Contenido", "contentRating": "Clasificación de Contenido",
"personalRating": "Calificación Personal", "personalRating": "Calificación Personal",
"amazonRating": "Calificación de Amazon",
"goodreadsRating": "Calificación de Goodreads",
"hardcoverRating": "Calificación de Hardcover",
"ranobedbRating": "Calificación de Ranobedb",
"lubimyczytacRating": "Calificación de Lubimyczytac",
"audibleRating": "Calificación de Audible",
"applebooksRating": "",
"amazonReviewCount": "Reseñas de Amazon",
"goodreadsReviewCount": "Reseñas de Goodreads",
"hardcoverReviewCount": "Reseñas de Hardcover",
"audibleReviewCount": "Reseñas de Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID de Goodreads",
"hardcoverId": "ID de Hardcover",
"googleId": "ID de Google",
"audibleId": "ID de Audible",
"applebooksId": "",
"lubimyczytacId": "ID de Lubimyczytac",
"ranobedbId": "ID de Ranobedb",
"comicvineId": "ID de ComicVine",
"narrator": "Narrador", "narrator": "Narrador",
"abridged": "Abreviado", "abridged": "Abreviado",
"audiobookDuration": "Duración", "audiobookDuration": "Duración",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Champs activés dans l'éditeur et le sélecteur de métadonnées", "sectionTitle": "Champs activés dans l'éditeur et le sélecteur de métadonnées",
"sectionDesc": "Sélectionnez les champs de métadonnées à afficher lors de la modification des informations du livre ou de la sélection de métadonnées provenant de fournisseurs. Les champs désactivés seront masqués de l'interface.", "sectionDesc": "Sélectionnez les champs de métadonnées à afficher lors de la modification des informations du livre ou de la sélection de métadonnées provenant de fournisseurs. Les champs désactivés seront masqués de l'interface."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Détails du livre audio", "audiobookDetails": "Détails du livre audio",
"comicBookDetails": "Détails de la bande dessinée", "comicBookDetails": "Détails de la bande dessinée",
"providerMetadata": "Métadonnées du fournisseur", "providerMetadata": "Métadonnées du fournisseur",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Fermer", "closeBtn": "Fermer",
"previousBookBtn": "Livre précédent", "previousBookBtn": "Livre précédent",
"nextBookBtn": "Livre suivant", "nextBookBtn": "Livre suivant",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Chargement des métadonnées complètes...",
"columnCurrent": "Actuel", "columnCurrent": "Actuel",
"columnFetched": "Récupéré", "columnFetched": "Récupéré",
"copyMissingTooltip": "Copier les champs manquants", "copyMissingTooltip": "Copier les champs manquants",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Entrez vos critères de recherche ci-dessus et cliquez sur Rechercher pour trouver des métadonnées", "readyToSearchHint": "Entrez vos critères de recherche ci-dessus et cliquez sur Rechercher pour trouver des métadonnées",
"noResultsFound": "Aucun résultat trouvé", "noResultsFound": "Aucun résultat trouvé",
"noResultsHint": "Essayez d'ajuster vos critères de recherche ou de sélectionner d'autres fournisseurs", "noResultsHint": "Essayez d'ajuster vos critères de recherche ou de sélectionner d'autres fournisseurs",
"unknownProvider": "",
"selectOverlay": "Sélectionner" "selectOverlay": "Sélectionner"
}, },
"tabs": { "tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Taille du fichier (Ko)", "fileSize": "Taille du fichier (Ko)",
"fileType": "Type de fichier", "fileType": "Type de fichier",
"subtitle": "Sous-titre", "subtitle": "Sous-titre",
"amazonRating": "Note Amazon",
"amazonReviewCount": "Nombre d'avis Amazon",
"goodreadsRating": "Note Goodreads",
"goodreadsReviewCount": "Nombre d'avis Goodreads",
"hardcoverRating": "Note Hardcover",
"hardcoverReviewCount": "Nombre d'avis Hardcover",
"ranobedbRating": "Note Ranobedb",
"genre": "", "genre": "",
"addedOn": "Date d'ajout", "addedOn": "Date d'ajout",
"lubimyczytacRating": "Note Lubimyczytac",
"description": "", "description": "",
"narrator": "Narrateur", "narrator": "Narrateur",
"ageRating": "Classification d'âge", "ageRating": "Classification d'âge",
"contentRating": "Classification de contenu", "contentRating": "Classification de contenu",
"audibleRating": "Note Audible",
"audibleReviewCount": "Nombre d'avis Audible",
"abridged": "Abrégé", "abridged": "Abrégé",
"audiobookDuration": "Durée du livre audio (s)", "audiobookDuration": "Durée du livre audio (s)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Total de la série", "seriesTotal": "Total de la série",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Classification d'âge", "ageRating": "Classification d'âge",
"contentRating": "Classification de contenu", "contentRating": "Classification de contenu",
"personalRating": "Note personnelle", "personalRating": "Note personnelle",
"amazonRating": "Note Amazon",
"goodreadsRating": "Note Goodreads",
"hardcoverRating": "Note Hardcover",
"ranobedbRating": "Note Ranobedb",
"lubimyczytacRating": "Note Lubimyczytac",
"audibleRating": "Note Audible",
"applebooksRating": "",
"amazonReviewCount": "Avis Amazon",
"goodreadsReviewCount": "Avis Goodreads",
"hardcoverReviewCount": "Avis Hardcover",
"audibleReviewCount": "Avis Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "Narrateur", "narrator": "Narrateur",
"abridged": "Abrégé", "abridged": "Abrégé",
"audiobookDuration": "Durée", "audiobookDuration": "Durée",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "ISBN-13", "isbn13": "ISBN-13",
"isbn10": "ISBN-10", "isbn10": "ISBN-10",
"pageCount": "Broj stranica", "pageCount": "Broj stranica",
"amazonRating": "Ocjena na Amazonu",
"amazonReviewCount": "Ocjena na Amazonu #",
"goodreadsRating": "Ocjena na Goodreadsu",
"goodreadsReviewCount": "Ocjena na Goodreadsu #",
"hardcoverRating": "Ocjena Hardcover",
"hardcoverReviewCount": "Ocjena Hardcover #",
"audibleRating": "Ocjena Audible",
"audibleReviewCount": "Ocjena Audible #",
"applebooksId": "Apple Books ID",
"applebooksRating": "Apple Books ★",
"applebooksReviewCount": "Apple Books #",
"doubanRating": "Ocjena Douban", "doubanRating": "Ocjena Douban",
"doubanReviewCount": "Ocjena Douban #", "doubanReviewCount": "Ocjena Douban #"
"ranobedbRating": "Ocjena Ranobedb"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Omogućena polja u uređivaču i biraču metapodataka", "sectionTitle": "Omogućena polja u uređivaču i biraču metapodataka",
"sectionDesc": "Odaberite koja polja metapodataka prikazivati prilikom uređivanja informacija o knjizi ili biranja metapodataka od pružatelja. Onemogućena polja će biti skrivena iz sučelja.", "sectionDesc": "Odaberite koja polja metapodataka prikazivati prilikom uređivanja informacija o knjizi ili biranja metapodataka od pružatelja. Onemogućena polja će biti skrivena iz sučelja."
"providers": {
"openlibrary": "OpenLibrary",
"amazon": "Amazon",
"googleBooks": "Google knjige",
"goodreads": "Goodreads",
"hardcover": "Hardcover",
"audible": "Audible",
"applebooks": "Apple Books",
"comicvine": "Comicvine",
"lubimyczytac": "Lubimyczytac",
"ranobedb": "Ranobedb"
},
"fields": {
"openlibraryId": "OpenLibrary ID",
"asin": "Amazon ASIN",
"amazonRating": "Ocjena na Amazonu",
"amazonReviewCount": "Broj recenzija na Amazonu",
"googleId": "ID Google knjiga",
"goodreadsId": "Goodreads ID",
"goodreadsRating": "Ocjena na Goodreadsu",
"goodreadsReviewCount": "Broj recenzija na Goodreadsu",
"hardcoverId": "Hardcover ID",
"hardcoverBookId": "ID Hardcover knjige",
"hardcoverRating": "Hardcover ocjena",
"hardcoverReviewCount": "Broj recenzija na Hardcoveru",
"comicvineId": "Comicvine ID",
"lubimyczytacId": "Lubimyczytac ID",
"lubimyczytacRating": "Ocjena LubimyCzytac",
"ranobedbId": "Ranobedb ID",
"ranobedbRating": "Ocjena Ranobedb-a",
"audibleId": "Audible ID",
"audibleRating": "Audible ocjena",
"audibleReviewCount": "Broj recenzija na Audible",
"applebooksId": "Apple Books ID",
"applebooksRating": "Ocjena na Apple Books",
"applebooksReviewCount": "Broj recenzija na Apple Booksu"
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalji audioknjige", "audiobookDetails": "Detalji audioknjige",
"comicBookDetails": "Detalji stripa", "comicBookDetails": "Detalji stripa",
"providerMetadata": "Metapodaci pružatelja", "providerMetadata": "Metapodaci pružatelja",
"openlibraryId": "OpenLibrary ID",
"amazonAsin": "Amazon ASIN",
"amazonRating": "Amazon ★",
"amazonReviewCount": "Amazon #",
"googleBooksId": "Google Books ID",
"goodreadsId": "Goodreads ID",
"goodreadsRating": "Goodreads ★",
"goodreadsReviewCount": "Goodreads #",
"hardcoverId": "Hardcover ID",
"hardcoverBookId": "Hardcover Book ID",
"hardcoverRating": "Hardcover ★",
"hardcoverReviewCount": "Hardcover #",
"lubimyczytacId": "Lubimyczytac ID",
"lubimyczytacRating": "Lubimyczytac ★",
"comicvineId": "Comicvine ID",
"ranobedbId": "Ranobedb ID",
"ranobedbRating": "Ranobedb ★",
"audibleId": "Audible ID",
"audibleRating": "Audible ★",
"audibleReviewCount": "Audible #",
"applebooksId": "Apple Books ID",
"applebooksRating": "Apple Books ★",
"applebooksReviewCount": "Apple Books #",
"closeBtn": "Zatvori", "closeBtn": "Zatvori",
"previousBookBtn": "Prethodna knjiga", "previousBookBtn": "Prethodna knjiga",
"nextBookBtn": "Sljedeća knjiga", "nextBookBtn": "Sljedeća knjiga",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Učitavanje potpunih metapodataka...",
"columnCurrent": "Trenutno", "columnCurrent": "Trenutno",
"columnFetched": "Dohvaćeno", "columnFetched": "Dohvaćeno",
"copyMissingTooltip": "Kopiraj polja koja nedostaju", "copyMissingTooltip": "Kopiraj polja koja nedostaju",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Unesite kriterije pretrage iznad i kliknite Pretraži za pronalaženje metapodataka", "readyToSearchHint": "Unesite kriterije pretrage iznad i kliknite Pretraži za pronalaženje metapodataka",
"noResultsFound": "Nema pronađenih rezultata", "noResultsFound": "Nema pronađenih rezultata",
"noResultsHint": "Pokušajte prilagoditi kriterije pretrage ili odabrati druge pružatelje", "noResultsHint": "Pokušajte prilagoditi kriterije pretrage ili odabrati druge pružatelje",
"unknownProvider": "Nepoznati pružatelj usluge",
"selectOverlay": "Odaberi" "selectOverlay": "Odaberi"
}, },
"tabs": { "tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Veličina datoteke (Kb)", "fileSize": "Veličina datoteke (Kb)",
"fileType": "Vrsta datoteke", "fileType": "Vrsta datoteke",
"subtitle": "Podnaslov", "subtitle": "Podnaslov",
"amazonRating": "Amazon ocjena",
"amazonReviewCount": "Amazon broj recenzija",
"goodreadsRating": "Goodreads ocjena",
"goodreadsReviewCount": "Goodreads broj recenzija",
"hardcoverRating": "Hardcover ocjena",
"hardcoverReviewCount": "Hardcover broj recenzija",
"ranobedbRating": "Ranobedb ocjena",
"genre": "Žanr", "genre": "Žanr",
"addedOn": "Datum dodavanja", "addedOn": "Datum dodavanja",
"lubimyczytacRating": "Lubimyczytac ocjena",
"description": "Opis", "description": "Opis",
"narrator": "Narator", "narrator": "Narator",
"ageRating": "Dobna ocjena", "ageRating": "Dobna ocjena",
"contentRating": "Ocjena sadržaja", "contentRating": "Ocjena sadržaja",
"audibleRating": "Audible ocjena",
"audibleReviewCount": "Audible broj recenzija",
"abridged": "Skraćeno", "abridged": "Skraćeno",
"audiobookDuration": "Trajanje audioknjige (s)", "audiobookDuration": "Trajanje audioknjige (s)",
"audiobookCodec": "Kodek", "audiobookCodec": "Kodek",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Ukupno u serijalu", "seriesTotal": "Ukupno u serijalu",
"isbn13": "ISBN-13", "isbn13": "ISBN-13",
"isbn10": "ISBN-10", "isbn10": "ISBN-10",
"asin": "ASIN",
"ageRating": "Dobna ocjena", "ageRating": "Dobna ocjena",
"contentRating": "Ocjena sadržaja", "contentRating": "Ocjena sadržaja",
"personalRating": "Osobna ocjena", "personalRating": "Osobna ocjena",
"amazonRating": "Amazon ocjena",
"goodreadsRating": "Goodreads ocjena",
"hardcoverRating": "Hardcover ocjena",
"ranobedbRating": "Ranobedb ocjena",
"lubimyczytacRating": "Lubimyczytac ocjena",
"audibleRating": "Audible ocjena",
"applebooksRating": "Ocjena na Apple Books",
"amazonReviewCount": "Amazon recenzije",
"goodreadsReviewCount": "Goodreads recenzije",
"hardcoverReviewCount": "Hardcover recenzije",
"audibleReviewCount": "Audible recenzije",
"applebooksReviewCount": "Broj recenzija na Apple Booksu",
"openlibraryId": "OpenLibrary ID",
"goodreadsId": "Goodreads ID",
"hardcoverId": "Hardcover ID",
"googleId": "Google ID",
"audibleId": "Audible ID",
"applebooksId": "Apple Books ID",
"lubimyczytacId": "Lubimyczytac ID",
"ranobedbId": "Ranobedb ID",
"comicvineId": "ComicVine ID",
"narrator": "Narator", "narrator": "Narator",
"abridged": "Skraćeno", "abridged": "Skraćeno",
"audiobookDuration": "Trajanje", "audiobookDuration": "Trajanje",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5093,22 +5019,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5238,31 +5154,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Tutup", "closeBtn": "Tutup",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "Dimuat", "columnFetched": "Dimuat",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "Pilih" "selectOverlay": "Pilih"
}, },
"tabs": { "tabs": {
@@ -5083,22 +5009,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "Subjudul", "subtitle": "Subjudul",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "Deskripsi", "description": "Deskripsi",
"narrator": "Narator", "narrator": "Narator",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "Ringkasan", "abridged": "Ringkasan",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "Kodek", "audiobookCodec": "Kodek",
@@ -5228,31 +5144,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "Narator", "narrator": "Narator",
"abridged": "Ringkasan", "abridged": "Ringkasan",
"audiobookDuration": "Durasi", "audiobookDuration": "Durasi",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Campi abilitati nell'editor e selettore metadati", "sectionTitle": "Campi abilitati nell'editor e selettore metadati",
"sectionDesc": "Seleziona quali campi metadati visualizzare durante la modifica delle informazioni del libro o la selezione dei metadati dai provider. I campi disabilitati saranno nascosti dall'interfaccia.", "sectionDesc": "Seleziona quali campi metadati visualizzare durante la modifica delle informazioni del libro o la selezione dei metadati dai provider. I campi disabilitati saranno nascosti dall'interfaccia."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Dettagli audiolibro", "audiobookDetails": "Dettagli audiolibro",
"comicBookDetails": "Dettagli fumetto", "comicBookDetails": "Dettagli fumetto",
"providerMetadata": "Metadati provider", "providerMetadata": "Metadati provider",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "ID Google Books",
"goodreadsId": "ID Goodreads",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "ID Hardcover",
"hardcoverBookId": "ID libro Hardcover",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "ID Lubimyczytac",
"lubimyczytacRating": "",
"comicvineId": "ID Comicvine",
"ranobedbId": "ID Ranobedb",
"ranobedbRating": "",
"audibleId": "ID Audible",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Chiudi", "closeBtn": "Chiudi",
"previousBookBtn": "Libro precedente", "previousBookBtn": "Libro precedente",
"nextBookBtn": "Libro successivo", "nextBookBtn": "Libro successivo",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Caricamento metadati completi...",
"columnCurrent": "Corrente", "columnCurrent": "Corrente",
"columnFetched": "Recuperato", "columnFetched": "Recuperato",
"copyMissingTooltip": "Copia campi mancanti", "copyMissingTooltip": "Copia campi mancanti",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Inserisci i criteri di ricerca sopra e clicca Cerca per trovare i metadati", "readyToSearchHint": "Inserisci i criteri di ricerca sopra e clicca Cerca per trovare i metadati",
"noResultsFound": "Nessun risultato trovato", "noResultsFound": "Nessun risultato trovato",
"noResultsHint": "Prova a modificare i criteri di ricerca o seleziona provider diversi", "noResultsHint": "Prova a modificare i criteri di ricerca o seleziona provider diversi",
"unknownProvider": "",
"selectOverlay": "Seleziona" "selectOverlay": "Seleziona"
}, },
"tabs": { "tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Dimensione file (Kb)", "fileSize": "Dimensione file (Kb)",
"fileType": "Tipo file", "fileType": "Tipo file",
"subtitle": "Sottotitolo", "subtitle": "Sottotitolo",
"amazonRating": "Valutazione Amazon",
"amazonReviewCount": "Numero recensioni Amazon",
"goodreadsRating": "Valutazione Goodreads",
"goodreadsReviewCount": "Numero recensioni Goodreads",
"hardcoverRating": "Valutazione Hardcover",
"hardcoverReviewCount": "Numero recensioni Hardcover",
"ranobedbRating": "Valutazione Ranobedb",
"genre": "Genere", "genre": "Genere",
"addedOn": "Data aggiunta", "addedOn": "Data aggiunta",
"lubimyczytacRating": "Valutazione Lubimyczytac",
"description": "Descrizione", "description": "Descrizione",
"narrator": "Narratore", "narrator": "Narratore",
"ageRating": "Classificazione età", "ageRating": "Classificazione età",
"contentRating": "Classificazione contenuto", "contentRating": "Classificazione contenuto",
"audibleRating": "Valutazione Audible",
"audibleReviewCount": "Numero recensioni Audible",
"abridged": "Ridotto", "abridged": "Ridotto",
"audiobookDuration": "Durata audiolibro (s)", "audiobookDuration": "Durata audiolibro (s)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Totale serie", "seriesTotal": "Totale serie",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Classificazione età", "ageRating": "Classificazione età",
"contentRating": "Classificazione contenuto", "contentRating": "Classificazione contenuto",
"personalRating": "Valutazione personale", "personalRating": "Valutazione personale",
"amazonRating": "Valutazione Amazon",
"goodreadsRating": "Valutazione Goodreads",
"hardcoverRating": "Valutazione Hardcover",
"ranobedbRating": "Valutazione Ranobedb",
"lubimyczytacRating": "Valutazione Lubimyczytac",
"audibleRating": "Valutazione Audible",
"applebooksRating": "",
"amazonReviewCount": "Recensioni Amazon",
"goodreadsReviewCount": "Recensioni Goodreads",
"hardcoverReviewCount": "Recensioni Hardcover",
"audibleReviewCount": "Recensioni Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID Goodreads",
"hardcoverId": "ID Hardcover",
"googleId": "ID Google",
"audibleId": "ID Audible",
"applebooksId": "",
"lubimyczytacId": "ID Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"comicvineId": "ID ComicVine",
"narrator": "Narratore", "narrator": "Narratore",
"abridged": "Ridotto", "abridged": "Ridotto",
"audiobookDuration": "Durata", "audiobookDuration": "Durata",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "メタデータエディタとピッカーの有効フィールド", "sectionTitle": "メタデータエディタとピッカーの有効フィールド",
"sectionDesc": "本の情報を編集したりプロバイダーからメタデータを選択する際に表示するメタデータフィールドを選択します。無効なフィールドはインターフェースに表示されません。", "sectionDesc": "本の情報を編集したりプロバイダーからメタデータを選択する際に表示するメタデータフィールドを選択します。無効なフィールドはインターフェースに表示されません。"
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "オーディオブック詳細", "audiobookDetails": "オーディオブック詳細",
"comicBookDetails": "コミックブック詳細", "comicBookDetails": "コミックブック詳細",
"providerMetadata": "プロバイダーメタデータ", "providerMetadata": "プロバイダーメタデータ",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "閉じる", "closeBtn": "閉じる",
"previousBookBtn": "前の本", "previousBookBtn": "前の本",
"nextBookBtn": "次の本", "nextBookBtn": "次の本",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "完全なメタデータを読み込み中...",
"columnCurrent": "現在", "columnCurrent": "現在",
"columnFetched": "取得済み", "columnFetched": "取得済み",
"copyMissingTooltip": "欠損フィールドをコピー", "copyMissingTooltip": "欠損フィールドをコピー",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "上に検索条件を入力して「検索」をクリックするとメタデータを検索できます", "readyToSearchHint": "上に検索条件を入力して「検索」をクリックするとメタデータを検索できます",
"noResultsFound": "結果が見つかりません", "noResultsFound": "結果が見つかりません",
"noResultsHint": "検索条件を調整するか、別のプロバイダーを選択してみてください", "noResultsHint": "検索条件を調整するか、別のプロバイダーを選択してみてください",
"unknownProvider": "",
"selectOverlay": "選択" "selectOverlay": "選択"
}, },
"tabs": { "tabs": {
@@ -5108,22 +5034,12 @@
"fileSize": "ファイルサイズ (Kb)", "fileSize": "ファイルサイズ (Kb)",
"fileType": "ファイルタイプ", "fileType": "ファイルタイプ",
"subtitle": "サブタイトル", "subtitle": "サブタイトル",
"amazonRating": "Amazon評価",
"amazonReviewCount": "Amazonレビュー数",
"goodreadsRating": "Goodreads評価",
"goodreadsReviewCount": "Goodreadsレビュー数",
"hardcoverRating": "Hardcover評価",
"hardcoverReviewCount": "Hardcoverレビュー数",
"ranobedbRating": "Ranobedb評価",
"genre": "ジャンル", "genre": "ジャンル",
"addedOn": "追加日", "addedOn": "追加日",
"lubimyczytacRating": "Lubimyczytac評価",
"description": "説明", "description": "説明",
"narrator": "ナレーター", "narrator": "ナレーター",
"ageRating": "年齢制限", "ageRating": "年齢制限",
"contentRating": "コンテンツレーティング", "contentRating": "コンテンツレーティング",
"audibleRating": "Audible評価",
"audibleReviewCount": "Audibleレビュー数",
"abridged": "要約版", "abridged": "要約版",
"audiobookDuration": "オーディオブックの長さ (秒)", "audiobookDuration": "オーディオブックの長さ (秒)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5253,31 +5169,9 @@
"seriesTotal": "シリーズ合計", "seriesTotal": "シリーズ合計",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "年齢制限", "ageRating": "年齢制限",
"contentRating": "コンテンツレーティング", "contentRating": "コンテンツレーティング",
"personalRating": "個人評価", "personalRating": "個人評価",
"amazonRating": "Amazon評価",
"goodreadsRating": "Goodreads評価",
"hardcoverRating": "Hardcover評価",
"ranobedbRating": "Ranobedb評価",
"lubimyczytacRating": "Lubimyczytac評価",
"audibleRating": "Audible評価",
"applebooksRating": "",
"amazonReviewCount": "Amazonレビュー",
"goodreadsReviewCount": "Goodreadsレビュー",
"hardcoverReviewCount": "Hardcoverレビュー",
"audibleReviewCount": "Audibleレビュー",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "ナレーター", "narrator": "ナレーター",
"abridged": "要約版", "abridged": "要約版",
"audiobookDuration": "再生時間", "audiobookDuration": "再生時間",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5093,22 +5019,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5238,31 +5154,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Włączone pola w edytorze i selekcji metadanych", "sectionTitle": "Włączone pola w edytorze i selekcji metadanych",
"sectionDesc": "Wybierz, które pola metadanych wyświetlać podczas edycji informacji o książce lub wybierania metadanych od dostawców. Wyłączone pola zostaną ukryte z interfejsu.", "sectionDesc": "Wybierz, które pola metadanych wyświetlać podczas edycji informacji o książce lub wybierania metadanych od dostawców. Wyłączone pola zostaną ukryte z interfejsu."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Szczegóły audiobooka", "audiobookDetails": "Szczegóły audiobooka",
"comicBookDetails": "Szczegóły komiksu", "comicBookDetails": "Szczegóły komiksu",
"providerMetadata": "Metadane dostawcy", "providerMetadata": "Metadane dostawcy",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Zamknij", "closeBtn": "Zamknij",
"previousBookBtn": "Poprzednia książka", "previousBookBtn": "Poprzednia książka",
"nextBookBtn": "Następna książka", "nextBookBtn": "Następna książka",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Ładowanie pełnych metadanych...",
"columnCurrent": "Aktualne", "columnCurrent": "Aktualne",
"columnFetched": "Pobrane", "columnFetched": "Pobrane",
"copyMissingTooltip": "Skopiuj brakujące pola", "copyMissingTooltip": "Skopiuj brakujące pola",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Wprowadź kryteria wyszukiwania powyżej i kliknij Szukaj, aby znaleźć metadane", "readyToSearchHint": "Wprowadź kryteria wyszukiwania powyżej i kliknij Szukaj, aby znaleźć metadane",
"noResultsFound": "Nie znaleziono wyników", "noResultsFound": "Nie znaleziono wyników",
"noResultsHint": "Spróbuj zmienić kryteria wyszukiwania lub wybrać innych dostawców", "noResultsHint": "Spróbuj zmienić kryteria wyszukiwania lub wybrać innych dostawców",
"unknownProvider": "",
"selectOverlay": "Wybierz" "selectOverlay": "Wybierz"
}, },
"tabs": { "tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Rozmiar pliku (KB)", "fileSize": "Rozmiar pliku (KB)",
"fileType": "Typ pliku", "fileType": "Typ pliku",
"subtitle": "Podtytuł", "subtitle": "Podtytuł",
"amazonRating": "Ocena Amazon",
"amazonReviewCount": "Liczba recenzji Amazon",
"goodreadsRating": "Ocena Goodreads",
"goodreadsReviewCount": "Liczba recenzji Goodreads",
"hardcoverRating": "Ocena Hardcover",
"hardcoverReviewCount": "Liczba recenzji Hardcover",
"ranobedbRating": "Ocena Ranobedb",
"genre": "Gatunek", "genre": "Gatunek",
"addedOn": "Data dodania", "addedOn": "Data dodania",
"lubimyczytacRating": "Ocena Lubimyczytac",
"description": "Opis", "description": "Opis",
"narrator": "", "narrator": "",
"ageRating": "Kategoria wiekowa", "ageRating": "Kategoria wiekowa",
"contentRating": "Ocena treści", "contentRating": "Ocena treści",
"audibleRating": "Ocena Audible",
"audibleReviewCount": "Liczba recenzji Audible",
"abridged": "Skrócona", "abridged": "Skrócona",
"audiobookDuration": "Czas trwania audiobooka (s)", "audiobookDuration": "Czas trwania audiobooka (s)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Łącznie w serii", "seriesTotal": "Łącznie w serii",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Kategoria wiekowa", "ageRating": "Kategoria wiekowa",
"contentRating": "Ocena treści", "contentRating": "Ocena treści",
"personalRating": "Ocena osobista", "personalRating": "Ocena osobista",
"amazonRating": "Ocena Amazon",
"goodreadsRating": "Ocena Goodreads",
"hardcoverRating": "Ocena Hardcover",
"ranobedbRating": "Ocena Ranobedb",
"lubimyczytacRating": "Ocena Lubimyczytac",
"audibleRating": "Ocena Audible",
"applebooksRating": "",
"amazonReviewCount": "Recenzje Amazon",
"goodreadsReviewCount": "Recenzje Goodreads",
"hardcoverReviewCount": "Recenzje Hardcover",
"audibleReviewCount": "Recenzje Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID Goodreads",
"hardcoverId": "ID Hardcover",
"googleId": "ID Google",
"audibleId": "ID Audible",
"applebooksId": "",
"lubimyczytacId": "ID Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"comicvineId": "ID ComicVine",
"narrator": "", "narrator": "",
"abridged": "Skrócona", "abridged": "Skrócona",
"audiobookDuration": "Czas trwania", "audiobookDuration": "Czas trwania",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Campos Ativados no Editor e Seletor de Metadados", "sectionTitle": "Campos Ativados no Editor e Seletor de Metadados",
"sectionDesc": "Selecione quais campos de metadados exibir ao editar informações do livro ou selecionar metadados de provedores. Campos desativados serão ocultados da interface.", "sectionDesc": "Selecione quais campos de metadados exibir ao editar informações do livro ou selecionar metadados de provedores. Campos desativados serão ocultados da interface."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalhes do Audiolivro", "audiobookDetails": "Detalhes do Audiolivro",
"comicBookDetails": "Detalhes de Quadrinhos", "comicBookDetails": "Detalhes de Quadrinhos",
"providerMetadata": "Metadados do Provedor", "providerMetadata": "Metadados do Provedor",
"openlibraryId": "",
"amazonAsin": "ASIN da Amazon",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "ID do Google Books",
"goodreadsId": "ID do Goodreads",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "ID do Hardcover",
"hardcoverBookId": "ID do Livro Hardcover",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "ID do Lubimyczytac",
"lubimyczytacRating": "",
"comicvineId": "ID do Comicvine",
"ranobedbId": "ID do Ranobedb",
"ranobedbRating": "",
"audibleId": "ID do Audible",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Fechar", "closeBtn": "Fechar",
"previousBookBtn": "Livro Anterior", "previousBookBtn": "Livro Anterior",
"nextBookBtn": "Próximo Livro", "nextBookBtn": "Próximo Livro",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Carregando metadados completos...",
"columnCurrent": "Atual", "columnCurrent": "Atual",
"columnFetched": "Obtido", "columnFetched": "Obtido",
"copyMissingTooltip": "Copiar campos ausentes", "copyMissingTooltip": "Copiar campos ausentes",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Insira seus critérios de busca acima e clique em Pesquisar para encontrar metadados", "readyToSearchHint": "Insira seus critérios de busca acima e clique em Pesquisar para encontrar metadados",
"noResultsFound": "Nenhum Resultado Encontrado", "noResultsFound": "Nenhum Resultado Encontrado",
"noResultsHint": "Tente ajustar seus critérios de busca ou selecionar provedores diferentes", "noResultsHint": "Tente ajustar seus critérios de busca ou selecionar provedores diferentes",
"unknownProvider": "",
"selectOverlay": "Selecionar" "selectOverlay": "Selecionar"
}, },
"tabs": { "tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Tamanho do Arquivo (Kb)", "fileSize": "Tamanho do Arquivo (Kb)",
"fileType": "Tipo de Arquivo", "fileType": "Tipo de Arquivo",
"subtitle": "Subtítulo", "subtitle": "Subtítulo",
"amazonRating": "Avaliação Amazon",
"amazonReviewCount": "Contagem de Avaliações Amazon",
"goodreadsRating": "Avaliação Goodreads",
"goodreadsReviewCount": "Contagem de Avaliações Goodreads",
"hardcoverRating": "Avaliação Hardcover",
"hardcoverReviewCount": "Contagem de Avaliações Hardcover",
"ranobedbRating": "Avaliação Ranobedb",
"genre": "Gênero", "genre": "Gênero",
"addedOn": "Data de Adição", "addedOn": "Data de Adição",
"lubimyczytacRating": "Avaliação Lubimyczytac",
"description": "Descrição", "description": "Descrição",
"narrator": "Narrador", "narrator": "Narrador",
"ageRating": "Classificação Etária", "ageRating": "Classificação Etária",
"contentRating": "Classificação de Conteúdo", "contentRating": "Classificação de Conteúdo",
"audibleRating": "Avaliação Audible",
"audibleReviewCount": "Contagem de Avaliações Audible",
"abridged": "Abreviado", "abridged": "Abreviado",
"audiobookDuration": "Duração do Audiolivro (s)", "audiobookDuration": "Duração do Audiolivro (s)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Total da Série", "seriesTotal": "Total da Série",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Classificação Etária", "ageRating": "Classificação Etária",
"contentRating": "Classificação de Conteúdo", "contentRating": "Classificação de Conteúdo",
"personalRating": "Avaliação Pessoal", "personalRating": "Avaliação Pessoal",
"amazonRating": "Avaliação Amazon",
"goodreadsRating": "Avaliação Goodreads",
"hardcoverRating": "Avaliação Hardcover",
"ranobedbRating": "Avaliação Ranobedb",
"lubimyczytacRating": "Avaliação Lubimyczytac",
"audibleRating": "Avaliação Audible",
"applebooksRating": "",
"amazonReviewCount": "Resenhas Amazon",
"goodreadsReviewCount": "Resenhas Goodreads",
"hardcoverReviewCount": "Resenhas Hardcover",
"audibleReviewCount": "Resenhas Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID Goodreads",
"hardcoverId": "ID Hardcover",
"googleId": "ID Google",
"audibleId": "ID Audible",
"applebooksId": "",
"lubimyczytacId": "ID Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"comicvineId": "ID ComicVine",
"narrator": "Narrador", "narrator": "Narrador",
"abridged": "Abreviado", "abridged": "Abreviado",
"audiobookDuration": "Duração", "audiobookDuration": "Duração",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Включённые поля в редакторе и средстве выбора метаданных", "sectionTitle": "Включённые поля в редакторе и средстве выбора метаданных",
"sectionDesc": "Выберите, какие поля метаданных отображать при редактировании информации о книге или выборе метаданных от провайдеров. Отключённые поля будут скрыты из интерфейса.", "sectionDesc": "Выберите, какие поля метаданных отображать при редактировании информации о книге или выборе метаданных от провайдеров. Отключённые поля будут скрыты из интерфейса."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Детали аудиокниги", "audiobookDetails": "Детали аудиокниги",
"comicBookDetails": "Детали комикса", "comicBookDetails": "Детали комикса",
"providerMetadata": "Метаданные провайдера", "providerMetadata": "Метаданные провайдера",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Закрыть", "closeBtn": "Закрыть",
"previousBookBtn": "Предыдущая книга", "previousBookBtn": "Предыдущая книга",
"nextBookBtn": "Следующая книга", "nextBookBtn": "Следующая книга",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Загрузка полных метаданных...",
"columnCurrent": "Текущие", "columnCurrent": "Текущие",
"columnFetched": "Полученные", "columnFetched": "Полученные",
"copyMissingTooltip": "Скопировать отсутствующие поля", "copyMissingTooltip": "Скопировать отсутствующие поля",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Введите критерии поиска выше и нажмите «Поиск» для получения метаданных", "readyToSearchHint": "Введите критерии поиска выше и нажмите «Поиск» для получения метаданных",
"noResultsFound": "Результатов не найдено", "noResultsFound": "Результатов не найдено",
"noResultsHint": "Попробуйте изменить критерии поиска или выбрать других провайдеров", "noResultsHint": "Попробуйте изменить критерии поиска или выбрать других провайдеров",
"unknownProvider": "",
"selectOverlay": "Выбрать" "selectOverlay": "Выбрать"
}, },
"tabs": { "tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Размер файла (Кб)", "fileSize": "Размер файла (Кб)",
"fileType": "Тип файла", "fileType": "Тип файла",
"subtitle": "Подзаголовок", "subtitle": "Подзаголовок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "Количество отзывов Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "Количество отзывов Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "Количество отзывов Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"genre": "Жанр", "genre": "Жанр",
"addedOn": "Дата добавления", "addedOn": "Дата добавления",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"description": "Описание", "description": "Описание",
"narrator": "Чтец", "narrator": "Чтец",
"ageRating": "Возрастной рейтинг", "ageRating": "Возрастной рейтинг",
"contentRating": "Рейтинг контента", "contentRating": "Рейтинг контента",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "Количество отзывов Audible",
"abridged": "Сокращённая версия", "abridged": "Сокращённая версия",
"audiobookDuration": "Длительность аудиокниги (с)", "audiobookDuration": "Длительность аудиокниги (с)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Всего в серии", "seriesTotal": "Всего в серии",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Возрастной рейтинг", "ageRating": "Возрастной рейтинг",
"contentRating": "Рейтинг контента", "contentRating": "Рейтинг контента",
"personalRating": "Личная оценка", "personalRating": "Личная оценка",
"amazonRating": "Рейтинг Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"audibleRating": "Рейтинг Audible",
"applebooksRating": "",
"amazonReviewCount": "Отзывы Amazon",
"goodreadsReviewCount": "Отзывы Goodreads",
"hardcoverReviewCount": "Отзывы Hardcover",
"audibleReviewCount": "Отзывы Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID Goodreads",
"hardcoverId": "ID Hardcover",
"googleId": "ID Google",
"audibleId": "ID Audible",
"applebooksId": "",
"lubimyczytacId": "ID Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"comicvineId": "ID ComicVine",
"narrator": "Чтец", "narrator": "Чтец",
"abridged": "Сокращённая версия", "abridged": "Сокращённая версия",
"audiobookDuration": "Длительность", "audiobookDuration": "Длительность",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "", "sectionTitle": "",
"sectionDesc": "", "sectionDesc": ""
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "", "audiobookDetails": "",
"comicBookDetails": "", "comicBookDetails": "",
"providerMetadata": "", "providerMetadata": "",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "", "closeBtn": "",
"previousBookBtn": "", "previousBookBtn": "",
"nextBookBtn": "", "nextBookBtn": "",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "",
"columnCurrent": "", "columnCurrent": "",
"columnFetched": "", "columnFetched": "",
"copyMissingTooltip": "", "copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "", "readyToSearchHint": "",
"noResultsFound": "", "noResultsFound": "",
"noResultsHint": "", "noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "" "selectOverlay": ""
}, },
"tabs": { "tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "", "fileSize": "",
"fileType": "", "fileType": "",
"subtitle": "", "subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "", "genre": "",
"addedOn": "", "addedOn": "",
"lubimyczytacRating": "",
"description": "", "description": "",
"narrator": "", "narrator": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "", "seriesTotal": "",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "", "ageRating": "",
"contentRating": "", "contentRating": "",
"personalRating": "", "personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "", "narrator": "",
"abridged": "", "abridged": "",
"audiobookDuration": "", "audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "Število strani", "pageCount": "Število strani",
"amazonRating": "Amazon ocena",
"amazonReviewCount": "Amazon ocena #",
"goodreadsRating": "Goodreads ocena",
"goodreadsReviewCount": "Goodreads ocena #",
"hardcoverRating": "Hardcover ocena",
"hardcoverReviewCount": "Hardcover ocena #",
"audibleRating": "Audible ocena",
"audibleReviewCount": "Audible ocena #",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Douban ocena", "doubanRating": "Douban ocena",
"doubanReviewCount": "Douban ocena #", "doubanReviewCount": "Douban ocena #"
"ranobedbRating": "Ranobedb ocena"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Omogočena polja v urejevalniku in izbirniku", "sectionTitle": "Omogočena polja v urejevalniku in izbirniku",
"sectionDesc": "Izberi, katera polja metapodatkov naj se prikazujejo pri urejanju informacij o knjigi ali izbiranju metapodatkov od ponudnikov. Onemogočena polja bodo v vmesniku skrita.", "sectionDesc": "Izberi, katera polja metapodatkov naj se prikazujejo pri urejanju informacij o knjigi ali izbiranju metapodatkov od ponudnikov. Onemogočena polja bodo v vmesniku skrita."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "Google knjige",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "Amazon ocena",
"amazonReviewCount": "Amazon število ocen",
"googleId": "Google knjige ID",
"goodreadsId": "",
"goodreadsRating": "Goodreads ocena",
"goodreadsReviewCount": "Goodreads število ocen",
"hardcoverId": "",
"hardcoverBookId": "Hardcover ID knjige",
"hardcoverRating": "Hardcover ocena",
"hardcoverReviewCount": "Hardcover število ocen",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "Lubimyczytac ocena",
"ranobedbId": "",
"ranobedbRating": "Ranobedb ocena",
"audibleId": "",
"audibleRating": "Audible ocena",
"audibleReviewCount": "Audible število ocen",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Podrobnosti zvočne knjige", "audiobookDetails": "Podrobnosti zvočne knjige",
"comicBookDetails": "Podrobnosti stripa", "comicBookDetails": "Podrobnosti stripa",
"providerMetadata": "Metapodatki ponudnikov", "providerMetadata": "Metapodatki ponudnikov",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Zapri", "closeBtn": "Zapri",
"previousBookBtn": "Prejšnja knjiga", "previousBookBtn": "Prejšnja knjiga",
"nextBookBtn": "Naslednja knjiga", "nextBookBtn": "Naslednja knjiga",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Nalaganje celotnih metapodatkov...",
"columnCurrent": "Trenutno", "columnCurrent": "Trenutno",
"columnFetched": "Pridobljeno", "columnFetched": "Pridobljeno",
"copyMissingTooltip": "Kopiraj manjkajoča polja", "copyMissingTooltip": "Kopiraj manjkajoča polja",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Zgoraj vnesi iskalne pogoje in klikni Išči, da najdeš metapodatke", "readyToSearchHint": "Zgoraj vnesi iskalne pogoje in klikni Išči, da najdeš metapodatke",
"noResultsFound": "Ni rezultatov", "noResultsFound": "Ni rezultatov",
"noResultsHint": "Poskusi prilagoditi iskalne pogoje ali izberi druge ponudnike", "noResultsHint": "Poskusi prilagoditi iskalne pogoje ali izberi druge ponudnike",
"unknownProvider": "",
"selectOverlay": "Izberi" "selectOverlay": "Izberi"
}, },
"tabs": { "tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Velikost datoteke (Kb)", "fileSize": "Velikost datoteke (Kb)",
"fileType": "Vrsta datoteke", "fileType": "Vrsta datoteke",
"subtitle": "Podnaslov", "subtitle": "Podnaslov",
"amazonRating": "Amazon ocena",
"amazonReviewCount": "Število Amazon mnenj",
"goodreadsRating": "Goodreads ocena",
"goodreadsReviewCount": "Število Goodreads mnenj",
"hardcoverRating": "Hardcover ocena",
"hardcoverReviewCount": "Število Hardcover mnenj",
"ranobedbRating": "Ranobedb ocena",
"genre": "Žanr", "genre": "Žanr",
"addedOn": "Datum dodajanja", "addedOn": "Datum dodajanja",
"lubimyczytacRating": "Lubimyczytac ocena",
"description": "Opis", "description": "Opis",
"narrator": "Pripovedovalec", "narrator": "Pripovedovalec",
"ageRating": "Starostna omejitev", "ageRating": "Starostna omejitev",
"contentRating": "Starostna ocena", "contentRating": "Starostna ocena",
"audibleRating": "Audible ocena",
"audibleReviewCount": "Število Audible mnenj",
"abridged": "Skrajšano", "abridged": "Skrajšano",
"audiobookDuration": "Trajanje zvočne knjige (s)", "audiobookDuration": "Trajanje zvočne knjige (s)",
"audiobookCodec": "Kodek", "audiobookCodec": "Kodek",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Skupaj v zbirki", "seriesTotal": "Skupaj v zbirki",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Starostna omejitev", "ageRating": "Starostna omejitev",
"contentRating": "Starostna ocena", "contentRating": "Starostna ocena",
"personalRating": "Osebna ocena", "personalRating": "Osebna ocena",
"amazonRating": "Amazon ocena",
"goodreadsRating": "Goodreads ocena",
"hardcoverRating": "Hardcover ocena",
"ranobedbRating": "Ranobedb ocena",
"lubimyczytacRating": "Lubimyczytac ocena",
"audibleRating": "Audible ocena",
"applebooksRating": "",
"amazonReviewCount": "Amazon mnenja",
"goodreadsReviewCount": "Goodreads mnenja",
"hardcoverReviewCount": "Hardcover mnenja",
"audibleReviewCount": "Audible mnenja",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "Pripovedovalec", "narrator": "Pripovedovalec",
"abridged": "Skrajšano", "abridged": "Skrajšano",
"audiobookDuration": "Trajanje", "audiobookDuration": "Trajanje",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "Sidantal", "pageCount": "Sidantal",
"amazonRating": "Amazon-betyg",
"amazonReviewCount": "Amazon-betyg #",
"goodreadsRating": "Goodreads-betyg",
"goodreadsReviewCount": "Goodreads-betyg #",
"hardcoverRating": "Hardcover-betyg",
"hardcoverReviewCount": "Hardcover-betyg #",
"audibleRating": "Audible-betyg",
"audibleReviewCount": "Audible-betyg #",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Douban-betyg", "doubanRating": "Douban-betyg",
"doubanReviewCount": "Douban-betyg #", "doubanReviewCount": "Douban-betyg #"
"ranobedbRating": "Ranobedb-betyg"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Aktiverade fält i metadataredigeraren och -väljaren", "sectionTitle": "Aktiverade fält i metadataredigeraren och -väljaren",
"sectionDesc": "Välj vilka metadatafält som ska visas vid redigering av bokinformation eller val av metadata från leverantörer. Inaktiverade fält döljs från gränssnittet.", "sectionDesc": "Välj vilka metadatafält som ska visas vid redigering av bokinformation eller val av metadata från leverantörer. Inaktiverade fält döljs från gränssnittet."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "Amazon-betyg",
"amazonReviewCount": "Antal Amazon-betyg",
"googleId": "Google Books-ID",
"goodreadsId": "Goodreads-ID",
"goodreadsRating": "Goodreads-betyg",
"goodreadsReviewCount": "Antal Goodreads-betyg",
"hardcoverId": "Hardcover-ID",
"hardcoverBookId": "Hardcover-bok-ID",
"hardcoverRating": "Hardcover-betyg",
"hardcoverReviewCount": "Antal Hardcover-betyg",
"comicvineId": "Comicvine-ID",
"lubimyczytacId": "Lubimyczytac-ID",
"lubimyczytacRating": "Lubimyczytac-betyg",
"ranobedbId": "Ranobedb-ID",
"ranobedbRating": "Ranobedb-betyg",
"audibleId": "Audible-ID",
"audibleRating": "Audible-betyg",
"audibleReviewCount": "Antal Audible-betyg",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Ljudboksdetaljer", "audiobookDetails": "Ljudboksdetaljer",
"comicBookDetails": "Serietidningsdetaljer", "comicBookDetails": "Serietidningsdetaljer",
"providerMetadata": "Leverantörsmetadata", "providerMetadata": "Leverantörsmetadata",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "Hardcover bok-ID",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Stäng", "closeBtn": "Stäng",
"previousBookBtn": "Föregående bok", "previousBookBtn": "Föregående bok",
"nextBookBtn": "Nästa bok", "nextBookBtn": "Nästa bok",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Laddar komplett metadata...",
"columnCurrent": "Nuvarande", "columnCurrent": "Nuvarande",
"columnFetched": "Hämtad", "columnFetched": "Hämtad",
"copyMissingTooltip": "Kopiera saknade fält", "copyMissingTooltip": "Kopiera saknade fält",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Ange dina sökkriterier ovan och klicka Sök för att hitta metadata", "readyToSearchHint": "Ange dina sökkriterier ovan och klicka Sök för att hitta metadata",
"noResultsFound": "Inga resultat hittades", "noResultsFound": "Inga resultat hittades",
"noResultsHint": "Prova att justera dina sökkriterier eller välja andra leverantörer", "noResultsHint": "Prova att justera dina sökkriterier eller välja andra leverantörer",
"unknownProvider": "",
"selectOverlay": "Välj" "selectOverlay": "Välj"
}, },
"tabs": { "tabs": {
@@ -5109,22 +5035,12 @@
"fileSize": "Filstorlek (Kb)", "fileSize": "Filstorlek (Kb)",
"fileType": "Filtyp", "fileType": "Filtyp",
"subtitle": "Undertitel", "subtitle": "Undertitel",
"amazonRating": "Amazon-betyg",
"amazonReviewCount": "Amazon-recensioner",
"goodreadsRating": "Goodreads-betyg",
"goodreadsReviewCount": "Goodreads-recensioner",
"hardcoverRating": "Hardcover-betyg",
"hardcoverReviewCount": "Hardcover-recensioner",
"ranobedbRating": "Ranobedb-betyg",
"genre": "", "genre": "",
"addedOn": "Datum tillagd", "addedOn": "Datum tillagd",
"lubimyczytacRating": "Lubimyczytac-betyg",
"description": "Beskrivning", "description": "Beskrivning",
"narrator": "Berattare", "narrator": "Berattare",
"ageRating": "Aldersbetyg", "ageRating": "Aldersbetyg",
"contentRating": "Innehallsbetyg", "contentRating": "Innehallsbetyg",
"audibleRating": "Audible-betyg",
"audibleReviewCount": "Audible-recensioner",
"abridged": "Forkortad", "abridged": "Forkortad",
"audiobookDuration": "Ljudbokslangd (s)", "audiobookDuration": "Ljudbokslangd (s)",
"audiobookCodec": "Kodek", "audiobookCodec": "Kodek",
@@ -5254,31 +5170,9 @@
"seriesTotal": "Totalt i serien", "seriesTotal": "Totalt i serien",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Aldersbetyg", "ageRating": "Aldersbetyg",
"contentRating": "Innehallsbetyg", "contentRating": "Innehallsbetyg",
"personalRating": "Personligt betyg", "personalRating": "Personligt betyg",
"amazonRating": "Amazon-betyg",
"goodreadsRating": "Goodreads-betyg",
"hardcoverRating": "Hardcover-betyg",
"ranobedbRating": "Ranobedb-betyg",
"lubimyczytacRating": "Lubimyczytac-betyg",
"audibleRating": "Audible-betyg",
"applebooksRating": "",
"amazonReviewCount": "Amazon-recensioner",
"goodreadsReviewCount": "Goodreads-recensioner",
"hardcoverReviewCount": "Hardcover-recensioner",
"audibleReviewCount": "Audible-recensioner",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "Goodreads-ID",
"hardcoverId": "Hardcover-ID",
"googleId": "Google-ID",
"audibleId": "Audible-ID",
"applebooksId": "",
"lubimyczytacId": "Lubimyczytac-ID",
"ranobedbId": "Ranobedb-ID",
"comicvineId": "ComicVine-ID",
"narrator": "Berattare", "narrator": "Berattare",
"abridged": "Forkortad", "abridged": "Forkortad",
"audiobookDuration": "Varaktighet", "audiobookDuration": "Varaktighet",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "Кількість сторінок", "pageCount": "Кількість сторінок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "К-сть оцінок Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "К-сть оцінок Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "К-сть оцінок Hardcover",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "К-сть оцінок Audible",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Рейтинг Douban", "doubanRating": "Рейтинг Douban",
"doubanReviewCount": "К-сть оцінок Douban", "doubanReviewCount": "К-сть оцінок Douban"
"ranobedbRating": "Рейтинг Ranobedb"
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "Увімкнені поля в редакторі та виборі метаданих", "sectionTitle": "Увімкнені поля в редакторі та виборі метаданих",
"sectionDesc": "Виберіть, які поля метаданих відображати під час редагування інформації про книгу або вибору метаданих від провайдерів. Вимкнені поля будуть приховані з інтерфейсу.", "sectionDesc": "Виберіть, які поля метаданих відображати під час редагування інформації про книгу або вибору метаданих від провайдерів. Вимкнені поля будуть приховані з інтерфейсу."
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "Кількість відгуків Amazon",
"googleId": "ID Google Books",
"goodreadsId": "ID Goodreads",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "Кількість відгуків Goodreads",
"hardcoverId": "ID Hardcover",
"hardcoverBookId": "ID книги Hardcover",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "Кількість відгуків Hardcover",
"comicvineId": "ID Comicvine",
"lubimyczytacId": "ID Lubimyczytac",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"ranobedbRating": "Рейтинг Ranobedb",
"audibleId": "ID Audible",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "Кількість відгуків Audible",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Деталі аудіокниги", "audiobookDetails": "Деталі аудіокниги",
"comicBookDetails": "Деталі коміксу", "comicBookDetails": "Деталі коміксу",
"providerMetadata": "Метадані провайдера", "providerMetadata": "Метадані провайдера",
"openlibraryId": "",
"amazonAsin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleBooksId": "ID Google Books",
"goodreadsId": "ID Goodreads",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "ID Hardcover",
"hardcoverBookId": "ID книги Hardcover",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "ID Lubimyczytac",
"lubimyczytacRating": "",
"comicvineId": "ID Comicvine",
"ranobedbId": "ID Ranobedb",
"ranobedbRating": "",
"audibleId": "ID Audible",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "Закрити", "closeBtn": "Закрити",
"previousBookBtn": "Попередня книга", "previousBookBtn": "Попередня книга",
"nextBookBtn": "Наступна книга", "nextBookBtn": "Наступна книга",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "Завантаження повних метаданих...",
"columnCurrent": "Поточні", "columnCurrent": "Поточні",
"columnFetched": "Отримані", "columnFetched": "Отримані",
"copyMissingTooltip": "Скопіювати відсутні поля", "copyMissingTooltip": "Скопіювати відсутні поля",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Введіть критерії пошуку вище й натисніть Пошук, щоб знайти метадані", "readyToSearchHint": "Введіть критерії пошуку вище й натисніть Пошук, щоб знайти метадані",
"noResultsFound": "Результатів не знайдено", "noResultsFound": "Результатів не знайдено",
"noResultsHint": "Спробуйте змінити критерії пошуку або вибрати інших провайдерів", "noResultsHint": "Спробуйте змінити критерії пошуку або вибрати інших провайдерів",
"unknownProvider": "",
"selectOverlay": "Вибрати" "selectOverlay": "Вибрати"
}, },
"tabs": { "tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Розмір файлу (КБ)", "fileSize": "Розмір файлу (КБ)",
"fileType": "Тип файлу", "fileType": "Тип файлу",
"subtitle": "Підзаголовок", "subtitle": "Підзаголовок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "Кількість відгуків Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "Кількість відгуків Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "Кількість відгуків Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"genre": "Жанр", "genre": "Жанр",
"addedOn": "Дата додавання", "addedOn": "Дата додавання",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"description": "Опис", "description": "Опис",
"narrator": "Оповідач", "narrator": "Оповідач",
"ageRating": "Віковий рейтинг", "ageRating": "Віковий рейтинг",
"contentRating": "Рейтинг контенту", "contentRating": "Рейтинг контенту",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "Кількість відгуків Audible",
"abridged": "Скорочена", "abridged": "Скорочена",
"audiobookDuration": "Тривалість аудіокниги (с)", "audiobookDuration": "Тривалість аудіокниги (с)",
"audiobookCodec": "Кодек", "audiobookCodec": "Кодек",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Всього в серії", "seriesTotal": "Всього в серії",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "Віковий рейтинг", "ageRating": "Віковий рейтинг",
"contentRating": "Рейтинг контенту", "contentRating": "Рейтинг контенту",
"personalRating": "Особистий рейтинг", "personalRating": "Особистий рейтинг",
"amazonRating": "Рейтинг Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"audibleRating": "Рейтинг Audible",
"applebooksRating": "",
"amazonReviewCount": "Відгуки Amazon",
"goodreadsReviewCount": "Відгуки Goodreads",
"hardcoverReviewCount": "Відгуки Hardcover",
"audibleReviewCount": "Відгуки Audible",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "ID Goodreads",
"hardcoverId": "ID Hardcover",
"googleId": "ID Google",
"audibleId": "ID Audible",
"applebooksId": "",
"lubimyczytacId": "ID Lubimyczytac",
"ranobedbId": "ID Ranobedb",
"comicvineId": "ID ComicVine",
"narrator": "Оповідач", "narrator": "Оповідач",
"abridged": "Скорочена", "abridged": "Скорочена",
"audiobookDuration": "Тривалість", "audiobookDuration": "Тривалість",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"pageCount": "", "pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "", "doubanRating": "",
"doubanReviewCount": "", "doubanReviewCount": ""
"ranobedbRating": ""
} }
}, },
"fieldSelector": { "fieldSelector": {
"sectionTitle": "元数据编辑器和选择器中的启用字段", "sectionTitle": "元数据编辑器和选择器中的启用字段",
"sectionDesc": "选择编辑书籍信息或从提供商选择元数据时显示哪些元数据字段。禁用的字段将从界面中隐藏。", "sectionDesc": "选择编辑书籍信息或从提供商选择元数据时显示哪些元数据字段。禁用的字段将从界面中隐藏。"
"providers": {
"openlibrary": "",
"amazon": "",
"googleBooks": "",
"goodreads": "",
"hardcover": "",
"audible": "",
"applebooks": "",
"comicvine": "",
"lubimyczytac": "",
"ranobedb": ""
},
"fields": {
"openlibraryId": "",
"asin": "",
"amazonRating": "",
"amazonReviewCount": "",
"googleId": "",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"comicvineId": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": ""
}
} }
}, },
"settingsLibMeta": { "settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "有声书详情", "audiobookDetails": "有声书详情",
"comicBookDetails": "漫画详情", "comicBookDetails": "漫画详情",
"providerMetadata": "提供商元数据", "providerMetadata": "提供商元数据",
"openlibraryId": "",
"amazonAsin": "亚马逊 ASIN",
"amazonRating": "亚马逊 ★",
"amazonReviewCount": "亚马逊 #",
"googleBooksId": "Google 图书 ID",
"goodreadsId": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverId": "",
"hardcoverBookId": "Hardcover 图书 ID",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"lubimyczytacId": "",
"lubimyczytacRating": "",
"comicvineId": "",
"ranobedbId": "",
"ranobedbRating": "",
"audibleId": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"closeBtn": "关闭", "closeBtn": "关闭",
"previousBookBtn": "上一本书", "previousBookBtn": "上一本书",
"nextBookBtn": "下一本书", "nextBookBtn": "下一本书",
@@ -2341,7 +2269,6 @@
} }
}, },
"picker": { "picker": {
"loadingMetadata": "正在加载完整元数据...",
"columnCurrent": "当前", "columnCurrent": "当前",
"columnFetched": "获取的", "columnFetched": "获取的",
"copyMissingTooltip": "复制缺失字段", "copyMissingTooltip": "复制缺失字段",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "在上方输入搜索条件,然后点击搜索查找元数据", "readyToSearchHint": "在上方输入搜索条件,然后点击搜索查找元数据",
"noResultsFound": "未找到结果", "noResultsFound": "未找到结果",
"noResultsHint": "尝试调整搜索条件或选择不同的提供商", "noResultsHint": "尝试调整搜索条件或选择不同的提供商",
"unknownProvider": "",
"selectOverlay": "选择" "selectOverlay": "选择"
}, },
"tabs": { "tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "文件大小 (Kb)", "fileSize": "文件大小 (Kb)",
"fileType": "文件类型", "fileType": "文件类型",
"subtitle": "副标题", "subtitle": "副标题",
"amazonRating": "Amazon 评分",
"amazonReviewCount": "Amazon 评论数",
"goodreadsRating": "Goodreads 评分",
"goodreadsReviewCount": "Goodreads 评论数",
"hardcoverRating": "Hardcover 评分",
"hardcoverReviewCount": "Hardcover 评论数",
"ranobedbRating": "Ranobedb 评分",
"genre": "类型", "genre": "类型",
"addedOn": "添加日期", "addedOn": "添加日期",
"lubimyczytacRating": "Lubimyczytac 评分",
"description": "描述", "description": "描述",
"narrator": "朗读者", "narrator": "朗读者",
"ageRating": "年龄评级", "ageRating": "年龄评级",
"contentRating": "内容评级", "contentRating": "内容评级",
"audibleRating": "Audible 评分",
"audibleReviewCount": "Audible 评论数",
"abridged": "删节版", "abridged": "删节版",
"audiobookDuration": "有声书时长 (秒)", "audiobookDuration": "有声书时长 (秒)",
"audiobookCodec": "", "audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "系列总数", "seriesTotal": "系列总数",
"isbn13": "", "isbn13": "",
"isbn10": "", "isbn10": "",
"asin": "",
"ageRating": "年龄评级", "ageRating": "年龄评级",
"contentRating": "内容评级", "contentRating": "内容评级",
"personalRating": "个人评分", "personalRating": "个人评分",
"amazonRating": "Amazon 评分",
"goodreadsRating": "Goodreads 评分",
"hardcoverRating": "Hardcover 评分",
"ranobedbRating": "Ranobedb 评分",
"lubimyczytacRating": "Lubimyczytac 评分",
"audibleRating": "Audible 评分",
"applebooksRating": "",
"amazonReviewCount": "Amazon 评论",
"goodreadsReviewCount": "Goodreads 评论",
"hardcoverReviewCount": "Hardcover 评论",
"audibleReviewCount": "Audible 评论",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "朗读者", "narrator": "朗读者",
"abridged": "删节版", "abridged": "删节版",
"audiobookDuration": "时长", "audiobookDuration": "时长",