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')"
tooltipPosition="top"/>
</div>
@if (metadataLookupMessage(); as message) {
<small role="status">{{ t(message) }}</small>
}
</div>
</div>
@@ -1,13 +1,20 @@
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
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 type {AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete';
import {MessageService} from '@openng/optimus-ui/api';
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 {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 {BookMetadataService} from '../../service/book-metadata.service';
import {BookService} from '../../service/book.service';
import {LibraryService} from '../../service/library.service';
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: {
dialogData?: {libraryId?: number};
@@ -55,7 +56,6 @@ describe('AddPhysicalBookDialogComponent', () => {
publishers: string[];
series: string[];
};
lookupResult$?: Observable<BookMetadata>;
createResult$?: Observable<Book>;
} = {}) {
const libraries = signal<Library[]>(options.librariesData ?? [
@@ -70,19 +70,23 @@ describe('AddPhysicalBookDialogComponent', () => {
publishers: [],
series: [],
});
const lookupResult$ = options.lookupResult$ ?? new Subject<BookMetadata>();
const createResult$ = options.createResult$ ?? new Subject<Book>();
const lookupByIsbn = vi.fn(() => lookupResult$);
const createPhysicalBook = vi.fn(() => createResult$);
const dialogRef = {close: vi.fn()};
TestBed.configureTestingModule({
providers: [
provideHttpClient(),
provideHttpClientTesting(),
provideTanStackQuery(new QueryClient()),
{provide: DynamicDialogConfig, useValue: {data: options.dialogData ?? {}}},
{provide: DynamicDialogRef, useValue: dialogRef},
{provide: AppSettingsService, useValue: {appSettings: signal(null)}},
{provide: AuthService, useValue: createAuthServiceStub()},
{provide: BookService, useValue: {uniqueMetadata, createPhysicalBook}},
{provide: BookMetadataService, useValue: {lookupByIsbn}},
{provide: LibraryService, useValue: {libraries}},
{provide: MessageService, useValue: {add: vi.fn()}},
{provide: TranslocoService, useValue: {translate: (key: string) => key}},
],
});
@@ -93,11 +97,10 @@ describe('AddPhysicalBookDialogComponent', () => {
component,
libraries,
uniqueMetadata,
lookupResult$,
createResult$,
lookupByIsbn,
createPhysicalBook,
dialogRef,
http: TestBed.inject(HttpTestingController),
};
}
@@ -173,62 +176,6 @@ describe('AddPhysicalBookDialogComponent', () => {
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', () => {
const {component, createPhysicalBook} = createHarness();
@@ -8,11 +8,12 @@ import {Select} from '@openng/optimus-ui/select';
import {Textarea} from '@openng/optimus-ui/textarea';
import {InputNumber} from '@openng/optimus-ui/inputnumber';
import {AutoComplete, AutoCompleteCompleteEvent} from '@openng/optimus-ui/autocomplete';
import {QueryClient} from '@tanstack/angular-query-experimental';
import {BookService} from '../../service/book.service';
import {BookMetadataService} from '../../service/book-metadata.service';
import {LibraryService} from '../../service/library.service';
import {Library} from '../../model/library.model';
import {CreatePhysicalBookRequest} from '../../model/book.model';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {TranslocoDirective} from '@jsverse/transloco';
@Component({
@@ -36,7 +37,8 @@ export class AddPhysicalBookDialogComponent {
private dynamicDialogRef = inject(DynamicDialogRef);
private dialogConfig = inject(DynamicDialogConfig);
private bookService = inject(BookService);
private bookMetadataService = inject(BookMetadataService);
private queryClient = inject(QueryClient);
private sources = inject(MetadataSourceQueryService);
private libraryService = inject(LibraryService);
selectedLibraryId: number | null = null;
@@ -59,6 +61,7 @@ export class AddPhysicalBookDialogComponent {
coverUrl: string | null = null;
isLoading = signal(false);
isFetchingMetadata = signal(false);
readonly metadataLookupMessage = signal<'metadataNotFound' | 'metadataLookupFailed' | null>(null);
private readonly initializeSelectedLibraryEffect = effect(() => {
const libraries = this.libraries;
if (libraries.length === 0) {
@@ -115,28 +118,33 @@ export class AddPhysicalBookDialogComponent {
(event.originalEvent.target as HTMLInputElement).value = '';
}
fetchMetadataByIsbn(): void {
async fetchMetadataByIsbn(): Promise<void> {
const isbnValue = this.isbn.trim();
if (!isbnValue || this.isFetchingMetadata()) return;
this.isFetchingMetadata.set(true);
this.bookMetadataService.lookupByIsbn(isbnValue).subscribe({
next: (metadata) => {
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;
this.isFetchingMetadata.set(false);
},
error: () => {
this.isFetchingMetadata.set(false);
this.metadataLookupMessage.set(null);
try {
const metadata = await this.queryClient.query(this.sources.isbnLookup(isbnValue));
if (!metadata) {
this.metadataLookupMessage.set('metadataNotFound');
return;
}
});
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 {
@@ -22,7 +22,7 @@
<div class="fields-grid">
@for (field of lockableFields; track field) {
<div class="field-row">
<span class="field-label">{{ fieldLabels[field] || field }}</span>
<span class="field-label">{{ getFieldLabel(field) }}</span>
<p-button
[outlined]="true"
[label]="getLockLabel(field)"
@@ -57,6 +57,8 @@ describe('LockUnlockMetadataDialogComponent', () => {
provide: TranslocoService,
useValue: {
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 {finalize} from 'rxjs';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {MetadataProviderFieldsService} from '../../../../../shared/metadata';
@Component({
selector: 'app-lock-unlock-metadata-dialog',
@@ -33,14 +34,13 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
bookIds: Set<number> = this.dynamicDialogConfig.data.bookIds;
private readonly providerFields = inject(MetadataProviderFieldsService);
lockableFields: string[] = [
'titleLocked', 'subtitleLocked', 'publisherLocked', 'publishedDateLocked', 'descriptionLocked', 'openlibraryIdLocked',
'isbn13Locked', 'isbn10Locked', 'asinLocked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked',
'titleLocked', 'subtitleLocked', 'publisherLocked', 'publishedDateLocked', 'descriptionLocked',
'isbn13Locked', 'isbn10Locked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked',
'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked', 'moodsLocked', 'tagsLocked',
'amazonRatingLocked', 'amazonReviewCountLocked', 'goodreadsRatingLocked', 'goodreadsReviewCountLocked',
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'hardcoverBookIdLocked', 'googleIdLocked', 'comicvineIdLocked',
'applebooksIdLocked', 'applebooksRatingLocked', 'applebooksReviewCountLocked',
'ranobedbIdLocked', 'ranobedbRatingLocked'
...this.providerFields.fields().map(field => field.lockName),
];
fieldLabels: Record<string, string> = {
@@ -51,8 +51,6 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
descriptionLocked: 'Description',
isbn13Locked: 'ISBN-13',
isbn10Locked: 'ISBN-10',
openlibraryIdLocked: 'OpenLibrary ID',
asinLocked: 'ASIN',
pageCountLocked: 'Page Count',
thumbnailLocked: 'Thumbnail',
languageLocked: 'Language',
@@ -64,24 +62,13 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
categoriesLocked: 'Genres',
moodsLocked: 'Moods',
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;
ngOnInit(): void {
@@ -55,9 +55,10 @@
<div class="reviewer-name-row">
<span class="reviewer-name">{{ review.reviewerName || t('labels.anonymous') }}</span>
@if (review.metadataProvider) {
@let provider = catalog.provider(review.metadataProvider);
<p-tag
[rounded]="true"
[value]="review.metadataProvider"
[value]="provider ? (provider.labelKey | transloco) : review.metadataProvider"
[severity]="getProviderSeverity(review.metadataProvider)"/>
}
@if (review.country) {
@@ -9,18 +9,19 @@ import {Rating} from '@openng/optimus-ui/rating';
import {Tag} from '@openng/optimus-ui/tag';
import {Button} from '@openng/optimus-ui/button';
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 {FormsModule} from '@angular/forms';
import {Tooltip} from '@openng/optimus-ui/tooltip';
import {BookService} from '../../service/book.service';
import {BookMetadataManageService} from '../../service/book-metadata-manage.service';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
@Component({
selector: 'app-book-reviews',
standalone: true,
imports: [ProgressSpinner, Rating, Tag, Button, FormsModule, Tooltip, TranslocoDirective],
imports: [ProgressSpinner, Rating, Tag, Button, FormsModule, Tooltip, TranslocoDirective, TranslocoPipe],
templateUrl: './book-reviews.component.html',
styleUrl: './book-reviews.component.scss'
})
@@ -38,6 +39,7 @@ export class BookReviewsComponent implements OnInit, OnChanges {
private appSettingsService = inject(AppSettingsService);
private destroyRef = inject(DestroyRef);
private readonly t = inject(TranslocoService);
protected readonly catalog = inject(MetadataCatalogService);
private bookIdState = signal<number | null>(null);
private loadingBookId: number | null = null;
private loadingRequestSeq = 0;
@@ -221,8 +221,8 @@
</div>
<code class="progress-item-isbn">{{ entry.isbn }}</code>
<span class="progress-item-detail">
@if (entry.status === 'created' && entry.title) {
{{ entry.title }}
@if (entry.status === 'created') {
{{ entry.title || t('summaryCreated') }}
} @else if (entry.status === 'created-no-metadata') {
{{ t('createdNoMetadata') }}
} @else if (entry.status === 'failed') {
@@ -317,8 +317,8 @@
</div>
<code class="summary-detail-isbn">{{ entry.isbn }}</code>
<span class="summary-detail-info">
@if (entry.status === 'created' && entry.title) {
{{ entry.title }}
@if (entry.status === 'created') {
{{ entry.title || t('summaryCreated') }}
} @else if (entry.status === 'created-no-metadata') {
{{ t('createdNoMetadata') }}
} @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 {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
import {FormsModule} from '@angular/forms';
@@ -7,11 +8,12 @@ import {Textarea} from '@openng/optimus-ui/textarea';
import {Tooltip} from '@openng/optimus-ui/tooltip';
import {ProgressBar} from '@openng/optimus-ui/progressbar';
import {FileUpload, FileSelectEvent} from '@openng/optimus-ui/fileupload';
import {QueryClient} from '@tanstack/angular-query-experimental';
import {BookService} from '../../service/book.service';
import {BookMetadataService} from '../../service/book-metadata.service';
import {LibraryService} from '../../service/library.service';
import {Library} from '../../model/library.model';
import {BookMetadata, CreatePhysicalBookRequest} from '../../model/book.model';
import {MetadataSourceQueryService} from '../../../metadata/sources/metadata-source-query.service';
import {TranslocoDirective} from '@jsverse/transloco';
import {Tabs, TabList, Tab, TabPanels, TabPanel} from '@openng/optimus-ui/tabs';
@@ -61,7 +63,8 @@ export class BulkIsbnImportDialogComponent {
private dynamicDialogRef = inject(DynamicDialogRef);
private dialogConfig = inject(DynamicDialogConfig);
private bookService = inject(BookService);
private bookMetadataService = inject(BookMetadataService);
private queryClient = inject(QueryClient);
private sources = inject(MetadataSourceQueryService);
private libraryService = inject(LibraryService);
selectedLibraryId: number | null = null;
@@ -189,7 +192,7 @@ export class BulkIsbnImportDialogComponent {
await this.createBook(request);
if (metadata?.title) {
if (metadata !== null) {
updateEntry(i, { status: 'created', title: metadata.title })
this.createdCount.update(v => v + 1);
} else {
@@ -346,25 +349,21 @@ export class BulkIsbnImportDialogComponent {
return false;
}
private lookupIsbn(isbn: string): Promise<BookMetadata | null> {
return new Promise((resolve) => {
this.bookMetadataService.lookupByIsbn(isbn).subscribe({
next: metadata => resolve(metadata),
error: err => {
// Retry once on potential rate limiting
if (err?.status === 429) {
setTimeout(() => {
this.bookMetadataService.lookupByIsbn(isbn).subscribe({
next: metadata => resolve(metadata),
error: () => resolve(null), // Still create with ISBN only
});
}, RETRY_DELAY_MS);
} else {
resolve(null); // No metadata found, still create with ISBN
}
},
});
});
private async lookupIsbn(isbn: string): Promise<BookMetadata | null> {
try {
return await this.queryClient.query(this.sources.isbnLookup(isbn));
} catch (err: unknown) {
if (!(err instanceof HttpErrorResponse) || err.status !== 429) {
return null;
}
}
await this.delay(RETRY_DELAY_MS);
try {
return await this.queryClient.query(this.sources.isbnLookup(isbn));
} catch {
return null;
}
}
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> {
return this.http.post<void>(`${this.url}/${bookId}/generate-custom-cover`, {}).pipe(
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>
}
@for (field of metadataFieldsBottom; track field) {
@for (field of metadataFieldsBottom(); track field) {
<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">
<input
pInputText
@@ -522,9 +522,9 @@
</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'">
<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">
<input
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 {Button} from '@openng/optimus-ui/button';
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 {AutoCompleteSelectEvent} from '@openng/optimus-ui/autocomplete';
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 {MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
@@ -48,6 +48,7 @@ export class BookdropFileMetadataPickerComponent {
protected readonly urlHelper = inject(UrlHelperService);
private readonly appSettingsService = inject(AppSettingsService);
private readonly t = inject(TranslocoService);
private readonly providerFields = inject(MetadataProviderFieldsService);
@Input() fetchedMetadata!: BookMetadata;
@Input() originalMetadata?: BookMetadata;
@@ -60,13 +61,14 @@ export class BookdropFileMetadataPickerComponent {
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)
);
metadataPublishDate: MetadataFieldConfig[] = ALL_METADATA_FIELDS.filter(f =>
metadataPublishDate: MetadataFieldConfig[] = GENERIC_METADATA_FIELDS.filter(f =>
f.controlName === 'publishedDate'
);
@@ -74,16 +76,19 @@ export class BookdropFileMetadataPickerComponent {
metadataDescription: MetadataFieldConfig[] = getTextareaFields();
metadataFieldsBottom: MetadataFieldConfig[] = getBottomFields();
readonly metadataFieldsBottom = computed(() => getBottomFields(this.allFields(), this.enabledProviderFields()));
private readonly syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) {
this.enabledProviderFields = settings.metadataProviderSpecificFields;
this.metadataFieldsBottom = getBottomFields(this.enabledProviderFields);
this.enabledProviderFields.set(settings.metadataProviderSpecificFields);
}
});
fieldLabel(field: MetadataFieldConfig): string {
return field.providerKey ? this.providerFields.label(field.providerKey) : field.label ?? field.controlName;
}
copyMissing(): void {
this.metadataUtils.copyMissingFields(
this.fetchedMetadata,
@@ -201,7 +206,7 @@ export class BookdropFileMetadataPickerComponent {
if (this.originalMetadata) {
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 value = this.originalMetadata[key];
@@ -21,6 +21,7 @@ import {InputGroupAddon} from '@openng/optimus-ui/inputgroupaddon';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {BookMetadata} from '../../../book/model/book.model';
import {UrlHelperService} from '../../../../shared/service/url-helper.service';
import {MetadataProviderFieldsService} from '../../../../shared/metadata';
import {Checkbox} from '@openng/optimus-ui/checkbox';
import {NgClass} from '@angular/common';
import {Paginator} from '@openng/optimus-ui/paginator';
@@ -73,6 +74,7 @@ export class BookdropFileReviewComponent implements OnInit {
private readonly appSettingsService = inject(AppSettingsService);
private readonly messageService = inject(MessageService);
private readonly urlHelper = inject(UrlHelperService);
private readonly providerFields = inject(MetadataProviderFieldsService);
private readonly activatedRoute = inject(ActivatedRoute);
private readonly pageTitle = inject(PageTitleService);
private readonly t = inject(TranslocoService);
@@ -309,26 +311,11 @@ export class BookdropFileReviewComponent implements OnInit {
description: original?.description ?? null,
pageCount: original?.pageCount ?? 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,
seriesNumber: original?.seriesNumber ?? null,
seriesTotal: original?.seriesTotal ?? null,
thumbnailUrl: this.urlHelper.getBookdropCoverUrl(fileUi.file.id),
...Object.fromEntries(this.providerFields.fields().map(field => [field.name, original?.[field.name] ?? null])),
});
fileUi.copiedFields = {};
fileUi.savedFields = {};
@@ -590,26 +577,11 @@ export class BookdropFileReviewComponent implements OnInit {
description: new FormControl(original?.description ?? ''),
pageCount: new FormControl(original?.pageCount ?? ''),
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 ?? ''),
seriesNumber: new FormControl(original?.seriesNumber ?? ''),
seriesTotal: new FormControl(original?.seriesTotal ?? ''),
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)) {
<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>
} @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('valueEnd')" [min]="0" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
} @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('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 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('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 {
<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')"/>
@@ -167,12 +167,12 @@
<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)) {
<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>
} @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>
} @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>
} @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>
} @else if (ruleCtrl.get('field')?.value === 'seriesStatus') {
<p-select [options]="seriesStatusOptions" formControlName="value" [placeholder]="t('placeholders.selectSeriesStatus')" appendTo="body" class="value-input"></p-select>
} @else if (ruleCtrl.get('field')?.value === 'seriesGaps') {
@@ -699,33 +699,33 @@ describe('MagicShelfComponent (Part 3)', () => {
describe('numericFieldConfigMap', () => {
it('should contain readingProgress with max 100', () => {
const config = component.numericFieldConfigMap.get('readingProgress');
const config = component.numericFieldConfigMap().get('readingProgress');
expect(config).toBeDefined();
expect(config!.type).toBe('decimal');
expect(config!.max).toBe(100);
});
it('should contain personalRating with max 10', () => {
const config = component.numericFieldConfigMap.get('personalRating');
const config = component.numericFieldConfigMap().get('personalRating');
expect(config).toBeDefined();
expect(config!.type).toBe('decimal');
expect(config!.max).toBe(10);
});
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!.type).toBe('number');
expect(config!.max).toBeUndefined();
});
it('should not contain title', () => {
const config = component.numericFieldConfigMap.get('title');
const config = component.numericFieldConfigMap().get('title');
expect(config).toBeUndefined();
});
it('should contain abridged with type boolean', () => {
const config = component.numericFieldConfigMap.get('abridged');
const config = component.numericFieldConfigMap().get('abridged');
expect(config).toBeDefined();
expect(config!.type).toBe('boolean');
});
@@ -24,6 +24,8 @@ import {ShelfService} from '../../book/service/shelf.service';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {Textarea} from '@openng/optimus-ui/textarea';
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 =
| 'equals'
@@ -46,7 +48,7 @@ export type RuleOperator =
| 'older_than'
| 'this_period'
export type RuleField =
type GenericRuleField =
| 'library'
| 'shelf'
| 'title'
@@ -62,13 +64,6 @@ export type RuleField =
| 'language'
| 'isbn13'
| 'isbn10'
| 'amazonRating'
| 'amazonReviewCount'
| 'goodreadsRating'
| 'goodreadsReviewCount'
| 'hardcoverRating'
| 'hardcoverReviewCount'
| 'ranobedbRating'
| 'personalRating'
| 'fileType'
| 'fileSize'
@@ -79,15 +74,10 @@ export type RuleField =
| 'moods'
| 'tags'
| 'addedOn'
| 'lubimyczytacRating'
| 'description'
| 'narrator'
| 'ageRating'
| 'contentRating'
| 'audibleRating'
| 'audibleReviewCount'
| 'applebooksRating'
| 'applebooksReviewCount'
| 'abridged'
| 'audiobookDuration'
| 'audiobookCodec'
@@ -100,11 +90,14 @@ export type RuleField =
| 'readingProgress'
| 'metadataPresence';
export type RuleField = GenericRuleField | MetadataProviderScoreFieldName;
interface FullFieldConfig {
label: string;
type?: FieldType;
max?: number;
providerField?: MetadataProviderFieldName;
}
type FieldType = 'number' | 'decimal' | 'date' | 'boolean' | undefined;
@@ -143,7 +136,9 @@ export type GroupFormGroup = FormGroup<{
rules: FormArray<GroupFormGroup | RuleFormGroup>;
}>;
const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
const RULE_UNSUPPORTED_PROVIDER_FIELD = 'hardcoverBookId';
const GENERIC_FIELD_CONFIGS = {
library: {label: 'library'},
shelf: {label: 'shelf'},
readStatus: {label: 'readStatus'},
@@ -168,23 +163,11 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
fileSize: {label: 'fileSize', type: 'number'},
fileType: {label: 'fileType'},
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'},
lubimyczytacRating: {label: 'lubimyczytacRating', type: 'decimal', max: 5},
description: {label: 'description'},
narrator: {label: 'narrator'},
ageRating: {label: 'ageRating', type: 'number'},
contentRating: {label: 'contentRating'},
audibleRating: {label: 'audibleRating', type: 'decimal', max: 5},
audibleReviewCount: {label: 'audibleReviewCount', type: 'number'},
applebooksRating: {label: 'applebooksRating', type: 'decimal', max: 5},
applebooksReviewCount: {label: 'applebooksReviewCount', type: 'number'},
abridged: {label: 'abridged', type: 'boolean'},
audiobookDuration: {label: 'audiobookDuration', type: 'number'},
audiobookCodec: {label: 'audiobookCodec'},
@@ -196,19 +179,19 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
seriesPosition: {label: 'seriesPosition'},
readingProgress: {label: 'readingProgress', type: 'decimal', max: 100},
metadataPresence: {label: 'metadataPresence'}
};
} satisfies Record<GenericRuleField, FullFieldConfig>;
interface FieldGroup {
translationKey: string;
fields: RuleField[];
}
const FIELD_GROUPS: FieldGroup[] = [
const GENERIC_FIELD_GROUPS: FieldGroup[] = [
{ translationKey: 'organization', fields: ['library', 'shelf', 'readStatus', 'readingProgress'] },
{ translationKey: 'bookInfo', fields: ['title', 'subtitle', 'description', 'authors', 'categories', 'publisher', 'language', 'pageCount', 'ageRating', 'contentRating'] },
{ translationKey: 'series', fields: ['seriesName', 'seriesNumber', 'seriesTotal', 'seriesStatus', 'seriesGaps', 'seriesPosition'] },
{ translationKey: 'dates', fields: ['publishedDate', 'dateFinished', 'lastReadTime', 'addedOn'] },
{ translationKey: 'ratingsReviews', fields: ['personalRating', 'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'hardcoverRating', 'hardcoverReviewCount', 'ranobedbRating', 'lubimyczytacRating', 'audibleRating', 'audibleReviewCount', 'applebooksRating', 'applebooksReviewCount'] },
{ translationKey: 'ratingsReviews', fields: ['personalRating'] },
{ translationKey: 'qualityMetadata', fields: ['metadataScore', 'metadataPresence'] },
{ translationKey: 'tagsMoods', fields: ['moods', 'tags'] },
{ 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 {
private readonly t = inject(TranslocoService);
private readonly providerFields = inject(MetadataProviderFieldsService);
private readonly injector = inject(Injector);
private readonly controlIds = new WeakMap<AbstractControl, string>();
private controlIdCounter = 0;
numericFieldConfigMap = new Map<RuleField, FieldConfig>(
Object.entries(FIELD_CONFIGS)
readonly fieldConfigs = computed<Record<RuleField, FullFieldConfig>>(() => ({
...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)
.map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}])
);
));
get conditionOptions(): { label: string; value: 'and' | 'or' }[] {
return [
@@ -279,14 +274,14 @@ export class MagicShelfComponent implements OnInit {
}
get fieldOptions() {
return FIELD_GROUPS
return this.fieldGroups()
.map(group => ({
label: this.t.translate(`magicShelf.fieldGroups.${group.translationKey}`),
items: group.fields.map(field => {
const config = FIELD_CONFIGS[field];
const config = this.fieldConfigs()[field];
const translationKey = field === 'categories' ? 'genre' : config.label;
return {
label: this.t.translate(`magicShelf.fields.${translationKey}`),
label: config.providerField ? this.providerFields.label(config.providerField) : this.t.translate(`magicShelf.fields.${translationKey}`),
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() {
return [
{ 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.metadataFields.isbn13'), value: 'isbn13'},
{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.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.metadataFields.personalRating'), value: 'personalRating'},
{label: this.t.translate('magicShelf.metadataFields.amazonRating'), value: 'amazonRating'},
{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'},
...this.providerFieldOptions('rating'),
]},
{ 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.metadataFields.narrator'), value: 'narrator'},
{label: this.t.translate('magicShelf.metadataFields.abridged'), value: 'abridged'},
@@ -576,7 +554,7 @@ export class MagicShelfComponent implements OnInit {
}
buildRuleFromData(data: Rule): RuleFormGroup {
const config = FIELD_CONFIGS[data.field];
const config = this.fieldConfigs()[data.field];
const type = config?.type;
const isRelativeDate = RELATIVE_DATE_OPERATORS.includes(data.operator);
@@ -641,7 +619,7 @@ export class MagicShelfComponent implements OnInit {
if (!field) return [...baseOperators, ...multiValueOperators];
const config = FIELD_CONFIGS[field];
const config = this.fieldConfigs()[field];
if (config.type === 'boolean') {
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. */
private isSingleValue(ruleCtrl: FormGroup, value: unknown): boolean {
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;
}
@@ -664,327 +664,21 @@
@if (providerSectionExpanded) {
<div class="collapsible-content">
<div class="field-row metadata-ids-row">
@if (isFieldVisible('openlibraryId')) {
<div class="field-group metadata-id-field">
<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-with-lock">
<input pSize="small" pInputText id="openlibraryId" formControlName="openlibraryId"/>
@if (!book.metadata!['openlibraryIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('openlibraryId')" 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>
}
@for (field of providerFields.fields(); track field.name) {
@if (isFieldVisible(field.name)) {
<div class="field-group metadata-id-field">
<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>
<div class="field-with-lock">
<input pSize="small" pInputText [id]="field.name" [formControlName]="field.name"/>
@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![field.lockName]) {
<p-button size="small" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.name)" severity="warn"></p-button>
}
</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>
@@ -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 {Button} from "@openng/optimus-ui/button";
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 {UrlHelperService} from "../../../../../shared/service/url-helper.service";
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 {HttpResponse} from "@angular/common/http";
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 {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({
selector: "app-metadata-editor",
standalone: true,
@@ -102,6 +106,9 @@ export class MetadataEditorComponent implements OnInit {
private destroyRef = inject(DestroyRef);
private appSettingsService = inject(AppSettingsService);
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());
metadataForm: FormGroup;
@@ -147,33 +154,13 @@ export class MetadataEditorComponent implements OnInit {
comicTextareaFields = COMIC_TEXTAREA_METADATA_FIELDS;
audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS;
providerSpecificFields: MetadataProviderSpecificFields = {
openlibraryId: true,
asin: true,
amazonRating: true,
amazonReviewCount: true,
googleId: true,
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 readonly providerSpecificFields = computed<MetadataProviderSpecificFields>(
() => this.appSettingsService.appSettings()?.metadataProviderSpecificFields
?? providerFieldRecord(this.providerFields.fields(), () => true),
);
private readonly providerFieldNames = computed(() => new Set(this.providerFields.fields().map(field => field.name)));
private syncProviderFieldsEffect!: EffectRef;
readonly navigationState = this.bookNavigationService.navigationState;
readonly canNavigatePrevious = this.bookNavigationService.canNavigatePrevious;
readonly canNavigateNext = this.bookNavigationService.canNavigateNext;
@@ -279,29 +266,6 @@ export class MetadataEditorComponent implements OnInit {
description: new FormControl(""),
pageCount: 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(""),
seriesNumber: new FormControl(""),
seriesTotal: new FormControl(""),
@@ -321,29 +285,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: new FormControl(false),
pageCountLocked: 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),
seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false),
@@ -380,6 +321,11 @@ export class MetadataEditorComponent implements OnInit {
{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
for (const field of AUDIOBOOK_METADATA_FIELDS) {
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.lockedKey, new FormControl(false));
}
this.syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) {
this.providerSpecificFields = settings.metadataProviderSpecificFields;
}
});
}
ngOnInit(): void {
@@ -427,29 +366,6 @@ export class MetadataEditorComponent implements OnInit {
language: metadata.language ?? null,
rating: metadata.rating ?? 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,
seriesNumber: metadata.seriesNumber ?? null,
seriesTotal: metadata.seriesTotal ?? null,
@@ -466,29 +382,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: metadata.descriptionLocked ?? false,
pageCountLocked: metadata.pageCountLocked ?? 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,
seriesNumberLocked: metadata.seriesNumberLocked ?? false,
seriesTotalLocked: metadata.seriesTotalLocked ?? false,
@@ -501,6 +394,13 @@ export class MetadataEditorComponent implements OnInit {
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
const audiobookPatch: Record<string, unknown> = {};
for (const field of AUDIOBOOK_METADATA_FIELDS) {
@@ -540,30 +440,7 @@ export class MetadataEditorComponent implements OnInit {
{key: "languageLocked", control: "language"},
{key: "isbn10Locked", control: "isbn10"},
{key: "isbn13Locked", control: "isbn13"},
{key: "openlibraryIdLocked", control: "openlibraryId"},
{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"},
...this.providerFields.fields().map(field => ({key: field.lockName, control: field.name})),
{key: "pageCountLocked", control: "pageCount"},
{key: "descriptionLocked", control: "description"},
{key: "seriesNameLocked", control: "seriesName"},
@@ -735,29 +612,6 @@ export class MetadataEditorComponent implements OnInit {
pageCount: form.get("pageCount")?.value,
rating: form.get("rating")?.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,
seriesName: form.get("seriesName")?.value,
seriesNumber: form.get("seriesNumber")?.value,
@@ -785,29 +639,6 @@ export class MetadataEditorComponent implements OnInit {
descriptionLocked: form.get("descriptionLocked")?.value,
pageCountLocked: form.get("pageCountLocked")?.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,
seriesNumberLocked: form.get("seriesNumberLocked")?.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
const comicMetadata: Record<string, unknown> = {};
for (const field of ALL_COMIC_METADATA_FIELDS) {
@@ -879,29 +715,6 @@ export class MetadataEditorComponent implements OnInit {
description: wasCleared("description"),
pageCount: wasCleared("pageCount"),
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"),
seriesNumber: wasCleared("seriesNumber"),
seriesTotal: wasCleared("seriesTotal"),
@@ -913,6 +726,10 @@ export class MetadataEditorComponent implements OnInit {
contentRating: wasCleared("contentRating"),
};
for (const field of this.providerFields.fields()) {
clearFlags[field.name] = wasCleared(field.name);
}
return {metadata, clearFlags};
}
@@ -1101,29 +918,26 @@ export class MetadataEditorComponent implements OnInit {
}, 15000);
}
fetchFromFile(bookId: number) {
async fetchFromFile(bookId: number): Promise<void> {
this.isFetchingFromFile = true;
this.bookMetadataManageService.getFileMetadata(bookId).pipe(
finalize(() => this.isFetchingFromFile = false),
takeUntilDestroyed(this.destroyRef)
).subscribe({
next: (metadata) => {
this.populateFormFromMetadata(metadata);
this.metadataForm.markAsDirty();
this.messageService.add({
severity: 'info',
summary: this.t.translate('metadata.editor.toast.successSummary'),
detail: this.t.translate('metadata.editor.toast.fileMetadataLoaded'),
});
},
error: (err) => {
this.messageService.add({
severity: 'error',
summary: this.t.translate('metadata.editor.toast.errorSummary'),
detail: err?.error?.message || this.t.translate('metadata.editor.toast.fileMetadataFailed'),
});
}
});
try {
this.populateFormFromMetadata(await this.queryClient.query(this.sources.fileMetadata(bookId)));
this.metadataForm.markAsDirty();
this.messageService.add({
severity: 'info',
summary: this.t.translate('metadata.editor.toast.successSummary'),
detail: this.t.translate('metadata.editor.toast.fileMetadataLoaded'),
});
} catch (err) {
const message: unknown = err instanceof HttpErrorResponse ? err.error?.message : null;
this.messageService.add({
severity: 'error',
summary: this.t.translate('metadata.editor.toast.errorSummary'),
detail: typeof message === 'string' ? message : this.t.translate('metadata.editor.toast.fileMetadataFailed'),
});
} finally {
this.isFetchingFromFile = false;
}
}
onNext() {
@@ -1189,7 +1003,7 @@ export class MetadataEditorComponent implements OnInit {
}
isFieldVisible(field: keyof MetadataProviderSpecificFields): boolean {
return this.providerSpecificFields[field] ?? false;
return this.providerSpecificFields()[field];
}
protected readonly sample = sample;
@@ -1225,7 +1039,7 @@ export class MetadataEditorComponent implements OnInit {
}
isEmbeddable(controlName: string, book: Book): boolean {
return isFieldEmbeddable(book.primaryFile?.bookType, controlName);
return isFieldEmbeddable(book.primaryFile?.bookType, controlName, this.providerFieldNames());
}
hasWriter(book: Book): boolean {
@@ -1,13 +1,6 @@
@if (book; as book) {
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="metadata-picker" *transloco="let t; prefix: 'metadata.picker'">
<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 -->
<div class="column-headers">
<div class="column-label current">
@@ -716,7 +709,7 @@
}
<!-- Provider Metadata Section -->
@if (metadataProviderFields.length > 0) {
@if (metadataProviderFields().length > 0) {
<section class="form-section">
<div class="section-header">
<i class="pi pi-cloud"></i>
@@ -724,9 +717,9 @@
</div>
<div class="section-content">
@for (field of metadataProviderFields; track field) {
@for (field of metadataProviderFields(); track field) {
<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-side current">
<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
.dialog-body {
flex: 1;
@@ -374,7 +354,7 @@
min-width: 100px;
@media (width >= 768px) {
min-width: 120px;
width: 120px;
flex-shrink: 0;
}
}
@@ -3,7 +3,6 @@ import {TestBed} from '@angular/core/testing';
import {of} from 'rxjs';
import {beforeEach, describe, expect, it, vi} from 'vitest';
import {MessageService} from '@openng/optimus-ui/api';
import {TranslocoService} from '@jsverse/transloco';
import {CdkDragDrop} from '@angular/cdk/drag-drop';
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 {MetadataFormBuilder} from '../../../../../shared/metadata';
import {MetadataUtilsService} from '../../../../../shared/metadata/metadata-utils.service';
import {getTranslocoModule} from '../../../../../core/testing/transloco-testing';
import {MetadataPickerComponent} from './metadata-picker.component';
describe('MetadataPickerComponent', () => {
@@ -31,7 +31,6 @@ describe('MetadataPickerComponent', () => {
const uploadAudiobookCoverFromUrl = vi.fn(() => of(void 0));
const supportsDualCovers = vi.fn(() => true);
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 getCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `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'],
categories: ['Fantasy'],
description: 'Original description',
provider: 'googleBooks',
provider: 'Google',
coverUpdatedOn: '2026-03-26',
titleLocked: true,
comicMetadata: {
@@ -68,7 +67,7 @@ describe('MetadataPickerComponent', () => {
} as Book;
}
beforeEach(() => {
beforeEach(async () => {
uniqueMetadata.set({
authors: ['Alice', 'Bob'],
categories: ['Fantasy', 'History'],
@@ -82,12 +81,12 @@ describe('MetadataPickerComponent', () => {
uploadAudiobookCoverFromUrl.mockClear();
supportsDualCovers.mockClear();
messageAdd.mockClear();
translate.mockClear();
getThumbnailUrl.mockClear();
getCoverUrl.mockClear();
getAudiobookCoverUrl.mockClear();
TestBed.configureTestingModule({
await TestBed.configureTestingModule({
imports: [getTranslocoModule({preloadLangs: true})],
providers: [
MetadataFormBuilder,
MetadataUtilsService,
@@ -102,9 +101,8 @@ describe('MetadataPickerComponent', () => {
useValue: {getThumbnailUrl, getCoverUrl, getAudiobookCoverUrl},
},
{provide: MessageService, useValue: {add: messageAdd}},
{provide: TranslocoService, useValue: {translate}},
]
});
}).compileComponents();
});
it('syncs provider field visibility from app settings and filters metadata suggestions', () => {
@@ -119,9 +117,9 @@ describe('MetadataPickerComponent', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
TestBed.flushEffects();
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)).not.toContain('amazonRating');
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)).not.toContain('amazonRating');
component.filterItems({query: 'fan'}, 'categories');
expect(component.getFiltered('categories')).toEqual(['Fantasy']);
@@ -134,7 +132,7 @@ describe('MetadataPickerComponent', () => {
component.copiedFields = {title: true};
component.savedFields = {title: true};
component.hoveredFields = {title: true};
component.fetchedMetadata = createMetadata({provider: 'comicvine'});
component.fetchedMetadata = createMetadata({provider: 'Comicvine'});
component.book = createBook();
@@ -151,6 +149,7 @@ describe('MetadataPickerComponent', () => {
it('handles author and array autocomplete helpers without duplicating values', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.fetchedMetadata = createMetadata();
component.book = createBook();
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', () => {
const component = TestBed.runInInjectionContext(() => new MetadataPickerComponent());
component.book = createBook();
component.fetchedMetadata = createMetadata({
title: 'Fetched Title',
provider: 'Audible',
thumbnailUrl: 'https://covers.example/audiobook.jpg',
comicMetadata: {issueNumber: '7'},
});
component.book = createBook();
component.copyFetchedToCurrent('title');
expect(messageAdd).toHaveBeenCalledWith({
severity: 'warn',
summary: 'metadata.picker.toast.actionBlockedSummary',
detail: 'metadata.picker.toast.fieldLockedDetail:title',
summary: 'Action Blocked',
detail: 'title is locked and cannot be updated.',
});
component.metadataForm.get('titleLocked')?.setValue(false);
@@ -208,8 +207,8 @@ describe('MetadataPickerComponent', () => {
component.copyFetchedToCurrent('comicIssueNumber');
expect(messageAdd).toHaveBeenLastCalledWith({
severity: 'warn',
summary: 'metadata.picker.toast.actionBlockedSummary',
detail: 'metadata.picker.toast.fieldLockedDetail:Issue #',
summary: 'Action Blocked',
detail: 'Issue # is locked and cannot be updated.',
});
component.resetField('title');
@@ -217,14 +216,11 @@ describe('MetadataPickerComponent', () => {
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());
component.fetchedMetadata = createMetadata({
provider: 'Audible',
thumbnailUrl: 'https://covers.example/audiobook.jpg',
});
component.fetchedMetadata = createMetadata();
component.book = createBook();
component.copiedFields = {title: true, audiobookThumbnailUrl: true};
component.copiedFields = {title: true};
component.metadataForm.get('titleLocked')?.setValue(false);
component.metadataForm.get('title')?.enable();
component.metadataForm.get('title')?.setValue('Updated Title');
@@ -235,15 +231,34 @@ describe('MetadataPickerComponent', () => {
metadata: expect.objectContaining({title: 'Updated Title'}),
clearFlags: expect.any(Object),
}), false, 'REPLACE_WHEN_PROVIDED');
expect(uploadAudiobookCoverFromUrl).toHaveBeenCalledWith(21, 'https://covers.example/audiobook.jpg');
expect(component.isSaving).toBe(false);
expect(component.isValueSaved('title')).toBe(true);
expect(component.isValueSaved('audiobookThumbnailUrl')).toBe(true);
expect(messageAdd).toHaveBeenCalledWith({
severity: 'info',
summary: 'metadata.picker.toast.successSummary',
detail: 'metadata.picker.toast.metadataUpdated',
summary: 'Success',
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');
expect(component.metadataForm.get('coverLocked')?.value).toBe(true);
@@ -252,24 +267,11 @@ describe('MetadataPickerComponent', () => {
component.lockAll();
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 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.savedFields = {title: false};
@@ -278,19 +280,43 @@ describe('MetadataPickerComponent', () => {
component.onMouseLeave('title');
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();
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);
component.fetchedMetadata = createMetadata({provider: 'Audible', narrator: 'Narrator', comicMetadata: {issueNumber: '7'}});
component.fetchedMetadata = createMetadata({provider: 'Audible', narrator: 'Narrator'});
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.hasAudiobookFormat(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.hasAnyCurrentComicData()).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 {MessageService} from '@openng/optimus-ui/api';
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 {AppSettingsService} from '../../../../../shared/service/app-settings.service';
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';
@Component({
@@ -50,8 +50,6 @@ export class MetadataPickerComponent {
metadataDescription: MetadataFieldConfig[] = [];
metadataSeriesFields: MetadataFieldConfig[] = [];
metadataBookDetailsFields: MetadataFieldConfig[] = [];
metadataProviderFields: MetadataFieldConfig[] = [];
metadataFieldsBottom: MetadataFieldConfig[] = [];
audiobookMetadataFields: MetadataFieldConfig[] = [];
comicTextFields: MetadataFieldConfig[] = [];
comicArrayFields: MetadataFieldConfig[] = [];
@@ -84,7 +82,6 @@ export class MetadataPickerComponent {
return this.currentBook;
}
@Input() detailLoading = false;
@Output() goBack = new EventEmitter<boolean>();
currentBook: Book | null = null;
@@ -110,13 +107,16 @@ export class MetadataPickerComponent {
private formBuilder = inject(MetadataFormBuilder);
private metadataUtils = inject(MetadataUtilsService);
private readonly t = inject(TranslocoService);
protected readonly providerFields = inject(MetadataProviderFieldsService);
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() {
this.metadataForm = this.formBuilder.buildForm(true);
this.metadataForm = this.formBuilder.buildForm(true, this.allFields());
this.initFieldArrays();
}
@@ -126,22 +126,12 @@ export class MetadataPickerComponent {
this.metadataDescription = getTextareaFields();
this.metadataSeriesFields = getSeriesFields();
this.metadataBookDetailsFields = getBookDetailsFields();
this.updateProviderFields();
this.updateBottomFields();
this.audiobookMetadataFields = AUDIOBOOK_METADATA_FIELDS;
this.comicTextFields = COMIC_TEXT_METADATA_FIELDS;
this.comicArrayFields = COMIC_ARRAY_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[] {
return this.filteredItems[controlName] ?? [];
}
@@ -155,9 +145,7 @@ export class MetadataPickerComponent {
private readonly syncProviderFieldsEffect = effect(() => {
const settings = this.appSettingsService.appSettings();
if (settings?.metadataProviderSpecificFields) {
this.enabledProviderFields = settings.metadataProviderSpecificFields;
this.updateProviderFields();
this.updateBottomFields();
this.enabledProviderFields.set(settings.metadataProviderSpecificFields);
}
});
@@ -165,7 +153,7 @@ export class MetadataPickerComponent {
void book;
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 lockedKey = field.lockedKey as keyof BookMetadata;
const value = metadata[key];
@@ -222,7 +210,7 @@ export class MetadataPickerComponent {
private applyLockStates(metadata: BookMetadata): void {
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];
}
// 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];
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) {
@@ -349,7 +337,7 @@ export class MetadataPickerComponent {
private buildMetadataFromForm(): BookMetadata {
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') {
metadata[field.controlName] = this.getArrayValue(field.controlName);
} else if (field.type === 'number') {
@@ -460,7 +448,7 @@ export class MetadataPickerComponent {
private inferClearFlags(current: BookMetadata, original: BookMetadata): MetadataClearFlags {
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 curr = current[key];
const orig = original[key];
@@ -3,7 +3,6 @@
<app-metadata-picker
[fetchedMetadata]="selectedMetadata"
[book]="book()"
[detailLoading]="detailLoading()"
(goBack)="onGoBack()">
</app-metadata-picker>
</div>
@@ -20,8 +19,10 @@
inputId="metadata-search-providers"
[filter]="false"
showToggleAll="false"
[options]="providers()"
formControlName="provider"
[options]="providerOptions()"
optionLabel="label"
optionValue="id"
formControlName="providers"
[placeholder]="t('selectProviders')"
class="'custom-multiselect'">
</p-multiselect>
@@ -84,7 +85,7 @@
</div>
</form>
@if (loading() || searchTriggered()) {
@if (hasSearched()) {
<div class="provider-status">
<div class="status-header">
<div class="results-info">
@@ -104,19 +105,20 @@
<div class="provider-pills">
@for (tab of providerTabs(); track tab.provider) {
<div class="provider-pill"
[class]="'provider-' + providerClass(tab.provider)"
[class.has-results]="tab.count > 0"
[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.tabindex]="tab.count > 0 ? '0' : null"
(click)="tab.count > 0 && onProviderPillClick(tab.provider, $event)"
(keydown.enter)="tab.count > 0 && onProviderPillClick(tab.provider, $event)"
[style.cursor]="tab.count > 0 ? 'pointer' : 'default'">
(keydown.enter)="tab.count > 0 && onProviderPillClick(tab.provider, $event)">
<div class="pill-icon">
<i class="pi pi-database"></i>
</div>
<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) {
<i class="pi pi-spin pi-spinner pill-spinner"></i>
} @else {
@@ -129,23 +131,31 @@
</div>
}
@if (!searchTriggered() && results().length === 0) {
@if (!hasSearched()) {
<div class="empty-state">
<div class="empty-icon">
<i class="pi pi-search"></i>
</div>
<h3>{{ t('readyToSearch') }}</h3>
<p>{{ t('readyToSearchHint') }}</p>
@if (noProviders()) {
<h3>{{ t('noProviders') }}</h3>
} @else {
<h3>{{ t('readyToSearch') }}</h3>
<p>{{ t('readyToSearchHint') }}</p>
}
</div>
}
@if (searchTriggered() && results().length === 0 && !loading()) {
@if (hasSearched() && !loading() && (results().length === 0 || failed())) {
<div class="empty-state">
<div class="empty-icon no-results">
<i class="pi pi-inbox"></i>
</div>
<h3>{{ t('noResultsFound') }}</h3>
<p>{{ t('noResultsHint') }}</p>
@if (failed()) {
<h3>{{ t('searchFailed') }}</h3>
} @else {
<h3>{{ t('noResultsFound') }}</h3>
<p>{{ t('noResultsHint') }}</p>
}
</div>
}
@@ -164,7 +174,7 @@
class="book-cover"
[src]="metadata.thumbnailUrl"
[title]="metadata.title"
[authors]="metadata.authors ?? []"
[authors]="metadata.authors"
[alt]="metadata.title ?? ''"/>
<div class="card-overlay">
<i class="pi pi-eye"></i>
@@ -174,32 +184,20 @@
<div class="card-content">
<div class="card-header">
<h4 class="card-title">{{ truncateText(metadata.title!, 60) }}</h4>
<div
class="card-provider"
[class]="'card-provider provider-' + providerClass(metadata)"
role="button"
tabindex="0"
(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') }}
}
<h4 class="card-title">{{ truncateText(metadata.title, 60) }}</h4>
<div class="card-provider" [class]="'provider-' + providerClass(metadata.provider)">
@let providerLabel = providerLabelKey(metadata.provider) | transloco;
@if (metadata.externalUrl; as href) {
<a [href]="href" target="_blank" rel="noopener" (click)="$event.stopPropagation()">
{{ providerLabel }}
</a>
} @else if (providerName(metadata); as name) {
{{ name }}
} @else {
{{ t('unknownProvider') }}
{{ providerLabel }}
}
</div>
</div>
@if (metadata.authors && metadata.authors.length > 0) {
@if (metadata.authors?.length) {
<p class="card-authors">
<i class="pi pi-user"></i>
{{ 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 {Subject} from 'rxjs';
import {experimental_streamedQuery, provideTanStackQuery, queryOptions, QueryClient} from '@tanstack/angular-query-experimental';
import {beforeEach, describe, expect, it, vi} from 'vitest';
import {Book, BookMetadata} from '../../../../book/model/book.model';
import {BookMetadataService} from '../../../../book/service/book-metadata.service';
import {getTranslocoModule} from '../../../../../core/testing/transloco-testing';
import {AppSettings} from '../../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
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 {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})
class PickerStub {
readonly fetchedMetadata = input<BookMetadata>();
readonly book = input<Book | null>();
readonly detailLoading = input(false);
readonly goBack = output<boolean>();
}
@@ -31,55 +30,73 @@ class CoverStub {
}
describe('MetadataSearcherComponent', () => {
const providers = signal(METADATA_PROVIDER_LIST);
const providersLoading = signal(false);
let fixture: ComponentFixture<MetadataSearcherComponent>;
let component: MetadataSearcherComponent;
let search$: Subject<BookMetadata>;
let detail$: Subject<BookMetadata>;
let providers$: Subject<MetadataProvider[]>;
let results: MetadataSearchResult[];
let streamError: Error | null;
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 fetchBookMetadata = vi.fn();
const fetchMetadataDetail = vi.fn();
const fetchMetadataProviders = vi.fn();
const settings = (): AppSettings => ({
autoBookSearch: false,
const settings = (autoBookSearch = false): Pick<AppSettings, 'autoBookSearch' | 'metadataProviderSettings'> => ({
autoBookSearch,
metadataProviderSettings: {
openLibrary: {enabled: true},
amazon: {enabled: false, cookie: '', domain: 'com'},
google: {enabled: false, language: '', apiKey: ''},
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 => ({
id: 1,
const book = (id = 1) => ({
id,
libraryId: 1,
metadata: {bookId: 1, title: 'Dune', authors: ['Frank Herbert'], isbn13: '9780441013593'},
} as Book);
const openLibraryResult = (): BookMetadata => ({
bookId: 1,
provider: 'OpenLibrary',
title: 'Dune',
openlibraryId: '/books/OL30014174M',
goodreadsId: '53403754',
metadata: {bookId: id, title: 'Dune', authors: ['Frank Herbert'], isbn13: '9780441013593'},
});
beforeEach(async () => {
search$ = new Subject<BookMetadata>();
detail$ = new Subject<BookMetadata>();
providers$ = new Subject<MetadataProvider[]>();
providers.set(METADATA_PROVIDER_LIST);
providersLoading.set(false);
results = [];
streamError = null;
queryResult = Promise.resolve(results);
prospective.mockClear();
appSettings.set(null);
fetchBookMetadata.mockReset().mockReturnValue(search$.asObservable());
fetchMetadataDetail.mockReset().mockReturnValue(detail$.asObservable());
fetchMetadataProviders.mockReset().mockReturnValue(providers$.asObservable());
await TestBed.configureTestingModule({
imports: [MetadataSearcherComponent, getTranslocoModule()],
providers: [
provideZonelessChangeDetection(),
provideTanStackQuery(queryClient = new QueryClient()),
{provide: AppSettingsService, useValue: {appSettings}},
{provide: BookMetadataService, useValue: {fetchBookMetadata, fetchMetadataDetail}},
{provide: MetadataProviderService, useValue: {fetchMetadataProviders, fetchMetadataDetail}},
{provide: MetadataSourceQueryService, useValue: {
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, {
@@ -92,27 +109,41 @@ describe('MetadataSearcherComponent', () => {
component = fixture.componentInstance;
});
function setUp(isActiveTab = false): void {
appSettings.set(settings());
fixture.componentRef.setInput('book', book());
function setUp(isActiveTab = false, autoBookSearch = false, id = 1): void {
appSettings.set(settings(autoBookSearch));
fixture.componentRef.setInput('book', book(id));
fixture.componentRef.setInput('isActiveTab', isActiveTab);
fixture.detectChanges();
}
it('keeps an OpenLibrary result even when it carries a Goodreads ID', () => {
setUp();
const result = openLibraryResult();
function latestQuery() {
const query = prospective.mock.results.at(-1);
if (!query || query.type !== 'return') throw new Error('Expected a prospective query');
return query.value;
}
async function submit(): Promise<void> {
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();
expect(component.selected()).toBe(result);
expect(component.detailLoading()).toBe(false);
await submit();
component.onBookClick(component.results()[0]);
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);
component.form.patchValue({title: 'Dune Messiah', isbn: ''});
@@ -121,7 +152,7 @@ describe('MetadataSearcherComponent', () => {
fixture.componentRef.setInput('isActiveTab', true);
fixture.detectChanges();
expect(component.form.value.title).toBe('Dune Messiah');
expect(component.form.value.isbn).toBe('');
expect(component.form.value).toMatchObject({title: 'Dune Messiah', isbn: ''});
});
});
@@ -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 {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {FormBuilder, ReactiveFormsModule} from '@angular/forms';
import {Button} from '@openng/optimus-ui/button';
import {InputText} from '@openng/optimus-ui/inputtext';
import {MultiSelect} from '@openng/optimus-ui/multiselect';
import {Tooltip} from '@openng/optimus-ui/tooltip';
import {TranslocoDirective} from '@jsverse/transloco';
import {catchError, Subject, takeUntil} from 'rxjs';
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {FetchMetadataRequest} from '../../../model/request/fetch-metadata-request.model';
import {Book, BookMetadata} from '../../../../book/model/book.model';
import {Book} from '../../../../book/model/book.model';
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 {CoverComponent} from '../../../../../shared/components/cover/cover.component';
import {MetadataProviderService} from '../../../service/metadata-provider.service';
import {map} from 'rxjs/operators';
import {MetadataCatalogService} from '../../../../../shared/metadata/metadata-catalog.service';
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> = {
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};
}
const NO_SEARCH: MetadataSearchParams = {bookId: 0, providers: []};
@Component({
selector: 'app-metadata-searcher',
@@ -59,70 +28,81 @@ export function detailRequestFor(result: BookMetadata): { provider: string; id:
styleUrls: ['./metadata-searcher.component.scss'],
imports: [
ReactiveFormsModule,
FormsModule,
Button,
InputText,
MetadataPickerComponent,
MultiSelect,
Tooltip,
TranslocoDirective,
TranslocoPipe,
CoverComponent
],
standalone: true
})
export class MetadataSearcherComponent implements OnDestroy {
export class MetadataSearcherComponent {
readonly book = input<Book | null>(null);
readonly isActiveTab = input(false);
private readonly formBuilder = inject(FormBuilder);
private readonly bookMetadataService = inject(BookMetadataService);
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({
provider: null,
title: [''],
author: [''],
isbn: ['']
readonly form = this.formBuilder.group({
providers: this.formBuilder.control<MetadataProviderId[] | null>(null),
title: this.formBuilder.nonNullable.control(''),
author: this.formBuilder.nonNullable.control(''),
isbn: this.formBuilder.nonNullable.control('')
});
readonly results = signal<BookMetadata[]>([]);
readonly searchedProviders = signal<string[]>([]);
readonly loading = signal(false);
readonly searchTriggered = signal(false);
readonly selectedFilters = signal<Set<string>>(new Set(['all']));
readonly selected = signal<BookMetadata | null>(null);
readonly detailLoading = signal(false);
readonly results = computed(() => this.query.data() ?? []);
readonly loading = this.query.isFetching;
readonly failed = computed(() => this.query.isError());
readonly hasSearched = computed(() => this.search() !== null);
readonly selectedFilters = signal<Set<MetadataProviderId | 'all'>>(new Set(['all']));
readonly selected = signal<MetadataSearchResult | null>(null);
readonly providers = toSignal(
this.metadataProviderService.fetchMetadataProviders()
.pipe(map(
providers => providers.filter(p => p.enabled).map(p => capitalize(p.name))
))
.pipe(catchError(() => []))
);
readonly providers = computed(() => this.sources.enabledProviders().map(provider => provider.id));
readonly noProviders = computed(() => !this.sources.providersLoading() && this.providers().length === 0);
readonly providerOptions = computed(() => this.sources.enabledProviders().map(provider => ({
id: provider.id,
label: this.t.translate(provider.labelKey, {}, this.activeLang()),
})));
readonly resultsByProvider = computed(() => {
const groups = new Map<string, BookMetadata[]>();
this.searchedProviders().forEach(provider => groups.set(provider.toLowerCase(), []));
const groups = new Map<MetadataProviderId, MetadataSearchResult[]>();
this.search()?.providers.forEach(provider => groups.set(provider, []));
for (const result of this.results()) {
const key = providerKey(result);
groups.set(key, [...(groups.get(key) ?? []), result]);
groups.get(result.provider)?.push(result);
}
return groups;
});
readonly providerTabs = computed(() =>
this.searchedProviders().map(provider => ({
provider,
count: this.resultsByProvider().get(provider.toLowerCase())?.length ?? 0
}))
);
readonly providerTabs = computed(() => Array.from(
this.resultsByProvider(),
([provider, results]) => ({provider, count: results.length})
));
readonly interleavedResults = computed(() => {
private readonly interleavedResults = computed(() => {
const lists = Array.from(this.resultsByProvider().values());
const maxLength = Math.max(0, ...lists.map(list => list.length));
const interleaved: BookMetadata[] = [];
const interleaved: MetadataSearchResult[] = [];
for (let i = 0; i < maxLength; i++) {
for (const list of lists) {
if (i < list.length) interleaved.push(list[i]);
@@ -134,19 +114,14 @@ export class MetadataSearcherComponent implements OnDestroy {
readonly filteredResults = computed(() => {
const filters = this.selectedFilters();
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() {
effect(() => {
if (!this.appSettingsService.appSettings() || this.sources.providersLoading()) return;
const providers = this.providers();
if (!this.appSettingsService.appSettings() || !providers) return;
const control = this.form.get('provider')!;
const control = this.form.controls.providers;
if (!this.providersInitialised) {
this.providersInitialised = true;
@@ -154,7 +129,7 @@ export class MetadataSearcherComponent implements OnDestroy {
return;
}
const current: string[] = control.value ?? [];
const current = control.value ?? [];
const valid = current.filter(provider => providers.includes(provider));
if (valid.length !== current.length) {
control.setValue(valid.length > 0 ? valid : null);
@@ -169,173 +144,107 @@ export class MetadataSearcherComponent implements OnDestroy {
}
const settings = this.appSettingsService.appSettings();
const providers = this.providers();
if (!settings || !providers || book.id === this.bookId) return;
if (!settings || book.id === this.resetForBookId) return;
this.bookId = book.id;
this.resetForBookId = book.id;
this.resetForBook(book);
if (providers.length > 0) {
this.autoSearchPending.set(!!settings.autoBookSearch);
}
});
effect(() => {
if (this.autoSearchPending() && this.isActiveTab()) {
if (this.autoSearchPending() && this.isActiveTab() && !this.sources.providersLoading()) {
this.autoSearchPending.set(false);
this.onSubmit();
}
});
}
ngOnDestroy(): void {
this.cancel$.next();
this.cancel$.complete();
}
get isSearchEnabled(): boolean {
const providerSelected = !!this.form.get('provider')?.value;
const title = this.form.get('title')?.value;
const isbn = this.form.get('isbn')?.value;
return providerSelected && (title || isbn);
const providerSelected = !!this.form.controls.providers.value?.length;
const title = this.form.controls.title.value;
const isbn = this.form.controls.isbn.value;
return providerSelected && (title.length > 0 || isbn.length > 0);
}
onSubmit(): void {
this.searchTriggered.set(true);
const selectedProviders: string[] | null = this.form.get('provider')?.value;
if (!selectedProviders?.length || this.bookId === null) return;
const selectedProviders = this.form.controls.providers.value;
const bookId = this.book()?.id;
if (!selectedProviders?.length || bookId === undefined) return;
const request: FetchMetadataRequest = {
bookId: this.bookId,
const params: MetadataSearchParams = {
bookId,
providers: selectedProviders,
title: this.form.get('title')?.value,
author: this.form.get('author')?.value,
isbn: this.form.get('isbn')?.value
title: this.form.controls.title.value,
author: this.form.controls.author.value,
isbn: this.form.controls.isbn.value
};
this.cancel$.next();
this.results.set([]);
this.searchedProviders.set(selectedProviders);
this.selectedFilters.set(new Set(['all']));
this.loading.set(true);
this.bookMetadataService.fetchBookMetadata(request.bookId, request)
.pipe(takeUntil(this.cancel$))
.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)
});
void this.queryClient.resetQueries({queryKey: this.sources.prospective(params).queryKey, exact: true});
this.search.set(params);
}
onBookClick(result: BookMetadata): void {
onBookClick(result: MetadataSearchResult): void {
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 {
this.detailLoading.set(false);
this.selected.set(null);
}
onProviderPillClick(provider: string, event: Event): void {
const key = provider.toLowerCase();
onProviderPillClick(provider: MetadataProviderId, event: Event): void {
const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey);
this.selectedFilters.update(filters => {
const next = new Set(filters);
if (isModifierClick) {
if (next.has(key)) {
next.delete(key);
if (next.has(provider)) {
next.delete(provider);
} else {
next.add(key);
next.add(provider);
next.delete('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.add('all');
} else {
next.clear();
next.add(key);
next.add(provider);
}
return next;
});
}
isProviderPillActive(provider: string): boolean {
return this.selectedFilters().has(provider.toLowerCase());
isProviderPillActive(provider: MetadataProviderId): boolean {
return this.selectedFilters().has(provider);
}
providerClass(result: BookMetadata): string {
return providerKey(result);
providerClass(id: MetadataProviderId): string {
return id.toLowerCase();
}
providerName(result: BookMetadata): string | null {
return result.provider ?? null;
providerLabelKey(id: MetadataProviderId): string {
return this.catalog.provider(id)?.labelKey ?? id;
}
providerHref(result: BookMetadata): string | null {
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 '';
sanitizeHtml(htmlString: string): string {
return htmlString.replace(/<\/?[^>]+(>|$)/g, '').trim();
}
truncateText(text: string | null, length: number): string {
truncateText(text: string | undefined, length: number): string {
const safeText = text ?? '';
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 {
this.cancel$.next();
this.loading.set(false);
this.detailLoading.set(false);
this.searchTriggered.set(false);
this.search.set(null);
this.selected.set(null);
this.results.set([]);
this.searchedProviders.set([]);
this.selectedFilters.set(new Set(['all']));
}
private clearForNoBook(): void {
this.bookId = null;
this.resetForBookId = null;
this.autoSearchPending.set(false);
this.resetSearchState();
this.form.patchValue({title: '', author: '', isbn: ''});
@@ -343,10 +252,6 @@ export class MetadataSearcherComponent implements OnDestroy {
private resetForBook(book: Book): void {
this.resetSearchState();
this.patchFormFromBook(book);
}
private patchFormFromBook(book: Book): void {
this.form.patchValue({
title: book.metadata?.title ?? '',
author: book.metadata?.authors?.[0] ?? '',
@@ -184,127 +184,20 @@
</p-button>
</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="external-ratings">
@if (book?.metadata?.amazonRating || book?.metadata?.asin) {
<a
class="rating-link"
[href]="'https://www.amazon.com/dp/' + (book.metadata?.asin ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="book?.metadata?.amazonRating ? getRatingTooltip(book, 'amazon') : undefined"
@for (provider of providerBadges(); track provider.id) {
<span
class="rating-badge"
[pTooltip]="provider.tooltip"
tooltipPosition="top"
>
<img src="https://www.amazon.com/favicon.ico" alt="Amazon" class="rating-favicon"/>
@if (book?.metadata?.amazonRating) {
<span class="rating-value">{{ getRatingPercent(book.metadata!.amazonRating) }}%</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>
<span class="rating-provider">{{ provider.labelKey | transloco }}</span>
<span class="rating-value">{{ getRatingPercent(provider.rating) }}%</span>
</span>
}
</div>
</div>
@@ -317,29 +317,16 @@
}
}
.rating-link {
.rating-badge {
display: flex;
align-items: center;
gap: 0.3281rem;
text-decoration: none;
color: var(--color-text);
transition: transform 0.2s ease;
}
.rating-link:hover {
transform: translateY(-2px);
}
.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-provider {
font-size: var(--app-text-sm);
color: var(--color-text-secondary);
}
.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 {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 {ConfirmationService, MessageService, MenuItem} from '@openng/optimus-ui/api';
import {TranslocoService} from '@jsverse/transloco';
@@ -42,6 +44,8 @@ interface ConfirmationLike {
}
describe('MetadataViewerComponent', () => {
let langChanges: BehaviorSubject<string>;
const providers = signal(METADATA_PROVIDER_LIST);
const currentUser = signal<CurrentUser | null>(null);
const appSettings = signal<AppSettings | null>(null);
const navigationState = signal(false);
@@ -90,10 +94,11 @@ describe('MetadataViewerComponent', () => {
});
const messageAdd = vi.fn();
const translate = vi.fn((key: string, params?: Record<string, unknown>) => {
const translatedKey = langChanges.value === 'en' ? key : `${langChanges.value}:${key}`;
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 getAudiobookCoverUrl = vi.fn((bookId: number, updatedOn?: string) => `audio:${bookId}:${updatedOn ?? 'none'}`);
@@ -150,6 +155,8 @@ describe('MetadataViewerComponent', () => {
}
beforeEach(() => {
langChanges = new BehaviorSubject('en');
providers.set(METADATA_PROVIDER_LIST);
currentUser.set(null);
appSettings.set(null);
navigationState.set(false);
@@ -202,7 +209,8 @@ describe('MetadataViewerComponent', () => {
TestBed.configureTestingModule({
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: BookDialogHelperService,
@@ -482,7 +490,6 @@ describe('MetadataViewerComponent', () => {
expect(component.getStarColorScaled(null)).toBe('rgb(203, 213, 225)');
expect(component.getStarColorScaled(5)).toBe('rgb(34, 197, 94)');
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('missing')).toBe('UNSET');
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(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 {Checkbox} from '@openng/optimus-ui/checkbox';
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({
selector: 'app-metadata-viewer',
@@ -100,6 +108,7 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
}
private readonly t = inject(TranslocoService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
private libraryService = inject(LibraryService);
private bookDialogHelperService = inject(BookDialogHelperService)
private emailService = inject(EmailService);
@@ -118,6 +127,34 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
private dialogRef = inject(DynamicDialogRef, { optional: true });
private userState = this.userService.currentUser;
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 {
if (this.metadataCenterViewMode !== 'dialog') {
@@ -475,7 +512,6 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
if (user) {
this.metadataCenterViewMode = user.userSettings.metadataCenterViewMode ?? 'route';
}
}
ngAfterViewChecked(): void {
@@ -1139,40 +1175,6 @@ export class MetadataViewerComponent implements OnInit, AfterViewChecked {
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 {
if (rating == null) return 0;
return Math.round((rating / 5) * 100);
@@ -8,11 +8,13 @@
</p>
</div>
<div class="header-actions">
<p-tag
[value]="getSyncStatusLabel()"
[severity]="getSyncStatusSeverity()"
class="sync-status-tag"
/>
@if (syncStatus() !== null) {
<p-tag
[value]="syncStatusLabel()"
[severity]="syncStatusSeverity()"
class="sync-status-tag"
/>
}
</div>
</div>
@@ -21,6 +23,12 @@
<i class="pi pi-spin pi-spinner"></i>
<span>{{ t('loading') }}</span>
</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 {
<div class="sidecar-actions">
<p-button
@@ -37,7 +45,7 @@
[label]="t('importBtn')"
icon="pi pi-download"
[loading]="importing()"
[disabled]="syncStatus === 'MISSING'"
[disabled]="syncStatus() === 'MISSING'"
(onClick)="importFromSidecar()"
severity="secondary"
size="small"
@@ -46,7 +54,7 @@
/>
</div>
@if (syncStatus === 'MISSING') {
@if (syncStatus() === 'MISSING') {
<div class="empty-state">
<i class="pi pi-file"></i>
<h4>{{ t('noSidecarTitle') }}</h4>
@@ -54,33 +62,33 @@
{{ t('noSidecarDescription') }}
</p>
</div>
} @else if (sidecarContent) {
} @else if (sidecarContent(); as sidecar) {
<div class="sidecar-content">
<div class="content-header">
<div class="content-meta">
<span class="meta-item">
<i class="pi pi-clock"></i>
{{ t('generatedLabel') }} {{ sidecarContent.generatedAt | date:'medium' }}
{{ t('generatedLabel') }} {{ sidecar.generatedAt | date:'medium' }}
</span>
<span class="meta-item">
<i class="pi pi-tag"></i>
{{ t('versionLabel') }} {{ sidecarContent.version }}
{{ t('versionLabel') }} {{ sidecar.version }}
</span>
<span class="meta-item">
<i class="pi pi-cog"></i>
{{ t('byLabel') }} {{ sidecarContent.generatedBy }}
{{ t('byLabel') }} {{ sidecar.generatedBy }}
</span>
</div>
</div>
<div class="json-viewer">
<pre class="json-content">{{ sidecarContent | json }}</pre>
<pre class="json-content">{{ sidecar | json }}</pre>
</div>
@if (sidecarContent.cover) {
@if (sidecar.cover; as cover) {
<div class="cover-info">
<i class="pi pi-image"></i>
<span>{{ t('coverFileLabel') }} {{ sidecarContent.cover.path }}</span>
<span>{{ t('coverFileLabel') }} {{ cover.path }}</span>
</div>
}
</div>
@@ -1,58 +1,88 @@
import {TestBed} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
import {of, throwError} from 'rxjs';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {MessageService} from '@openng/optimus-ui/api';
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 {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';
describe('SidecarViewerComponent', () => {
const getSyncStatus = vi.fn();
const getSidecarContent = vi.fn();
const exportToSidecar = vi.fn();
const importFromSidecar = vi.fn();
let status: SidecarSyncStatus;
let statusError: Error | null;
let contentError: Error | null;
let content: SidecarMetadata;
let queryClient: QueryClient;
let fixture: ComponentFixture<SidecarViewerComponent>;
let langChanges: BehaviorSubject<string>;
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 {
return {
id,
title: `Book ${id}`,
libraryId: 1,
libraryName: 'Library',
} as Book;
}
const book = (id: number): Book => ({id, libraryId: 1, libraryName: 'Library'});
function createMetadata(): SidecarMetadata {
return {
beforeEach(() => {
langChanges = new BehaviorSubject('en');
status = 'IN_SYNC';
statusError = null;
contentError = null;
content = {
version: '1',
generatedAt: '2026-03-26T00:00:00Z',
generatedBy: 'test',
metadata: {title: 'Example'},
cover: {source: 'embedded', path: '/covers/example.jpg'},
};
}
beforeEach(() => {
vi.restoreAllMocks();
getSyncStatus.mockReset();
getSidecarContent.mockReset();
exportToSidecar.mockReset();
importFromSidecar.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({
providers: [
{
provide: SidecarService,
useValue: {getSyncStatus, getSidecarContent, exportToSidecar, importFromSidecar},
},
provideTanStackQuery(queryClient),
{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();
});
it('resets its state when the selected book is cleared', () => {
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
component.currentBookId = 7;
component.sidecarContent = createMetadata();
component.syncStatus = 'IN_SYNC';
component.loading.set(true);
component.error = 'failed';
async function createComponent(bookId = 7): Promise<SidecarViewerComponent> {
fixture = TestBed.createComponent(SidecarViewerComponent);
fixture.componentRef.setInput('book', book(bookId));
await fixture.whenStable();
await queryClient.fetchQuery(sidecarStatus(bookId)).catch(() => undefined);
await fixture.whenStable();
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.sidecarContent).toBeNull();
expect(component.syncStatus).toBe('NOT_APPLICABLE');
expect(component.loading()).toBe(false);
expect(component.error).toBeNull();
expect(component.syncStatus()).toBe('IN_SYNC');
expect(component.sidecarContent()).toEqual(content);
expect(component.syncStatusLabel()).toBe('translated:metadata.sidecar.syncStatusInSync');
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', () => {
const metadata = createMetadata();
getSyncStatus.mockReturnValue(of({status: 'IN_SYNC'}));
getSidecarContent.mockReturnValue(of(metadata));
it('skips sidecar content for missing and not-applicable statuses', async () => {
status = 'MISSING';
const missing = await createComponent(3);
expect(missing.sidecarContent()).toBeNull();
expect(contentQuery).not.toHaveBeenCalled();
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
component.book = createBook(7);
expect(getSyncStatus).toHaveBeenCalledWith(7);
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);
status = 'NOT_APPLICABLE';
const notApplicable = await createComponent(4);
expect(notApplicable.sidecarContent()).toBeNull();
expect(contentQuery).not.toHaveBeenCalled();
});
it('skips content loading when the sidecar is missing or not applicable', () => {
const component = TestBed.runInInjectionContext(() => new SidecarViewerComponent());
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][] = [
it('maps every status to its severity and label', async () => {
const cases: [SidecarSyncStatus, ReturnType<SidecarViewerComponent['syncStatusSeverity']>, string][] = [
['IN_SYNC', 'success', 'translated:metadata.sidecar.syncStatusInSync'],
['OUTDATED', 'warn', 'translated:metadata.sidecar.syncStatusOutdated'],
['CONFLICT', 'danger', 'translated:metadata.sidecar.syncStatusConflict'],
['MISSING', 'secondary', 'translated:metadata.sidecar.syncStatusMissing'],
['NOT_APPLICABLE', 'info', 'translated:metadata.sidecar.syncStatusNA'],
['UNKNOWN', 'info', 'translated:metadata.sidecar.syncStatusUnknown'],
];
for (const [status, severity, label] of cases) {
component.syncStatus = status as SidecarSyncStatus;
expect(component.getSyncStatusSeverity()).toBe(severity);
expect(component.getSyncStatusLabel()).toBe(label);
for (const [index, [nextStatus, severity, label]] of cases.entries()) {
status = nextStatus;
const component = await createComponent(index + 20);
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 {takeUntil} from 'rxjs/operators';
import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
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 {Button} from '@openng/optimus-ui/button';
import {Tag} from '@openng/optimus-ui/tag';
import {Tooltip} from '@openng/optimus-ui/tooltip';
import {DatePipe, JsonPipe} from '@angular/common';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
@Component({
selector: 'app-sidecar-viewer',
standalone: true,
templateUrl: './sidecar-viewer.component.html',
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 {
@Input()
set book(value: Book | null) {
if (!value) {
this.currentBookId = null;
this.sidecarContent = null;
this.syncStatus = 'NOT_APPLICABLE';
this.loading.set(false);
this.error = null;
return;
}
readonly book = input<Book | null>(null);
readonly currentBookId = computed(() => this.book()?.id ?? null);
this.currentBookId = value.id;
this.loadSidecarData(value.id);
}
private sidecarService = inject(SidecarService);
private messageService = inject(MessageService);
private readonly sidecarService = inject(SidecarService);
private readonly sources = inject(MetadataSourceQueryService);
private readonly queryClient = inject(QueryClient);
private readonly messageService = inject(MessageService);
private readonly t = inject(TranslocoService);
private readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
private destroy$ = new Subject<void>();
sidecarContent: SidecarMetadata | null = null;
syncStatus: SidecarSyncStatus = 'NOT_APPLICABLE';
loading = signal(false);
exporting = signal(false);
importing = signal(false);
currentBookId: number | null = null;
error: string | null = null;
private readonly statusQuery = injectQuery(() => ({
...this.sources.sidecarStatus(this.currentBookId() ?? 0),
enabled: this.currentBookId() !== null,
}));
loadSidecarData(bookId: number): void {
this.loading.set(true);
this.error = null;
readonly syncStatus = computed<SidecarSyncStatus | null>(() =>
this.statusQuery.isError() ? null : this.statusQuery.data()?.status ?? 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(
takeUntil(this.destroy$)
).subscribe({
next: (response) => {
this.syncStatus = response.status;
private readonly contentQuery = injectQuery(() => ({
...this.sources.sidecar(this.currentBookId() ?? 0),
enabled: this.currentBookId() !== null && this.hasSidecar(),
}));
if (response.status !== 'MISSING' && response.status !== 'NOT_APPLICABLE') {
this.loadSidecarContent(bookId);
} else {
this.sidecarContent = null;
this.loading.set(false);
}
},
error: (err) => {
this.syncStatus = 'NOT_APPLICABLE';
this.sidecarContent = null;
this.loading.set(false);
console.error('Failed to get sync status:', err);
}
});
}
readonly sidecarContent = computed<SidecarMetadata | null>(() =>
this.hasSidecar() && !this.contentQuery.isError() ? this.contentQuery.data() ?? null : null
);
readonly loading = computed(() => this.statusQuery.isLoading() || this.contentQuery.isLoading());
readonly failed = computed(() => this.statusQuery.isError() || (this.hasSidecar() && this.contentQuery.isError()));
readonly exporting = signal(false);
readonly importing = signal(false);
private loadSidecarContent(bookId: number): void {
this.sidecarService.getSidecarContent(bookId).pipe(
takeUntil(this.destroy$)
).subscribe({
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);
}
}
});
retryRead(): void {
const bookId = this.currentBookId();
if (bookId !== null) {
void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
}
}
exportToSidecar(): void {
if (!this.currentBookId) return;
const bookId = this.currentBookId();
if (!bookId) return;
this.exporting.set(true);
this.sidecarService.exportToSidecar(this.currentBookId).pipe(
this.sidecarService.exportToSidecar(bookId).pipe(
takeUntil(this.destroy$)
).subscribe({
next: () => {
@@ -103,7 +111,7 @@ export class SidecarViewerComponent implements OnDestroy {
summary: this.t.translate('metadata.sidecar.toast.exportSuccessSummary'),
detail: this.t.translate('metadata.sidecar.toast.exportSuccessDetail')
});
this.loadSidecarData(this.currentBookId!);
void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
this.exporting.set(false);
},
error: (err) => {
@@ -119,10 +127,11 @@ export class SidecarViewerComponent implements OnDestroy {
}
importFromSidecar(): void {
if (!this.currentBookId) return;
const bookId = this.currentBookId();
if (!bookId) return;
this.importing.set(true);
this.sidecarService.importFromSidecar(this.currentBookId).pipe(
this.sidecarService.importFromSidecar(bookId).pipe(
takeUntil(this.destroy$)
).subscribe({
next: () => {
@@ -131,7 +140,7 @@ export class SidecarViewerComponent implements OnDestroy {
summary: this.t.translate('metadata.sidecar.toast.importSuccessSummary'),
detail: this.t.translate('metadata.sidecar.toast.importSuccessDetail')
});
this.loadSidecarData(this.currentBookId!);
void this.queryClient.invalidateQueries({queryKey: metadataSourceKeys.sidecar(bookId)});
this.importing.set(false);
},
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 {
this.destroy$.next();
this.destroy$.complete();
@@ -96,21 +96,27 @@
<p-progressSpinner strokeWidth="3" animationDuration="1s"></p-progressSpinner>
<p>{{ t('searchingForCovers') }}</p>
</div>
} @else if (coverImages.length === 0) {
} @else if (coverImages().length === 0 || failed()) {
<!-- No Results State -->
<div class="empty-state no-results">
<div class="empty-state-icon warning">
<i class="pi pi-search"></i>
</div>
<h3>{{ t('noCoversFound') }}</h3>
<p>{{ t('noCoversFoundDescription') }}</p>
@if (failed()) {
<h3>{{ t('searchFailed') }}</h3>
} @else {
<h3>{{ t('noCoversFound') }}</h3>
<p>{{ t('noCoversFoundDescription') }}</p>
}
</div>
} @else {
}
@if (!loading() && coverImages().length > 0) {
<!-- Results Grid -->
<div class="results-header">
<span class="results-count">
<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 class="results-hint">
<i class="pi pi-info-circle"></i>
@@ -119,7 +125,7 @@
</div>
<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-image-wrapper">
<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 {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from '@angular/forms';
import {BookCoverService, CoverFetchRequest, CoverImage} from '../../../../shared/services/book-cover.service';
import {finalize} from 'rxjs/operators';
import {FormBuilder, ReactiveFormsModule, Validators} from '@angular/forms';
import {injectQuery, QueryClient} from '@tanstack/angular-query-experimental';
import {Button} from '@openng/optimus-ui/button';
import {InputText} from '@openng/optimus-ui/inputtext';
import {ProgressSpinner} from '@openng/optimus-ui/progressspinner';
import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
import {BookService} from '../../../book/service/book.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 {Tooltip} from '@openng/optimus-ui/tooltip';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
const NO_SEARCH: CoverSearchParams = {bookId: 0, coverType: 'ebook'};
@Component({
selector: 'app-cover-search',
templateUrl: './cover-search.component.html',
imports: [
Button,
ReactiveFormsModule,
FormsModule,
InputText,
ProgressSpinner,
Image,
@@ -28,47 +29,41 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
],
styleUrls: ['./cover-search.component.scss']
})
export class CoverSearchComponent implements OnInit {
@Input() bookId!: number;
searchForm: FormGroup;
coverImages: CoverImage[] = [];
loading = signal(false);
hasSearched = signal(false);
coverType: 'ebook' | 'audiobook' = 'ebook';
private fb = inject(FormBuilder);
private bookCoverService = inject(BookCoverService);
private dynamicDialogConfig = inject(DynamicDialogConfig);
protected dynamicDialogRef = inject(DynamicDialogRef);
protected bookService = inject(BookService);
private bookMetadataManageService = inject(BookMetadataManageService);
private messageService = inject(MessageService);
export class CoverSearchComponent {
private readonly fb = inject(FormBuilder);
private readonly dynamicDialogConfig = inject(DynamicDialogConfig);
protected readonly dynamicDialogRef = inject(DynamicDialogRef);
private readonly bookService = inject(BookService);
private readonly bookMetadataManageService = inject(BookMetadataManageService);
private readonly sources = inject(MetadataSourceQueryService);
private readonly queryClient = inject(QueryClient);
private readonly messageService = inject(MessageService);
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() {
this.searchForm = this.fb.group({
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) {
if (this.book) {
this.searchForm.patchValue({
title: book.metadata?.title || '',
author: book.metadata?.authors && book.metadata?.authors.length > 0 ? book.metadata?.authors[0] : ''
title: this.book.metadata?.title || '',
author: this.book.metadata?.authors?.[0] ?? ''
});
if (this.searchForm.valid) {
@@ -78,36 +73,16 @@ export class CoverSearchComponent implements OnInit {
}
onSearch() {
if (this.searchForm.valid) {
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
};
if (!this.searchForm.valid) return;
this.bookCoverService.fetchBookCovers(request)
.pipe(finalize(() => {
this.loading.set(false);
this.hasSearched.set(true);
}))
.subscribe({
next: (image) => {
this.coverImages.push(image);
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
});
}
const params: CoverSearchParams = {
bookId: this.bookId,
title: this.searchForm.value.title,
author: this.searchForm.value.author,
coverType: this.coverType,
};
void this.queryClient.resetQueries({queryKey: this.sources.coverSearch(params).queryKey, exact: true});
this.search.set(params);
}
selectAndSave(image: CoverImage) {
@@ -138,7 +113,6 @@ export class CoverSearchComponent implements OnInit {
onClear() {
this.searchForm.reset();
this.coverImages = [];
this.hasSearched.set(false);
this.search.set(null);
}
}
@@ -34,29 +34,33 @@
<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">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP1"
<p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP1"
(ngModelChange)="setBulkProvider('p1', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP1')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP2"
<p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP2"
(ngModelChange)="setBulkProvider('p2', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP2')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP3"
<p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP3"
(ngModelChange)="setBulkProvider('p3', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP3')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<td class="metadata-table-cell">
<p-select [options]="providersWithClear" [(ngModel)]="bulkP4"
<p-select [options]="providerOptionsWithClear()" [(ngModel)]="bulkP4"
(ngModelChange)="setBulkProvider('p4', $event)"
optionLabel="label" optionValue="value"
[placeholder]="t('setAllP4')" appendTo="body"
class="select-full-width" size="small">
</p-select>
@@ -73,28 +77,36 @@
</td>
<td class="metadata-table-cell-sm field-label" style="max-width: 127px; width: 127px;">{{ formatLabel(field) }}</td>
<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]"
[placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<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]"
[placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<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]"
[placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small">
</p-select>
</td>
<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]"
[placeholder]="t('unset')" appendTo="body"
class="select-full-width" size="small">
@@ -109,7 +121,7 @@
<h3 class="section-title">{{ t('providerSpecificFields') }}</h3>
<p class="section-description">{{ t('providerSpecificDescription') }}</p>
<div class="fields-grid">
@for (field of providerSpecificFields; track field) {
@for (field of providerSpecificFields(); track field) {
<div class="field-card">
<p-checkbox [(ngModel)]="enabledFields[field]" [binary]="true"
[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 {beforeEach, describe, expect, it, vi} from 'vitest';
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 {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', () => {
const providers = signal(providersWhereEnabled(() => true));
const add = vi.fn();
const translate = vi.fn((key: string) => `translated:${key}`);
beforeEach(() => {
providers.set(providersWhereEnabled(() => true));
add.mockClear();
translate.mockClear();
TestBed.configureTestingModule({
providers: [
{provide: MetadataSourceQueryService, useValue: {
providers: providers.asReadonly(),
enabledProviders: computed(() => providers().filter(provider => provider.enabled)),
}},
{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', () => {
const component = createComponent();
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.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 {FormsModule} from '@angular/forms';
@@ -13,6 +14,10 @@ import {
import {Tooltip} from '@openng/optimus-ui/tooltip';
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({
selector: 'app-metadata-advanced-fetch-options',
templateUrl: './metadata-advanced-fetch-options.component.html',
@@ -22,72 +27,50 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
})
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>();
@Input() currentMetadataOptions!: MetadataRefreshOptions;
@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)[] = [
'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate',
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover', 'pageCount',
];
providers: string[] = [
'OpenLibrary',
'Amazon',
'Google',
'GoodReads',
'Hardcover',
'Comicvine',
'Douban',
'Lubimyczytac',
'Ranobedb',
'Audible',
'AppleBooks'
];
providersWithClear: string[] = [
'Clear All',
'OpenLibrary',
'Amazon',
'Google',
'GoodReads',
'Hardcover',
'Comicvine',
'Douban',
'Lubimyczytac',
'Ranobedb',
'Audible',
'AppleBooks'
];
readonly providerSpecificFields = computed<(keyof FieldOptions)[]>(() => [
...this.providerFields.fields().map(field => field.name),
'moods', 'tags',
]);
readonly fields = computed<(keyof FieldOptions)[]>(() => [...this.nonProviderSpecificFields, ...this.providerSpecificFields()]);
readonly providerOptions = computed(() => this.sources.enabledProviders().map(provider => ({
value: provider.id,
label: this.t.translate(provider.labelKey, {}, this.activeLang()),
})));
readonly providerOptionsWithClear = computed(() => [
{value: 'Clear All', label: 'Clear All'},
...this.providerOptions(),
]);
providerOptionsFor(selected: string | null) {
const enabled = this.providerOptions();
if (!selected || enabled.some(option => option.value === selected)) return enabled;
const provider = this.sources.providers().find(provider => provider.id === selected);
const label = provider ? this.t.translate(provider.labelKey, {}, this.activeLang()) : selected;
return [...enabled, {
value: selected,
label: this.t.translate('metadata.advancedFetchOptions.inactiveProvider', {provider: label}, this.activeLang()),
disabled: true,
}];
}
refreshCovers: boolean = false;
mergeCategories: boolean = false;
@@ -110,55 +93,17 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
bulkP3: string | null = null;
bulkP4: string | null = null;
private messageService = inject(MessageService);
private readonly t = inject(TranslocoService);
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 {
return this.fields.reduce((acc, field) => {
return this.fields().reduce((acc, field) => {
acc[field] = {p1: null, p2: null, p3: null, p4: null};
return acc;
}, {} as FieldOptions);
}
private initializeEnabledFields(): Record<keyof FieldOptions, boolean> {
return this.fields.reduce((acc, field) => {
return this.fields().reduce((acc, field) => {
acc[field] = true;
return acc;
}, {} as Record<keyof FieldOptions, boolean>);
@@ -172,7 +117,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
this.replaceMode = this.currentMetadataOptions.replaceMode || 'REPLACE_MISSING';
const backendFieldOptions = this.deepCloneFieldOptions(this.currentMetadataOptions.fieldOptions as FieldOptions || {});
for (const field of this.fields) {
for (const field of this.fields()) {
if (!backendFieldOptions[field]) {
backendFieldOptions[field] = {p1: null, p2: null, p3: null, p4: null};
} else {
@@ -191,7 +136,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
private deepCloneFieldOptions(fieldOptions: FieldOptions): FieldOptions {
const cloned = {} as FieldOptions;
for (const field of this.fields) {
for (const field of this.fields()) {
cloned[field] = {
p1: fieldOptions[field]?.p1 || 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;
const value = provider === 'Clear All' ? null : provider;
@@ -303,37 +248,19 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'pageCount': 'Page Count',
'rating': 'Rating',
'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)',
'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 {
return this.providerSpecificFieldsList.includes(field as string);
return this.providerSpecificFields().includes(field);
}
}
@@ -12,21 +12,21 @@
<div class="section-body">
<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="group-header">
<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 class="field-list">
@for (field of group.fields; track field) {
@for (field of group.fields; track field.name) {
<div class="field-item">
<p-toggleswitch
[inputId]="field"
[ngModel]="selectedFields.includes(field)"
(ngModelChange)="toggleField(field, $event)">
[inputId]="field.name"
[ngModel]="selectedFields.includes(field.name)"
(ngModelChange)="toggleField(field.name, $event)">
</p-toggleswitch>
<label [for]="field">{{ getFieldLabel(field) }}</label>
<label [for]="field.name">{{ field.label }}</label>
</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 component = fixture.componentInstance;
fixture.detectChanges();
expect(component.getProviderLabel('amazon')).toBe('Amazon');
expect(component.getFieldLabel('asin')).toBeDefined();
const amazon = component.providerGroups().find(group => group.label === 'Amazon');
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 {FormsModule} from '@angular/forms';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
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';
@Component({
@@ -17,40 +20,25 @@ export class MetadataProviderFieldSelectorComponent {
private appSettingsService = inject(AppSettingsService);
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[] }[] = [
{labelKey: 'openlibrary', fields: ['openlibraryId']},
{labelKey: 'amazon', fields: ['asin', 'amazonRating', 'amazonReviewCount']},
{labelKey: 'googleBooks', fields: ['googleId']},
{labelKey: 'goodreads', fields: ['goodreadsId', 'goodreadsRating', 'goodreadsReviewCount']},
{labelKey: 'hardcover', fields: ['hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount']},
{labelKey: 'audible', fields: ['audibleId', 'audibleRating', 'audibleReviewCount']},
{labelKey: 'applebooks', fields: ['applebooksId', 'applebooksRating', 'applebooksReviewCount']},
{labelKey: 'comicvine', fields: ['comicvineId']},
{labelKey: 'lubimyczytac', fields: ['lubimyczytacId', 'lubimyczytacRating']},
{labelKey: 'ranobedb', fields: ['ranobedbId', 'ranobedbRating']}
];
readonly providerGroups = computed(() => {
const lang = this.activeLang();
return this.catalog.providers()
.filter(provider => provider.book)
.map(provider => ({
label: this.t.translate(provider.labelKey, {}, lang),
fields: this.providerFields.fields()
.filter(field => field.provider === provider.id)
.map(field => ({name: field.name, label: this.providerFields.label(field.name)})),
}));
});
getProviderLabel(key: string): string {
return this.t.translate('settingsMeta.fieldSelector.providers.' + key);
}
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 allFieldNames = computed<(keyof MetadataProviderSpecificFields)[]>(
() => this.providerFields.fields().map(field => field.name),
);
private readonly syncSettingsEffect = effect(() => {
const settings = this.appSettingsService.appSettings();
@@ -81,10 +69,6 @@ export class MetadataProviderFieldSelectorComponent {
}
private toFieldState(selectedFields: string[]): MetadataProviderSpecificFields {
const fieldState = {} as MetadataProviderSpecificFields;
for (const field of this.allFieldNames) {
fieldState[field] = selectedFields.includes(field);
}
return fieldState;
return providerFieldRecord(this.providerFields.fields(), field => selectedFields.includes(field.name));
}
}
@@ -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 type {MetadataProviderId} from '../../../../shared/metadata/metadata-providers';
import {
FieldOptions,
@@ -7,7 +8,7 @@ import {
MetadataReplaceMode
} from './metadata-refresh-options.model';
const provider = (value: string | null): FieldProvider => ({
const provider = (value: MetadataProviderId | null): FieldProvider => ({
p4: value,
p3: value,
p2: value,
@@ -17,46 +18,46 @@ const provider = (value: string | null): FieldProvider => ({
describe('metadata-refresh-options.model', () => {
it('supports replace-mode driven refresh settings', () => {
const fieldOptions: FieldOptions = {
openlibraryId: provider('openlibrary'),
title: provider('google'),
description: provider('google'),
authors: provider('google'),
categories: provider('google'),
cover: provider('google'),
subtitle: provider('google'),
publisher: provider('google'),
publishedDate: provider('google'),
seriesName: provider('google'),
seriesNumber: provider('google'),
seriesTotal: provider('google'),
isbn13: provider('google'),
isbn10: provider('google'),
language: provider('google'),
pageCount: provider('google'),
asin: provider('google'),
goodreadsId: provider('goodreads'),
openlibraryId: provider('OpenLibrary'),
title: provider('Google'),
description: provider('Google'),
authors: provider('Google'),
categories: provider('Google'),
cover: provider('Google'),
subtitle: provider('Google'),
publisher: provider('Google'),
publishedDate: provider('Google'),
seriesName: provider('Google'),
seriesNumber: provider('Google'),
seriesTotal: provider('Google'),
isbn13: provider('Google'),
isbn10: provider('Google'),
language: provider('Google'),
pageCount: provider('Google'),
asin: provider('Google'),
goodreadsId: provider('GoodReads'),
comicvineId: provider(null),
hardcoverId: provider('hardcover'),
hardcoverBookId: provider('hardcover'),
googleId: provider('google'),
hardcoverId: provider('Hardcover'),
hardcoverBookId: provider('Hardcover'),
googleId: provider('Google'),
lubimyczytacId: provider(null),
amazonRating: provider('amazon'),
amazonReviewCount: provider('amazon'),
goodreadsRating: provider('goodreads'),
goodreadsReviewCount: provider('goodreads'),
hardcoverRating: provider('hardcover'),
hardcoverReviewCount: provider('hardcover'),
amazonRating: provider('Amazon'),
amazonReviewCount: provider('Amazon'),
goodreadsRating: provider('GoodReads'),
goodreadsReviewCount: provider('GoodReads'),
hardcoverRating: provider('Hardcover'),
hardcoverReviewCount: provider('Hardcover'),
lubimyczytacRating: provider(null),
ranobedbId: provider(null),
ranobedbRating: provider(null),
audibleId: provider('audible'),
audibleRating: provider('audible'),
audibleReviewCount: provider('audible'),
applebooksId: provider('applebooks'),
applebooksRating: provider('applebooks'),
applebooksReviewCount: provider('applebooks'),
moods: provider('google'),
tags: provider('google')
audibleId: provider('Audible'),
audibleRating: provider('Audible'),
audibleReviewCount: provider('Audible'),
applebooksId: provider('AppleBooks'),
applebooksRating: provider('AppleBooks'),
applebooksReviewCount: provider('AppleBooks'),
moods: provider('Google'),
tags: provider('Google')
};
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);
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 interface MetadataRefreshOptions {
@@ -22,7 +24,7 @@ export interface FieldProvider {
p1: string | null;
}
export interface FieldOptions {
interface GenericFieldOptions {
title: FieldProvider;
description: FieldProvider;
authors: FieldProvider;
@@ -38,29 +40,8 @@ export interface FieldOptions {
isbn10: FieldProvider;
language: 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;
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();
});
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', () => {
service.exportToSidecar(42).subscribe(response => {
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 {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({
providedIn: 'root'
})
@@ -87,14 +15,6 @@ export class SidecarService {
private queryClient = inject(QueryClient);
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}> {
return this.http.post<{message: string}>(`${this.apiUrl}/books/${bookId}/sidecar/export`, {});
}
@@ -116,29 +116,17 @@
</div>
}
@if (metadata?.rating || metadata?.goodreadsRating || metadata?.amazonRating) {
@if (providerRatings.length > 0) {
<div class="metadata-group">
<h3 class="section-title">{{ t('ratings') }}</h3>
@if (metadata?.goodreadsRating) {
@for (entry of providerRatings; track entry.labelKey) {
<div class="metadata-item">
<span class="label">Goodreads</span>
<span class="label">{{ entry.labelKey | transloco }}</span>
<span class="value">
&#11088; {{ metadata?.goodreadsRating?.toFixed(2) }}
@if (metadata?.goodreadsReviewCount) {
<span class="review-count">({{ metadata?.goodreadsReviewCount }} {{ 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>
&#11088; {{ entry.rating.toFixed(2) }}
@if (entry.reviewCount) {
<span class="review-count">({{ entry.reviewCount }} {{ t('reviews') }})</span>
}
</span>
</div>
@@ -17,7 +17,9 @@ describe('ReaderBookMetadataDialogComponent', () => {
await TestBed.configureTestingModule({
imports: [ReaderBookMetadataDialogComponent, getTranslocoModule()],
providers: [{provide: UrlHelperService, useValue: urlHelperService}],
providers: [
{provide: UrlHelperService, useValue: urlHelperService},
],
}).compileComponents();
fixture = TestBed.createComponent(ReaderBookMetadataDialogComponent);
@@ -57,4 +59,5 @@ describe('ReaderBookMetadataDialogComponent', () => {
it('returns the raw date when parsing falls back after an invalid date string', () => {
expect(component.formatDate('not-a-date')).toBe('Invalid Date');
});
});
@@ -1,14 +1,15 @@
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 {UrlHelperService} from '../../../../shared/service/url-helper.service';
import {LanguageResolverService} from '../../../../shared/service/language-resolver.service';
import {CoverComponent} from '../../../../shared/components/cover/cover.component';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
@Component({
selector: 'app-reader-book-metadata-dialog',
standalone: true,
imports: [TranslocoDirective, CoverComponent],
imports: [TranslocoDirective, TranslocoPipe, CoverComponent],
templateUrl: './metadata-dialog.component.html',
styleUrls: ['./metadata-dialog.component.scss']
})
@@ -18,12 +19,23 @@ export class ReaderBookMetadataDialogComponent {
private urlHelperService = inject(UrlHelperService);
private readonly t = inject(TranslocoService);
protected readonly catalog = inject(MetadataCatalogService);
protected readonly languageResolver = inject(LanguageResolverService);
get 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 {
if (!this.book?.id) return null;
const coverUpdatedOn = this.book.metadata?.coverUpdatedOn;
@@ -36,7 +36,7 @@
<form [formGroup]="form" class="weights-form">
<div class="weights-grid">
@for (key of orderedKeys; track key) {
@for (key of orderedKeys(); track key) {
<div class="weight-field">
<label class="field-label" [for]="'metadata-weight-' + key">{{ getFieldLabel(key) }}</label>
<p-inputNumber
@@ -56,7 +56,7 @@ describe('MetadataMatchWeightsComponent', () => {
expect(component.form.get('title')?.value).toBe(10);
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', () => {
@@ -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 {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
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 {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {InputNumber} from '@openng/optimus-ui/inputnumber';
import {MetadataProviderFieldsService} from '../../../../shared/metadata';
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({
selector: 'app-metadata-match-weights-component',
imports: [
@@ -22,26 +31,24 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
})
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);
form: FormGroup = this.buildForm();
isSaving = false;
isRecalculating = false;
private weightsService = inject(MetadataMatchWeightsService);
private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService);
private t = inject(TranslocoService);
private providerFields = inject(MetadataProviderFieldsService);
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(() => {
const settings = this.appSettingsService.appSettings();
if (settings?.metadataMatchWeights) {
@@ -50,42 +57,14 @@ export class MetadataMatchWeightsComponent {
});
private buildForm(): FormGroup {
return this.fb.group({
title: [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;
return this.fb.group(Object.fromEntries(
this.orderedKeys().map(key => [key, [0, [Validators.required, Validators.min(0)]]]),
));
}
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 {
@@ -16,177 +16,145 @@
<h4 class="provider-group-title">{{ t('configurableTitle') }}</h4>
<div class="configurable-providers-list">
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="amazonEnabled"></p-toggleswitch>
<span class="setting-label">Amazon</span>
</div>
@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>
@for (provider of configurableProviders(); track provider.id) {
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="enabled[provider.id]" [disabled]="isToggleDisabled(provider.id)"></p-toggleswitch>
<span class="setting-label">{{ provider.labelKey | transloco }}</span>
</div>
}
</div>
<div class="setting-item">
<div class="setting-header">
<p-toggleswitch
[(ngModel)]="googleEnabled"
[disabled]="!googleApiKeyConfigured">
</p-toggleswitch>
<span class="setting-label">Google Books</span>
</div>
<div class="setting-options">
@if (googleEnabled) {
<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>
@switch (provider.id) {
@case ('Amazon') {
@if (enabled.Amazon) {
<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>
}
}
@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 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>
@@ -194,33 +162,14 @@
<h4 class="provider-group-title">{{ t('readyToUseTitle') }}</h4>
<div class="simple-providers-grid">
<div class="setting-item simple-provider">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="openLibraryEnabled"></p-toggleswitch>
<span class="setting-label">OpenLibrary</span>
@for (provider of simpleProviders(); track provider.id) {
<div class="setting-item simple-provider">
<div class="setting-header">
<p-toggleswitch [(ngModel)]="enabled[provider.id]"></p-toggleswitch>
<span class="setting-label">{{ provider.labelKey | transloco }}</span>
</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>
@@ -8,6 +8,9 @@ import {MessageService} from '@openng/optimus-ui/api';
import {getTranslocoModule} from '../../../../core/testing/transloco-testing';
import {type AppSettings, AppSettingKey} from '../../../../shared/model/app-settings.model';
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';
describe('MetadataProviderSettingsComponent', () => {
@@ -15,14 +18,21 @@ describe('MetadataProviderSettingsComponent', () => {
let component: MetadataProviderSettingsComponent;
let appSettingsSignal: WritableSignal<AppSettings | null>;
let saveSettings: ReturnType<typeof vi.fn>;
let refreshProviders: ReturnType<typeof vi.fn>;
beforeEach(async () => {
appSettingsSignal = signal<AppSettings | null>(null);
saveSettings = vi.fn(() => of(void 0));
refreshProviders = vi.fn(() => Promise.resolve());
await TestBed.configureTestingModule({
imports: [MetadataProviderSettingsComponent, getTranslocoModule()],
providers: [
{provide: MetadataCatalogService, useValue: {providers: () => METADATA_PROVIDER_LIST}},
{
provide: MetadataSourceQueryService,
useValue: {refreshProviders},
},
{
provide: AppSettingsService,
useValue: {
@@ -43,24 +53,8 @@ describe('MetadataProviderSettingsComponent', () => {
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', () => {
component.googleEnabled = true;
component.enabled.Google = true;
component.googleApiKey = ' configured-key ';
component.saveSettings();
@@ -73,10 +67,12 @@ describe('MetadataProviderSettingsComponent', () => {
});
});
it('does not persist Google Books as enabled without an API key', () => {
component.googleEnabled = true;
component.googleApiKey = '';
it('switches a provider off when its required key is cleared', () => {
component.googleApiKey = 'configured-key';
component.enabled.Google = true;
component.googleApiKey = '';
component.onKeyChange('Google', '');
component.saveSettings();
expect(getSavedProviderSettings().google.enabled).toBe(false);
@@ -92,14 +88,3 @@ describe('MetadataProviderSettingsComponent', () => {
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 {FormsModule, ReactiveFormsModule} from '@angular/forms';
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 {AppSettingsService} from '../../../../shared/service/app-settings.service';
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 {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component';
import { ToggleSwitch } from '@openng/optimus-ui/toggleswitch';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
@Component({
selector: 'app-metadata-provider-settings',
@@ -23,12 +26,18 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
Select,
ExternalDocLinkComponent,
ToggleSwitch,
TranslocoDirective
TranslocoDirective,
TranslocoPipe
],
templateUrl: './metadata-provider-settings.component.html',
styleUrl: './metadata-provider-settings.component.scss'
})
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 = [
{label: 'amazon.com', value: 'com'},
@@ -97,23 +106,12 @@ export class MetadataProviderSettingsComponent {
selectedAppleBooksCountry = 'US';
selectedAudibleDomain = 'com';
audibleEnabled: boolean = false;
hardcoverToken: string = '';
amazonCookie: string = '';
hardcoverEnabled: boolean = false;
amazonEnabled: boolean = false;
openLibraryEnabled: boolean = false;
goodreadsEnabled: boolean = false;
googleEnabled: boolean = false;
comicvineEnabled: boolean = false;
comicvineToken: string = '';
doubanEnabled: boolean = false;
lubimyCzytacEnabled: boolean = false;
ranobedbEnabled: boolean = false;
ranobedbPreferRomaji: boolean = false;
googleApiKey: string = '';
appleBooksEnabled: boolean = false;
private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService);
@@ -129,97 +127,70 @@ export class MetadataProviderSettingsComponent {
private applySettings(settings: NonNullable<ReturnType<typeof this.appSettingsService.appSettings>>): void {
const metadataProviderSettings = settings.metadataProviderSettings;
this.openLibraryEnabled = metadataProviderSettings?.openLibrary?.enabled ?? false;
this.amazonEnabled = metadataProviderSettings?.amazon?.enabled ?? false;
this.amazonCookie = metadataProviderSettings?.amazon?.cookie ?? "";
this.selectedAmazonDomain = metadataProviderSettings?.amazon?.domain ?? 'com';
this.goodreadsEnabled = metadataProviderSettings?.goodReads?.enabled ?? false;
this.selectedGoogleLanguage = metadataProviderSettings?.google?.language ?? '';
this.googleApiKey = metadataProviderSettings?.google?.apiKey ?? '';
this.googleEnabled = (metadataProviderSettings?.google?.enabled ?? false) && this.googleApiKeyConfigured;
this.hardcoverToken = metadataProviderSettings?.hardcover?.apiKey ?? '';
this.hardcoverEnabled = metadataProviderSettings?.hardcover?.enabled ?? false;
this.comicvineEnabled = metadataProviderSettings?.comicvine?.enabled ?? false;
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.audibleEnabled = metadataProviderSettings?.audible?.enabled ?? false;
this.selectedAudibleDomain = metadataProviderSettings?.audible?.domain ?? 'com';
this.appleBooksEnabled = metadataProviderSettings?.appleBooks?.enabled ?? false;
this.selectedAppleBooksCountry = metadataProviderSettings?.appleBooks?.country ?? 'US';
}
onTokenChange(newToken: string): void {
this.hardcoverToken = newToken;
if (!newToken.trim()) {
this.hardcoverEnabled = false;
for (const provider of this.catalog.providers()) {
this.enabled[provider.id] = !!metadataProviderSettings?.[provider.settingsKey]?.enabled && !this.isToggleDisabled(provider.id);
}
}
onComicTokenChange(newToken: string): void {
this.comicvineToken = newToken;
private readonly requiredKey: Partial<Record<MetadataProviderId, () => string>> = {
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 {
return this.googleApiKey.trim().length > 0;
onKeyChange(id: MetadataProviderId, key: string): void {
if (!key.trim()) {
this.enabled[id] = false;
}
}
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 = [
{
key: AppSettingKey.METADATA_PROVIDER_SETTINGS,
newValue: {
openLibrary: {
enabled: this.openLibraryEnabled,
},
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,
},
}
newValue: Object.fromEntries(this.catalog.providers().map(provider => [
provider.settingsKey,
{enabled: this.enabled[provider.id] ?? false, ...options[provider.id]},
])),
}
];
this.appSettingsService.saveSettings(payload).pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe({
next: () =>
next: () => {
void this.sourceQuery.refreshProviders();
this.messageService.add({
severity: 'success',
summary: this.t.translate('common.success'),
detail: this.t.translate('settingsMeta.providers.saveSuccess')
}),
});
},
error: () =>
this.messageService.add({
severity: 'error',
@@ -10,6 +10,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {Library} from '../../book/model/library.model';
import {LibraryService} from '../../book/service/library.service';
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 {AppSettingsService} from '../../../shared/service/app-settings.service';
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
@@ -30,6 +31,7 @@ export class LibraryMetadataSettingsComponent {
private sidecarService = inject(SidecarService);
private t = inject(TranslocoService);
private destroyRef = inject(DestroyRef);
private providerFields = inject(MetadataProviderFieldsService);
defaultMetadataOptions: MetadataRefreshOptions = this.getDefaultMetadataOptions();
libraryMetadataOptions: Record<number, MetadataRefreshOptions> = {};
@@ -221,31 +223,9 @@ export class LibraryMetadataSettingsComponent {
categories: {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},
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},
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"
(onChange)="onProviderToggle(provider.controls.provider.value, $event.checked)">
</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>
@if (provider.controls.enabled.value) {
<div class="max-reviews-control">
@@ -37,7 +37,7 @@ describe('PublicReviewsSettingsComponent', () => {
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({
metadataPublicReviewsSettings: {
downloadEnabled: false,
@@ -52,10 +52,12 @@ describe('PublicReviewsSettingsComponent', () => {
expect(component.publicReviewSettings.providers).toEqual(
expect.arrayContaining([
expect.objectContaining({provider: 'Amazon', enabled: true, maxReviews: 7}),
expect.objectContaining({provider: 'GoodReads', enabled: false, maxReviews: 10}),
expect.objectContaining({provider: 'Douban', enabled: false, maxReviews: 10}),
expect.objectContaining({provider: 'GoodReads', enabled: false, maxReviews: 5}),
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 () => {
@@ -4,15 +4,8 @@ import {ToggleSwitch} from "@openng/optimus-ui/toggleswitch";
import {AppSettingKey, AppSettings, PublicReviewSettings, ReviewProviderConfig} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {SettingsHelperService} from '../../../../shared/service/settings-helper.service';
import {TranslocoDirective} from '@jsverse/transloco';
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;
import {TranslocoDirective, TranslocoPipe} from '@jsverse/transloco';
import {MetadataCatalogService} from '../../../../shared/metadata/metadata-catalog.service';
type ReviewProviderFormGroup = FormGroup<{
provider: FormControl<string>;
@@ -22,7 +15,7 @@ type ReviewProviderFormGroup = FormGroup<{
@Component({
selector: 'app-public-reviews-settings-component',
imports: [ReactiveFormsModule, ToggleSwitch, TranslocoDirective],
imports: [ReactiveFormsModule, ToggleSwitch, TranslocoDirective, TranslocoPipe],
templateUrl: './public-reviews-settings-component.html',
styleUrl: './public-reviews-settings-component.scss'
})
@@ -31,6 +24,7 @@ export class PublicReviewsSettingsComponent {
private readonly fb = inject(FormBuilder);
private readonly appSettingsService = inject(AppSettingsService);
private readonly settingsHelper = inject(SettingsHelperService);
protected readonly catalog = inject(MetadataCatalogService);
readonly form = this.fb.nonNullable.group({
downloadEnabled: [{value: true, disabled: true}],
@@ -117,24 +111,20 @@ export class PublicReviewsSettingsComponent {
}
private buildReviewSettings(settings: AppSettings): PublicReviewSettings {
const baseSettings = settings.metadataPublicReviewsSettings
? {
...settings.metadataPublicReviewsSettings,
providers: settings.metadataPublicReviewsSettings.providers.map(provider => ({...provider}))
}
: {
downloadEnabled: true,
autoDownloadEnabled: false,
providers: DEFAULT_PROVIDERS.map(provider => ({...provider}))
};
const saved = settings.metadataPublicReviewsSettings;
const baseSettings = {
downloadEnabled: saved.downloadEnabled,
autoDownloadEnabled: saved.autoDownloadEnabled,
providers: saved.providers.map(provider => ({...provider})),
};
REQUIRED_PROVIDERS.forEach(providerName => {
const exists = baseSettings.providers.some(provider => provider.provider === providerName);
this.catalog.reviewProviders().forEach(provider => {
const exists = baseSettings.providers.some(config => config.provider === provider.id);
if (!exists) {
baseSettings.providers.push({
provider: providerName,
provider: provider.id,
enabled: false,
maxReviews: 10
maxReviews: 5
});
}
});
@@ -2,6 +2,8 @@ import {describe, expect, it} from 'vitest';
import {hasMetadataWriter, isFieldEmbeddable} from './embeddable-fields.config';
const NO_PROVIDER_FIELDS: ReadonlySet<string> = new Set();
describe('embeddable-fields.config', () => {
it('reports writer support only for embeddable book types', () => {
expect(hasMetadataWriter('EPUB')).toBe(true);
@@ -13,10 +15,19 @@ describe('embeddable-fields.config', () => {
});
it('checks embeddable field membership by book type', () => {
expect(isFieldEmbeddable('EPUB', 'title')).toBe(true);
expect(isFieldEmbeddable('EPUB', 'narrator')).toBe(false);
expect(isFieldEmbeddable('AUDIOBOOK', 'narrator')).toBe(true);
expect(isFieldEmbeddable('CBX', 'comicIssueNumber')).toBe(true);
expect(isFieldEmbeddable(undefined, 'title')).toBe(false);
expect(isFieldEmbeddable('EPUB', 'title', NO_PROVIDER_FIELDS)).toBe(true);
expect(isFieldEmbeddable('EPUB', 'narrator', NO_PROVIDER_FIELDS)).toBe(false);
expect(isFieldEmbeddable('AUDIOBOOK', 'narrator', NO_PROVIDER_FIELDS)).toBe(true);
expect(isFieldEmbeddable('CBX', 'comicIssueNumber', NO_PROVIDER_FIELDS)).toBe(true);
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',
'categories', 'description', 'seriesName', 'seriesNumber', 'seriesTotal',
'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([
@@ -33,9 +26,12 @@ const EMBEDDABLE_FIELDS: Partial<Record<BookType, ReadonlySet<string>>> = {
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;
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 {
@@ -1,4 +1,6 @@
export * from './metadata-field.config';
export * from './metadata-provider-fields';
export * from './metadata-provider-fields.service';
export * from './metadata-utils.service';
export * from './metadata-form.builder';
export * from './embeddable-fields.config';
@@ -2,8 +2,9 @@ import {describe, expect, it} from 'vitest';
import {
ALL_COMIC_METADATA_FIELDS,
ALL_METADATA_FIELDS,
allMetadataFields,
COMIC_FORM_TO_MODEL_LOCK,
GENERIC_METADATA_FIELDS,
getArrayFields,
getBookDetailsFields,
getBottomFields,
@@ -12,6 +13,10 @@ import {
getTextareaFields,
getTopFields
} 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', () => {
it('exposes stable grouped field selectors', () => {
@@ -66,13 +71,13 @@ describe('metadata-field.config', () => {
applebooksReviewCount: false,
};
expect(getProviderFields(enabledFields).map((field) => field.controlName)).toEqual(['googleId']);
expect(getBottomFields(enabledFields).some((field) => field.controlName === 'googleId')).toBe(true);
expect(getProviderFields(allFields, enabledFields).map((field) => field.controlName)).toEqual(['googleId']);
expect(getBottomFields(allFields, enabledFields).some((field) => field.controlName === 'googleId')).toBe(true);
});
it('keeps comic metadata fields and lock mappings aligned', () => {
expect(ALL_COMIC_METADATA_FIELDS.length).toBeGreaterThan(0);
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 type { MetadataProviderField } from './metadata-provider-fields';
export type FieldType = 'string' | 'number' | 'array' | 'textarea' | 'boolean';
export interface MetadataFieldConfig {
label: string;
label?: string;
controlName: string;
lockedKey: string;
fetchedKey: string;
@@ -11,7 +12,7 @@ export interface MetadataFieldConfig {
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: 'Subtitle', controlName: 'subtitle', lockedKey: 'subtitleLocked', fetchedKey: 'subtitle', 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-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13', type: 'string' },
{ 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
export const AUDIOBOOK_METADATA_FIELDS: MetadataFieldConfig[] = [
{ 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 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[] {
return ALL_METADATA_FIELDS.filter(f => f.type === 'array');
return GENERIC_METADATA_FIELDS.filter(f => f.type === 'array');
}
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[] {
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[] {
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[] {
const providerFields = ALL_METADATA_FIELDS.filter(f => !!f.providerKey);
export function getProviderFields(fields: MetadataFieldConfig[], enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] {
const providerFields = fields.filter(f => !!f.providerKey);
if (enabledProviderFields) {
return providerFields.filter(field =>
@@ -163,8 +154,8 @@ export function getProviderFields(enabledProviderFields?: MetadataProviderSpecif
return providerFields;
}
export function getBottomFields(enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] {
const bottomFields = ALL_METADATA_FIELDS.filter(f =>
export function getBottomFields(fields: MetadataFieldConfig[], enabledProviderFields?: MetadataProviderSpecificFields | null): MetadataFieldConfig[] {
const bottomFields = fields.filter(f =>
!TOP_FIELD_NAMES.includes(f.controlName) &&
!ARRAY_FIELD_NAMES.includes(f.controlName) &&
!TEXTAREA_FIELD_NAMES.includes(f.controlName)
@@ -56,7 +56,10 @@ describe('MetadataFormBuilder', () => {
titleLocked: true,
narratorLocked: true,
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('authors')?.enabled).toBe(true);
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
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({
providedIn: 'root'
@@ -8,8 +8,8 @@ import {ALL_COMIC_METADATA_FIELDS, ALL_METADATA_FIELDS, AUDIOBOOK_METADATA_FIELD
export class MetadataFormBuilder {
buildForm(
includeLockedControls: boolean = true,
fields: MetadataFieldConfig[] = ALL_METADATA_FIELDS
includeLockedControls: boolean,
fields: MetadataFieldConfig[]
): FormGroup {
const controls: Record<string, FormControl> = {};
@@ -66,7 +66,7 @@ export class MetadataFormBuilder {
applyLockStates(
metadataForm: FormGroup,
lockedFields: Record<string, boolean>,
fields: MetadataFieldConfig[] = ALL_METADATA_FIELDS
fields: MetadataFieldConfig[]
): void {
for (const key of Object.keys(metadataForm.controls)) {
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,
audibleRating: 1,
audibleReviewCount: 1,
applebooksRating: 1,
applebooksReviewCount: 1,
coverImage: 6
};
@@ -1,6 +1,8 @@
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;
subtitle: number;
description: number;
@@ -15,21 +17,13 @@ export interface MetadataMatchWeights {
language: number;
pageCount: number;
categories: number;
amazonRating: number;
amazonReviewCount: number;
goodreadsRating: number;
goodreadsReviewCount: number;
hardcoverRating: number;
hardcoverReviewCount: number;
doubanRating: number;
doubanReviewCount: number;
lubimyczytacRating: number;
ranobedbRating: number;
audibleRating: number;
audibleReviewCount: number;
coverImage: number;
}
export type MetadataMatchWeights = GenericMatchWeights & Record<MetadataProviderScoreFieldName, number>;
export interface OidcProviderDetails {
providerName: string;
clientId: string;
@@ -213,31 +207,7 @@ export interface AppSettings {
diskType: string;
}
export interface MetadataProviderSpecificFields {
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 type MetadataProviderSpecificFields = MetadataProviderFieldRecord<boolean>;
export enum AppSettingKey {
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": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"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",
"doubanReviewCount": "Douban Bewertung #",
"ranobedbRating": "Ranobedb Bewertung"
"doubanReviewCount": "Douban Bewertung #"
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Hörbuch-Details",
"comicBookDetails": "Comic-Details",
"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",
"previousBookBtn": "Vorheriges Buch",
"nextBookBtn": "Nächstes Buch",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Vollständige Metadaten werden geladen...",
"columnCurrent": "Aktuell",
"columnFetched": "Abgerufen",
"copyMissingTooltip": "Fehlende Felder kopieren",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Geben Sie oben Ihre Suchkriterien ein und klicken Sie auf Suchen, um Metadaten zu finden",
"noResultsFound": "Keine Ergebnisse gefunden",
"noResultsHint": "Passen Sie Ihre Suchkriterien an oder wählen Sie andere Anbieter",
"unknownProvider": "",
"selectOverlay": "Auswählen"
},
"tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Dateigröße (Kb)",
"fileType": "Dateityp",
"subtitle": "Untertitel",
"amazonRating": "Amazon-Bewertung",
"amazonReviewCount": "Amazon-Rezensionen",
"goodreadsRating": "Goodreads-Bewertung",
"goodreadsReviewCount": "Goodreads-Rezensionen",
"hardcoverRating": "Hardcover-Bewertung",
"hardcoverReviewCount": "Hardcover-Rezensionen",
"ranobedbRating": "Ranobedb-Bewertung",
"genre": "",
"addedOn": "Hinzugefügt am",
"lubimyczytacRating": "Lubimyczytac-Bewertung",
"description": "Beschreibung",
"narrator": "Sprecher",
"ageRating": "Altersfreigabe",
"contentRating": "Inhaltsbewertung",
"audibleRating": "Audible-Bewertung",
"audibleReviewCount": "Audible-Rezensionen",
"abridged": "Gekürzt",
"audiobookDuration": "Hörbuchdauer (s)",
"audiobookCodec": "",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Seriengesamt",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Altersfreigabe",
"contentRating": "Inhaltsbewertung",
"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",
"abridged": "Gekürzt",
"audiobookDuration": "Dauer",
+17 -111
View File
@@ -712,7 +712,7 @@
},
"publicReviews": {
"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",
"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.",
@@ -751,62 +751,13 @@
"isbn13": "ISBN-13",
"isbn10": "ISBN-10",
"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",
"doubanReviewCount": "Douban Rating #",
"ranobedbRating": "Ranobedb Rating"
"doubanReviewCount": "Douban Rating #"
}
},
"fieldSelector": {
"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.",
"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"
}
"sectionDesc": "Select which metadata fields to display when editing book information or picking metadata from providers. Disabled fields will be hidden from the interface."
}
},
"settingsLibMeta": {
@@ -2260,29 +2211,6 @@
"audiobookDetails": "Audiobook Details",
"comicBookDetails": "Comic Book Details",
"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",
"previousBookBtn": "Previous Book",
"nextBookBtn": "Next Book",
@@ -2343,7 +2271,6 @@
}
},
"picker": {
"loadingMetadata": "Loading complete metadata...",
"columnCurrent": "Current",
"columnFetched": "Fetched",
"copyMissingTooltip": "Copy missing fields",
@@ -2404,9 +2331,10 @@
"fetching": "Fetching...",
"readyToSearch": "Ready to Search",
"readyToSearchHint": "Enter your search criteria above and click Search to find metadata",
"noProviders": "No metadata providers are available",
"noResultsFound": "No Results Found",
"noResultsHint": "Try adjusting your search criteria or selecting different providers",
"unknownProvider": "Unknown Provider",
"searchFailed": "Search failed",
"selectOverlay": "Select"
},
"tabs": {
@@ -2519,6 +2447,8 @@
"goToPreviousBook": "Go to Previous Book",
"goToNextBook": "Go to Next Book",
"personalRating": "Personal Rating",
"ratingTooltip": "★ {{rating}} | {{reviews}} reviews",
"ratingTooltipNoReviews": "★ {{rating}}",
"loadingBookDetails": "Loading book details...",
"readStatusUnread": "Unread",
"readStatusPaused": "Paused",
@@ -2624,6 +2554,7 @@
"byLabel": "By:",
"coverFileLabel": "Cover file:",
"loading": "Loading sidecar data...",
"readFailed": "Could not load sidecar metadata. Please try again.",
"syncStatusInSync": "In Sync",
"syncStatusOutdated": "Outdated",
"syncStatusConflict": "Conflict",
@@ -2657,6 +2588,7 @@
"searchingForCovers": "Searching for covers...",
"noCoversFound": "No Covers Found",
"noCoversFoundDescription": "Try adjusting your search terms or check the spelling.",
"searchFailed": "Search failed",
"coversFoundSingular": "{{ count }} cover found",
"coversFoundPlural": "{{ count }} covers found",
"resultsHint": "Click on an image to preview, or select to apply",
@@ -2801,7 +2733,8 @@
"toast": {
"providerRequiredSummary": "Error",
"providerRequiredDetail": "At least one provider (P1-P4) must be selected for each enabled book field."
}
},
"inactiveProvider": "{{provider}} (disabled)"
},
"fetchOptions": {
"startRefresh": "Start Refresh"
@@ -2820,6 +2753,9 @@
"appleBooks": "Apple Books"
},
"providerFields": {
"id": "{{ provider }} ID",
"rating": "{{ provider }} Rating",
"reviewCount": "{{ provider }} Review Count",
"asin": "Amazon ASIN",
"hardcoverBookId": "Hardcover Book ID"
}
@@ -3347,7 +3283,9 @@
"validationReady": "Ready to create",
"cancelButton": "Cancel",
"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": {
"title": "Import ISBNs",
@@ -5145,22 +5083,12 @@
"fileSize": "File Size (Kb)",
"fileType": "File Type",
"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",
"addedOn": "Date Added",
"lubimyczytacRating": "LubimyCzytac Rating",
"description": "Description",
"narrator": "Narrator",
"ageRating": "Age Rating",
"contentRating": "Content Rating",
"audibleRating": "Audible Rating",
"audibleReviewCount": "Audible Review Count",
"abridged": "Abridged",
"audiobookDuration": "Audiobook Duration (s)",
"audiobookCodec": "Codec",
@@ -5290,31 +5218,9 @@
"seriesTotal": "Series Total",
"isbn13": "ISBN-13",
"isbn10": "ISBN-10",
"asin": "ASIN",
"ageRating": "Age Rating",
"contentRating": "Content 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",
"abridged": "Abridged",
"audiobookDuration": "Duration",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"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",
"doubanReviewCount": "Valoración de Douban #",
"ranobedbRating": "Valoración de Ranobedb"
"doubanReviewCount": "Valoración de Douban #"
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalles del audiolibro",
"comicBookDetails": "Detalles del cómic",
"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",
"previousBookBtn": "Libro anterior",
"nextBookBtn": "Libro siguiente",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Cargando metadatos completos...",
"columnCurrent": "Actual",
"columnFetched": "Obtenido",
"copyMissingTooltip": "Copiar campos faltantes",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Ingresa tus criterios de búsqueda arriba y haz clic en Buscar para encontrar metadatos",
"noResultsFound": "No se encontraron resultados",
"noResultsHint": "Intenta ajustar tus criterios de búsqueda o seleccionar otros proveedores",
"unknownProvider": "",
"selectOverlay": "Seleccionar"
},
"tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Tamaño del Archivo (Kb)",
"fileType": "Tipo de Archivo",
"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",
"addedOn": "Fecha de Agregado",
"lubimyczytacRating": "Calificación de Lubimyczytac",
"description": "Descripción",
"narrator": "Narrador",
"ageRating": "Clasificación por Edad",
"contentRating": "Clasificación de Contenido",
"audibleRating": "Calificación de Audible",
"audibleReviewCount": "Cantidad de Reseñas de Audible",
"abridged": "Abreviado",
"audiobookDuration": "Duración del Audiolibro (s)",
"audiobookCodec": "Códec",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Total de la Serie",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Clasificación por Edad",
"contentRating": "Clasificación de Contenido",
"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",
"abridged": "Abreviado",
"audiobookDuration": "Duración",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Détails du livre audio",
"comicBookDetails": "Détails de la bande dessinée",
"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",
"previousBookBtn": "Livre précédent",
"nextBookBtn": "Livre suivant",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Chargement des métadonnées complètes...",
"columnCurrent": "Actuel",
"columnFetched": "Récupéré",
"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",
"noResultsFound": "Aucun résultat trouvé",
"noResultsHint": "Essayez d'ajuster vos critères de recherche ou de sélectionner d'autres fournisseurs",
"unknownProvider": "",
"selectOverlay": "Sélectionner"
},
"tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Taille du fichier (Ko)",
"fileType": "Type de fichier",
"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": "",
"addedOn": "Date d'ajout",
"lubimyczytacRating": "Note Lubimyczytac",
"description": "",
"narrator": "Narrateur",
"ageRating": "Classification d'âge",
"contentRating": "Classification de contenu",
"audibleRating": "Note Audible",
"audibleReviewCount": "Nombre d'avis Audible",
"abridged": "Abrégé",
"audiobookDuration": "Durée du livre audio (s)",
"audiobookCodec": "",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Total de la série",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Classification d'âge",
"contentRating": "Classification de contenu",
"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",
"abridged": "Abrégé",
"audiobookDuration": "Durée",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "ISBN-13",
"isbn10": "ISBN-10",
"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",
"doubanReviewCount": "Ocjena Douban #",
"ranobedbRating": "Ocjena Ranobedb"
"doubanReviewCount": "Ocjena Douban #"
}
},
"fieldSelector": {
"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.",
"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"
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalji audioknjige",
"comicBookDetails": "Detalji stripa",
"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",
"previousBookBtn": "Prethodna knjiga",
"nextBookBtn": "Sljedeća knjiga",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Učitavanje potpunih metapodataka...",
"columnCurrent": "Trenutno",
"columnFetched": "Dohvaćeno",
"copyMissingTooltip": "Kopiraj polja koja nedostaju",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Unesite kriterije pretrage iznad i kliknite Pretraži za pronalaženje metapodataka",
"noResultsFound": "Nema pronađenih rezultata",
"noResultsHint": "Pokušajte prilagoditi kriterije pretrage ili odabrati druge pružatelje",
"unknownProvider": "Nepoznati pružatelj usluge",
"selectOverlay": "Odaberi"
},
"tabs": {
@@ -5111,22 +5037,12 @@
"fileSize": "Veličina datoteke (Kb)",
"fileType": "Vrsta datoteke",
"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",
"addedOn": "Datum dodavanja",
"lubimyczytacRating": "Lubimyczytac ocjena",
"description": "Opis",
"narrator": "Narator",
"ageRating": "Dobna ocjena",
"contentRating": "Ocjena sadržaja",
"audibleRating": "Audible ocjena",
"audibleReviewCount": "Audible broj recenzija",
"abridged": "Skraćeno",
"audiobookDuration": "Trajanje audioknjige (s)",
"audiobookCodec": "Kodek",
@@ -5256,31 +5172,9 @@
"seriesTotal": "Ukupno u serijalu",
"isbn13": "ISBN-13",
"isbn10": "ISBN-10",
"asin": "ASIN",
"ageRating": "Dobna ocjena",
"contentRating": "Ocjena sadržaja",
"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",
"abridged": "Skraćeno",
"audiobookDuration": "Trajanje",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5093,22 +5019,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5238,31 +5154,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "Dimuat",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": "Pilih"
},
"tabs": {
@@ -5083,22 +5009,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "Subjudul",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "Deskripsi",
"narrator": "Narator",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "Ringkasan",
"audiobookDuration": "",
"audiobookCodec": "Kodek",
@@ -5228,31 +5144,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "Narator",
"abridged": "Ringkasan",
"audiobookDuration": "Durasi",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Dettagli audiolibro",
"comicBookDetails": "Dettagli fumetto",
"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",
"previousBookBtn": "Libro precedente",
"nextBookBtn": "Libro successivo",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Caricamento metadati completi...",
"columnCurrent": "Corrente",
"columnFetched": "Recuperato",
"copyMissingTooltip": "Copia campi mancanti",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Inserisci i criteri di ricerca sopra e clicca Cerca per trovare i metadati",
"noResultsFound": "Nessun risultato trovato",
"noResultsHint": "Prova a modificare i criteri di ricerca o seleziona provider diversi",
"unknownProvider": "",
"selectOverlay": "Seleziona"
},
"tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Dimensione file (Kb)",
"fileType": "Tipo file",
"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",
"addedOn": "Data aggiunta",
"lubimyczytacRating": "Valutazione Lubimyczytac",
"description": "Descrizione",
"narrator": "Narratore",
"ageRating": "Classificazione età",
"contentRating": "Classificazione contenuto",
"audibleRating": "Valutazione Audible",
"audibleReviewCount": "Numero recensioni Audible",
"abridged": "Ridotto",
"audiobookDuration": "Durata audiolibro (s)",
"audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Totale serie",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Classificazione età",
"contentRating": "Classificazione contenuto",
"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",
"abridged": "Ridotto",
"audiobookDuration": "Durata",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "メタデータエディタとピッカーの有効フィールド",
"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": ""
}
"sectionDesc": "本の情報を編集したりプロバイダーからメタデータを選択する際に表示するメタデータフィールドを選択します。無効なフィールドはインターフェースに表示されません。"
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "オーディオブック詳細",
"comicBookDetails": "コミックブック詳細",
"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": "閉じる",
"previousBookBtn": "前の本",
"nextBookBtn": "次の本",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "完全なメタデータを読み込み中...",
"columnCurrent": "現在",
"columnFetched": "取得済み",
"copyMissingTooltip": "欠損フィールドをコピー",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "上に検索条件を入力して「検索」をクリックするとメタデータを検索できます",
"noResultsFound": "結果が見つかりません",
"noResultsHint": "検索条件を調整するか、別のプロバイダーを選択してみてください",
"unknownProvider": "",
"selectOverlay": "選択"
},
"tabs": {
@@ -5108,22 +5034,12 @@
"fileSize": "ファイルサイズ (Kb)",
"fileType": "ファイルタイプ",
"subtitle": "サブタイトル",
"amazonRating": "Amazon評価",
"amazonReviewCount": "Amazonレビュー数",
"goodreadsRating": "Goodreads評価",
"goodreadsReviewCount": "Goodreadsレビュー数",
"hardcoverRating": "Hardcover評価",
"hardcoverReviewCount": "Hardcoverレビュー数",
"ranobedbRating": "Ranobedb評価",
"genre": "ジャンル",
"addedOn": "追加日",
"lubimyczytacRating": "Lubimyczytac評価",
"description": "説明",
"narrator": "ナレーター",
"ageRating": "年齢制限",
"contentRating": "コンテンツレーティング",
"audibleRating": "Audible評価",
"audibleReviewCount": "Audibleレビュー数",
"abridged": "要約版",
"audiobookDuration": "オーディオブックの長さ (秒)",
"audiobookCodec": "",
@@ -5253,31 +5169,9 @@
"seriesTotal": "シリーズ合計",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "年齢制限",
"contentRating": "コンテンツレーティング",
"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": "ナレーター",
"abridged": "要約版",
"audiobookDuration": "再生時間",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5093,22 +5019,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5238,31 +5154,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Szczegóły audiobooka",
"comicBookDetails": "Szczegóły komiksu",
"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",
"previousBookBtn": "Poprzednia książka",
"nextBookBtn": "Następna książka",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Ładowanie pełnych metadanych...",
"columnCurrent": "Aktualne",
"columnFetched": "Pobrane",
"copyMissingTooltip": "Skopiuj brakujące pola",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Wprowadź kryteria wyszukiwania powyżej i kliknij Szukaj, aby znaleźć metadane",
"noResultsFound": "Nie znaleziono wyników",
"noResultsHint": "Spróbuj zmienić kryteria wyszukiwania lub wybrać innych dostawców",
"unknownProvider": "",
"selectOverlay": "Wybierz"
},
"tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Rozmiar pliku (KB)",
"fileType": "Typ pliku",
"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",
"addedOn": "Data dodania",
"lubimyczytacRating": "Ocena Lubimyczytac",
"description": "Opis",
"narrator": "",
"ageRating": "Kategoria wiekowa",
"contentRating": "Ocena treści",
"audibleRating": "Ocena Audible",
"audibleReviewCount": "Liczba recenzji Audible",
"abridged": "Skrócona",
"audiobookDuration": "Czas trwania audiobooka (s)",
"audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Łącznie w serii",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Kategoria wiekowa",
"contentRating": "Ocena treści",
"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": "",
"abridged": "Skrócona",
"audiobookDuration": "Czas trwania",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Detalhes do Audiolivro",
"comicBookDetails": "Detalhes de Quadrinhos",
"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",
"previousBookBtn": "Livro Anterior",
"nextBookBtn": "Próximo Livro",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Carregando metadados completos...",
"columnCurrent": "Atual",
"columnFetched": "Obtido",
"copyMissingTooltip": "Copiar campos ausentes",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Insira seus critérios de busca acima e clique em Pesquisar para encontrar metadados",
"noResultsFound": "Nenhum Resultado Encontrado",
"noResultsHint": "Tente ajustar seus critérios de busca ou selecionar provedores diferentes",
"unknownProvider": "",
"selectOverlay": "Selecionar"
},
"tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Tamanho do Arquivo (Kb)",
"fileType": "Tipo de Arquivo",
"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",
"addedOn": "Data de Adição",
"lubimyczytacRating": "Avaliação Lubimyczytac",
"description": "Descrição",
"narrator": "Narrador",
"ageRating": "Classificação Etária",
"contentRating": "Classificação de Conteúdo",
"audibleRating": "Avaliação Audible",
"audibleReviewCount": "Contagem de Avaliações Audible",
"abridged": "Abreviado",
"audiobookDuration": "Duração do Audiolivro (s)",
"audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Total da Série",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Classificação Etária",
"contentRating": "Classificação de Conteúdo",
"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",
"abridged": "Abreviado",
"audiobookDuration": "Duração",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "Включённые поля в редакторе и средстве выбора метаданных",
"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": ""
}
"sectionDesc": "Выберите, какие поля метаданных отображать при редактировании информации о книге или выборе метаданных от провайдеров. Отключённые поля будут скрыты из интерфейса."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Детали аудиокниги",
"comicBookDetails": "Детали комикса",
"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": "Закрыть",
"previousBookBtn": "Предыдущая книга",
"nextBookBtn": "Следующая книга",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Загрузка полных метаданных...",
"columnCurrent": "Текущие",
"columnFetched": "Полученные",
"copyMissingTooltip": "Скопировать отсутствующие поля",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Введите критерии поиска выше и нажмите «Поиск» для получения метаданных",
"noResultsFound": "Результатов не найдено",
"noResultsHint": "Попробуйте изменить критерии поиска или выбрать других провайдеров",
"unknownProvider": "",
"selectOverlay": "Выбрать"
},
"tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "Размер файла (Кб)",
"fileType": "Тип файла",
"subtitle": "Подзаголовок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "Количество отзывов Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "Количество отзывов Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "Количество отзывов Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"genre": "Жанр",
"addedOn": "Дата добавления",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"description": "Описание",
"narrator": "Чтец",
"ageRating": "Возрастной рейтинг",
"contentRating": "Рейтинг контента",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "Количество отзывов Audible",
"abridged": "Сокращённая версия",
"audiobookDuration": "Длительность аудиокниги (с)",
"audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "Всего в серии",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Возрастной рейтинг",
"contentRating": "Рейтинг контента",
"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": "Чтец",
"abridged": "Сокращённая версия",
"audiobookDuration": "Длительность",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "",
"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": ""
}
"sectionDesc": ""
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "",
"comicBookDetails": "",
"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": "",
"previousBookBtn": "",
"nextBookBtn": "",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "",
"columnCurrent": "",
"columnFetched": "",
"copyMissingTooltip": "",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "",
"noResultsFound": "",
"noResultsHint": "",
"unknownProvider": "",
"selectOverlay": ""
},
"tabs": {
@@ -5067,22 +4993,12 @@
"fileSize": "",
"fileType": "",
"subtitle": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"ranobedbRating": "",
"genre": "",
"addedOn": "",
"lubimyczytacRating": "",
"description": "",
"narrator": "",
"ageRating": "",
"contentRating": "",
"audibleRating": "",
"audibleReviewCount": "",
"abridged": "",
"audiobookDuration": "",
"audiobookCodec": "",
@@ -5212,31 +5128,9 @@
"seriesTotal": "",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "",
"contentRating": "",
"personalRating": "",
"amazonRating": "",
"goodreadsRating": "",
"hardcoverRating": "",
"ranobedbRating": "",
"lubimyczytacRating": "",
"audibleRating": "",
"applebooksRating": "",
"amazonReviewCount": "",
"goodreadsReviewCount": "",
"hardcoverReviewCount": "",
"audibleReviewCount": "",
"applebooksReviewCount": "",
"openlibraryId": "",
"goodreadsId": "",
"hardcoverId": "",
"googleId": "",
"audibleId": "",
"applebooksId": "",
"lubimyczytacId": "",
"ranobedbId": "",
"comicvineId": "",
"narrator": "",
"abridged": "",
"audiobookDuration": "",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"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",
"doubanReviewCount": "Douban ocena #",
"ranobedbRating": "Ranobedb ocena"
"doubanReviewCount": "Douban ocena #"
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Podrobnosti zvočne knjige",
"comicBookDetails": "Podrobnosti stripa",
"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",
"previousBookBtn": "Prejšnja knjiga",
"nextBookBtn": "Naslednja knjiga",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Nalaganje celotnih metapodatkov...",
"columnCurrent": "Trenutno",
"columnFetched": "Pridobljeno",
"copyMissingTooltip": "Kopiraj manjkajoča polja",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Zgoraj vnesi iskalne pogoje in klikni Išči, da najdeš metapodatke",
"noResultsFound": "Ni rezultatov",
"noResultsHint": "Poskusi prilagoditi iskalne pogoje ali izberi druge ponudnike",
"unknownProvider": "",
"selectOverlay": "Izberi"
},
"tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Velikost datoteke (Kb)",
"fileType": "Vrsta datoteke",
"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",
"addedOn": "Datum dodajanja",
"lubimyczytacRating": "Lubimyczytac ocena",
"description": "Opis",
"narrator": "Pripovedovalec",
"ageRating": "Starostna omejitev",
"contentRating": "Starostna ocena",
"audibleRating": "Audible ocena",
"audibleReviewCount": "Število Audible mnenj",
"abridged": "Skrajšano",
"audiobookDuration": "Trajanje zvočne knjige (s)",
"audiobookCodec": "Kodek",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Skupaj v zbirki",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Starostna omejitev",
"contentRating": "Starostna 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",
"abridged": "Skrajšano",
"audiobookDuration": "Trajanje",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"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",
"doubanReviewCount": "Douban-betyg #",
"ranobedbRating": "Ranobedb-betyg"
"doubanReviewCount": "Douban-betyg #"
}
},
"fieldSelector": {
"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.",
"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": ""
}
"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."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Ljudboksdetaljer",
"comicBookDetails": "Serietidningsdetaljer",
"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",
"previousBookBtn": "Föregående bok",
"nextBookBtn": "Nästa bok",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Laddar komplett metadata...",
"columnCurrent": "Nuvarande",
"columnFetched": "Hämtad",
"copyMissingTooltip": "Kopiera saknade fält",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Ange dina sökkriterier ovan och klicka Sök för att hitta metadata",
"noResultsFound": "Inga resultat hittades",
"noResultsHint": "Prova att justera dina sökkriterier eller välja andra leverantörer",
"unknownProvider": "",
"selectOverlay": "Välj"
},
"tabs": {
@@ -5109,22 +5035,12 @@
"fileSize": "Filstorlek (Kb)",
"fileType": "Filtyp",
"subtitle": "Undertitel",
"amazonRating": "Amazon-betyg",
"amazonReviewCount": "Amazon-recensioner",
"goodreadsRating": "Goodreads-betyg",
"goodreadsReviewCount": "Goodreads-recensioner",
"hardcoverRating": "Hardcover-betyg",
"hardcoverReviewCount": "Hardcover-recensioner",
"ranobedbRating": "Ranobedb-betyg",
"genre": "",
"addedOn": "Datum tillagd",
"lubimyczytacRating": "Lubimyczytac-betyg",
"description": "Beskrivning",
"narrator": "Berattare",
"ageRating": "Aldersbetyg",
"contentRating": "Innehallsbetyg",
"audibleRating": "Audible-betyg",
"audibleReviewCount": "Audible-recensioner",
"abridged": "Forkortad",
"audiobookDuration": "Ljudbokslangd (s)",
"audiobookCodec": "Kodek",
@@ -5254,31 +5170,9 @@
"seriesTotal": "Totalt i serien",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Aldersbetyg",
"contentRating": "Innehallsbetyg",
"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",
"abridged": "Forkortad",
"audiobookDuration": "Varaktighet",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "Кількість сторінок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "К-сть оцінок Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "К-сть оцінок Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "К-сть оцінок Hardcover",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "К-сть оцінок Audible",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "Рейтинг Douban",
"doubanReviewCount": "К-сть оцінок Douban",
"ranobedbRating": "Рейтинг Ranobedb"
"doubanReviewCount": "К-сть оцінок Douban"
}
},
"fieldSelector": {
"sectionTitle": "Увімкнені поля в редакторі та виборі метаданих",
"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": ""
}
"sectionDesc": "Виберіть, які поля метаданих відображати під час редагування інформації про книгу або вибору метаданих від провайдерів. Вимкнені поля будуть приховані з інтерфейсу."
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "Деталі аудіокниги",
"comicBookDetails": "Деталі коміксу",
"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": "Закрити",
"previousBookBtn": "Попередня книга",
"nextBookBtn": "Наступна книга",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "Завантаження повних метаданих...",
"columnCurrent": "Поточні",
"columnFetched": "Отримані",
"copyMissingTooltip": "Скопіювати відсутні поля",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "Введіть критерії пошуку вище й натисніть Пошук, щоб знайти метадані",
"noResultsFound": "Результатів не знайдено",
"noResultsHint": "Спробуйте змінити критерії пошуку або вибрати інших провайдерів",
"unknownProvider": "",
"selectOverlay": "Вибрати"
},
"tabs": {
@@ -5110,22 +5036,12 @@
"fileSize": "Розмір файлу (КБ)",
"fileType": "Тип файлу",
"subtitle": "Підзаголовок",
"amazonRating": "Рейтинг Amazon",
"amazonReviewCount": "Кількість відгуків Amazon",
"goodreadsRating": "Рейтинг Goodreads",
"goodreadsReviewCount": "Кількість відгуків Goodreads",
"hardcoverRating": "Рейтинг Hardcover",
"hardcoverReviewCount": "Кількість відгуків Hardcover",
"ranobedbRating": "Рейтинг Ranobedb",
"genre": "Жанр",
"addedOn": "Дата додавання",
"lubimyczytacRating": "Рейтинг Lubimyczytac",
"description": "Опис",
"narrator": "Оповідач",
"ageRating": "Віковий рейтинг",
"contentRating": "Рейтинг контенту",
"audibleRating": "Рейтинг Audible",
"audibleReviewCount": "Кількість відгуків Audible",
"abridged": "Скорочена",
"audiobookDuration": "Тривалість аудіокниги (с)",
"audiobookCodec": "Кодек",
@@ -5255,31 +5171,9 @@
"seriesTotal": "Всього в серії",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "Віковий рейтинг",
"contentRating": "Рейтинг контенту",
"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": "Оповідач",
"abridged": "Скорочена",
"audiobookDuration": "Тривалість",
+2 -108
View File
@@ -751,62 +751,13 @@
"isbn13": "",
"isbn10": "",
"pageCount": "",
"amazonRating": "",
"amazonReviewCount": "",
"goodreadsRating": "",
"goodreadsReviewCount": "",
"hardcoverRating": "",
"hardcoverReviewCount": "",
"audibleRating": "",
"audibleReviewCount": "",
"applebooksId": "",
"applebooksRating": "",
"applebooksReviewCount": "",
"doubanRating": "",
"doubanReviewCount": "",
"ranobedbRating": ""
"doubanReviewCount": ""
}
},
"fieldSelector": {
"sectionTitle": "元数据编辑器和选择器中的启用字段",
"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": ""
}
"sectionDesc": "选择编辑书籍信息或从提供商选择元数据时显示哪些元数据字段。禁用的字段将从界面中隐藏。"
}
},
"settingsLibMeta": {
@@ -2258,29 +2209,6 @@
"audiobookDetails": "有声书详情",
"comicBookDetails": "漫画详情",
"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": "关闭",
"previousBookBtn": "上一本书",
"nextBookBtn": "下一本书",
@@ -2341,7 +2269,6 @@
}
},
"picker": {
"loadingMetadata": "正在加载完整元数据...",
"columnCurrent": "当前",
"columnFetched": "获取的",
"copyMissingTooltip": "复制缺失字段",
@@ -2404,7 +2331,6 @@
"readyToSearchHint": "在上方输入搜索条件,然后点击搜索查找元数据",
"noResultsFound": "未找到结果",
"noResultsHint": "尝试调整搜索条件或选择不同的提供商",
"unknownProvider": "",
"selectOverlay": "选择"
},
"tabs": {
@@ -5107,22 +5033,12 @@
"fileSize": "文件大小 (Kb)",
"fileType": "文件类型",
"subtitle": "副标题",
"amazonRating": "Amazon 评分",
"amazonReviewCount": "Amazon 评论数",
"goodreadsRating": "Goodreads 评分",
"goodreadsReviewCount": "Goodreads 评论数",
"hardcoverRating": "Hardcover 评分",
"hardcoverReviewCount": "Hardcover 评论数",
"ranobedbRating": "Ranobedb 评分",
"genre": "类型",
"addedOn": "添加日期",
"lubimyczytacRating": "Lubimyczytac 评分",
"description": "描述",
"narrator": "朗读者",
"ageRating": "年龄评级",
"contentRating": "内容评级",
"audibleRating": "Audible 评分",
"audibleReviewCount": "Audible 评论数",
"abridged": "删节版",
"audiobookDuration": "有声书时长 (秒)",
"audiobookCodec": "",
@@ -5252,31 +5168,9 @@
"seriesTotal": "系列总数",
"isbn13": "",
"isbn10": "",
"asin": "",
"ageRating": "年龄评级",
"contentRating": "内容评级",
"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": "朗读者",
"abridged": "删节版",
"audiobookDuration": "时长",