RanobeDB Light Novel metadata provider (#2221)

* feat(metadata): added ranobedb metadata provider for light novels

* fix(metadata): remove ranobedb review count and fix merge conflicts

* test(metadata): added unit tests for RanobeDB parser

* fix(metadata): add ranobedb to updated metadata searcher

---------

Co-authored-by: ACX <8075870+acx10@users.noreply.github.com>
This commit is contained in:
Arden Rasmussen
2026-01-10 10:21:39 -07:00
committed by GitHub
co-authored by ACX
parent 105f477c79
commit 4f012746c5
65 changed files with 923 additions and 52 deletions
@@ -45,6 +45,7 @@ export type FilterType =
| 'pageCount'
| 'amazonRating'
| 'goodreadsRating'
| 'ranobedbRating'
| 'hardcoverRating';
export const ratingRanges = [
@@ -222,6 +223,7 @@ export class BookFilterComponent implements OnInit, OnDestroy {
amazonRating: 'Amazon Rating',
goodreadsRating: 'Goodreads Rating',
hardcoverRating: 'Hardcover Rating',
ranobedbRating: 'Ranobedb Rating',
};
private destroy$ = new Subject<void>();
@@ -289,6 +291,7 @@ export class BookFilterComponent implements OnInit, OnDestroy {
amazonRating: this.getFilterStream((book: Book) => getRatingRangeFilters(book.metadata?.amazonRating ?? undefined), 'id', 'name', 'sortIndex'),
goodreadsRating: this.getFilterStream((book: Book) => getRatingRangeFilters(book.metadata?.goodreadsRating ?? undefined), 'id', 'name', 'sortIndex'),
hardcoverRating: this.getFilterStream((book: Book) => getRatingRangeFilters(book.metadata?.hardcoverRating ?? undefined), 'id', 'name', 'sortIndex'),
ranobedbRating: this.getFilterStream((book: Book) => getRatingRangeFilters(book.metadata?.ranobedbRating ?? undefined), 'id', 'name', 'sortIndex'),
};
this.filterTypes = Object.keys(this.filterStreams) as FilterType[];
@@ -83,7 +83,7 @@
</div>
}
</td>
} @else if (col.field === 'amazonRating' || col.field === 'goodreadsRating' || col.field === 'hardcoverRating') {
} @else if (col.field === 'amazonRating' || col.field === 'goodreadsRating' || col.field === 'hardcoverRating' || col.field == 'ranobedbRating') {
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
<span class="flex items-center gap-1">
<p-rating
@@ -72,7 +72,8 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
{field: 'goodreadsRating', header: 'Goodreads'},
{field: 'goodreadsReviewCount', header: 'GR #'},
{field: 'hardcoverRating', header: 'Hardcover'},
{field: 'hardcoverReviewCount', header: 'HC #'}
{field: 'hardcoverReviewCount', header: 'HC #'},
{field: 'ranobedbRating', header: 'Ranobedb'},
];
scrollHeight = 'calc(100dvh - 160px)';
@@ -294,7 +295,8 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
case 'amazonRating':
case 'goodreadsRating':
case 'hardcoverRating': {
case 'hardcoverRating':
case 'ranobedbRating': {
const rating = metadata[field];
return typeof rating === 'number' ? rating.toFixed(1) : '';
}
@@ -24,6 +24,7 @@ export class FilterLabelHelper {
amazonRating: 'Amazon Rating',
goodreadsRating: 'Goodreads Rating',
hardcoverRating: 'Hardcover Rating',
ranobedbRating: 'Ranobedb Rating',
mood: 'Mood',
tag: 'Tag',
};
@@ -71,6 +72,7 @@ export class FilterLabelHelper {
case 'amazonrating':
case 'goodreadsrating':
case 'hardcoverrating':
case 'ranobedbrating':
{
const ratingRange = ratingRanges.find(r => r.id === value);
if (ratingRange) return ratingRange.label;
@@ -122,6 +122,7 @@ describe('SideBarFilter', () => {
amazonRating: 4.2,
goodreadsRating: 3.8,
hardcoverRating: 4.0,
ranobedbRating: 3.5,
publishedDate: '2020-01-01',
pageCount: 150,
language: 'en'
@@ -148,6 +149,7 @@ describe('SideBarFilter', () => {
amazonRating: 2.5,
goodreadsRating: 2.8,
hardcoverRating: 2.0,
ranobedbRating: 2.4,
publishedDate: '2019-01-01',
pageCount: 50,
language: 'fr'
@@ -235,6 +237,12 @@ describe('SideBarFilter', () => {
expect(result?.books?.[0]?.metadata?.hardcoverRating).toBeGreaterThanOrEqual(2);
});
it('filters by ranobedbRating', async () => {
const result = await firstValueFrom(filterWith({ranobedbRating: ['3to4']}, 'and'));
expect(result?.books?.length).toBe(1);
expect(result?.books?.[0]?.metadata?.ranobedbRating).toBeGreaterThanOrEqual(3);
});
it('filters by personalRating', async () => {
const result = await firstValueFrom(filterWith({personalRating: ['7']}, 'and'));
expect(result?.books?.length).toBe(1);
@@ -94,6 +94,8 @@ export class SideBarFilter implements BookFilter {
return filterValues.some(range => isRatingInRange(book.metadata?.goodreadsRating, range));
case 'hardcoverRating':
return filterValues.some(range => isRatingInRange(book.metadata?.hardcoverRating, range));
case 'ranobedbRating':
return filterValues.some(range => isRatingInRange(book.metadata?.ranobedbRating, range));
case 'personalRating':
return filterValues.some(range => isRatingInRange10(book.personalRating, range));
case 'publishedDate':
@@ -35,7 +35,8 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
'isbn13Locked', 'isbn10Locked', 'asinLocked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked',
'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked', 'moodsLocked', 'tagsLocked',
'amazonRatingLocked', 'amazonReviewCountLocked', 'goodreadsRatingLocked', 'goodreadsReviewCountLocked',
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'hardcoverBookIdLocked', 'googleIdLocked', 'comicvineIdLocked'
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'hardcoverBookIdLocked', 'googleIdLocked', 'comicvineIdLocked',
'ranobedbIdLocked', 'ranobedbRatingLocked'
];
fieldLabels: Record<string, string> = {
@@ -69,6 +70,8 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
hardcoverBookIdLocked: 'Hardcover Book ID',
googleIdLocked: 'Google ID',
comicvineIdLocked: 'Comicvine ID',
ranobedbIdLocked: 'Ranobedb ID',
ranobedbRatingLocked: 'Ranobedb ★',
};
isSaving = false;
@@ -89,6 +89,12 @@
@if (backupMetadata.hardcoverReviewCount !== null) {
<div><strong>Hardcover Review Count:</strong> {{ backupMetadata.hardcoverReviewCount }}</div>
}
@if (backupMetadata.ranobedbId) {
<div><strong>Ranobedb ID:</strong> {{ backupMetadata.ranobedbId }}</div>
}
@if (backupMetadata.ranobedbRating !== null) {
<div><strong>Ranobedb Rating:</strong> {{ backupMetadata.ranobedbRating }}</div>
}
@if (backupMetadata.googleId) {
<div><strong>Google Books ID:</strong> {{ backupMetadata.googleId }}</div>
}
@@ -22,6 +22,7 @@ export class BookSorter {
{label: 'Goodreads #', field: 'goodreadsReviewCount', direction: SortDirection.ASCENDING},
{label: 'Hardcover Rating', field: 'hardcoverRating', direction: SortDirection.ASCENDING},
{label: 'Hardcover #', field: 'hardcoverReviewCount', direction: SortDirection.ASCENDING},
{label: 'Ranobedb Rating', field: 'ranobedbRating', direction: SortDirection.ASCENDING},
{label: 'Pages', field: 'pageCount', direction: SortDirection.ASCENDING},
{label: 'Random', field: 'random', direction: SortDirection.ASCENDING},
];
@@ -31,6 +31,7 @@ describe('TableColumnPreferenceService', () => {
{field: 'goodreadsReviewCount', header: 'GR #'},
{field: 'hardcoverRating', header: 'Hardcover'},
{field: 'hardcoverReviewCount', header: 'HC #'},
{field: 'ranobedbRating', header: 'Ranobedb'},
];
const fallbackPreferences: TableColumnPreference[] = allColumns.map((col, index) => ({
@@ -34,6 +34,7 @@ export class TableColumnPreferenceService {
{field: 'goodreadsReviewCount', header: 'GR #'},
{field: 'hardcoverRating', header: 'Hardcover'},
{field: 'hardcoverReviewCount', header: 'HC #'},
{field: 'ranobedbRating', header: 'Ranobedb'},
];
private readonly fallbackPreferences: TableColumnPreference[] = this.allAvailableColumns.map((col, index) => ({
@@ -100,10 +100,12 @@ export interface BookMetadata {
amazonReviewCount?: number | null;
goodreadsRating?: number | null;
goodreadsReviewCount?: number | null;
hardcoverRating?: number | null;
hardcoverReviewCount?: number | null;
lubimyczytacId?: string;
lubimyczytacRating?: number | null;
ranobedbId?: string;
ranobedbRating?: number | null;
hardcoverRating?: number | null;
coverUpdatedOn?: string;
authors?: string[];
categories?: string[];
@@ -139,6 +141,8 @@ export interface BookMetadata {
hardcoverReviewCountLocked?: boolean;
lubimyczytacIdLocked?: boolean;
lubimyczytacRatingLocked?: boolean;
ranobedbIdLocked?: boolean;
ranobedbRatingLocked?: boolean;
coverUpdatedOnLocked?: boolean;
authorsLocked?: boolean;
categoriesLocked?: boolean;
@@ -176,6 +180,8 @@ export interface MetadataClearFlags {
hardcoverReviewCount?: boolean;
lubimyczytacId?: boolean;
lubimyczytacRating?: boolean;
ranobedbId?: boolean;
ranobedbRating?: boolean;
authors?: boolean;
categories?: boolean;
moods?: boolean;
@@ -87,6 +87,7 @@ export class SortService {
goodreadsReviewCount: (book) => book.metadata?.goodreadsReviewCount || null,
hardcoverRating: (book) => book.metadata?.hardcoverRating || null,
hardcoverReviewCount: (book) => book.metadata?.hardcoverReviewCount || null,
ranobedbRating: (book) => book.metadata?.ranobedbRating || null,
locked: (book) =>
Object.keys(book.metadata ?? {})
.filter((key) => key.endsWith('Locked'))
@@ -34,7 +34,7 @@ import {DatePicker} from 'primeng/datepicker';
export class BookdropFileMetadataPickerComponent {
private readonly confirmationService = inject(ConfirmationService);
@Input() fetchedMetadata!: BookMetadata;
@Input() originalMetadata?: BookMetadata;
@Input() metadataForm!: FormGroup;
@@ -85,6 +85,8 @@ export class BookdropFileMetadataPickerComponent {
{label: 'Hardcover ★', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'},
{label: 'Comicvine ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId'},
{label: 'Ranobedb ID', controlName: 'ranobedbId', lockedKey: 'ranobedbIdLocked', fetchedKey: 'ranobedbId'},
{label: 'Ranobedb ★', controlName: 'ranobedbRating', lockedKey: 'ranobedbRatingLocked', fetchedKey: 'ranobedbRating'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
];
@@ -129,12 +131,12 @@ export class BookdropFileMetadataPickerComponent {
const [value, original] = this.prepFieldComparison(this.metadataForm.get(field)?.value, this.originalMetadata?.[field]);
return (value && value != original) || (!value && original);
}
isFetchedDifferent(field: string): boolean {
const [value, fetched] = this.prepFieldComparison(this.metadataForm.get(field)?.value, this.fetchedMetadata[field]);
return (fetched && fetched != value);
}
private prepFieldComparison(field1: any, field2: any) {
if (Array.isArray(field1)) {
field1 = field1.length > 0 ? JSON.stringify(field1.sort()) : undefined;
@@ -216,6 +218,8 @@ export class BookdropFileMetadataPickerComponent {
hardcoverReviewCount: this.originalMetadata.hardcoverReviewCount || null,
googleId: this.originalMetadata.googleId || null,
comicvineId: this.originalMetadata.comicvineId || null,
ranobedbId: this.originalMetadata.ranobedbId || null,
ranobedbRating: this.originalMetadata.ranobedbRating || null,
seriesName: this.originalMetadata.seriesName || null,
seriesNumber: this.originalMetadata.seriesNumber || null,
seriesTotal: this.originalMetadata.seriesTotal || null,
@@ -324,6 +324,8 @@ export class BookdropFileReviewComponent implements OnInit {
hardcoverReviewCount: original?.hardcoverReviewCount ?? 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,
@@ -571,6 +573,8 @@ export class BookdropFileReviewComponent implements OnInit {
hardcoverBookId: new FormControl(original?.hardcoverBookId ?? ''),
hardcoverRating: new FormControl(original?.hardcoverRating ?? ''),
hardcoverReviewCount: new FormControl(original?.hardcoverReviewCount ?? ''),
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 ?? ''),
@@ -617,10 +621,10 @@ export class BookdropFileReviewComponent implements OnInit {
openBulkEditDialog(): void {
const selectedFiles = this.getSelectedFiles();
const totalCount = this.selectAllAcrossPages
? this.totalRecords - this.excludedFiles.size
const totalCount = this.selectAllAcrossPages
? this.totalRecords - this.excludedFiles.size
: selectedFiles.length;
if (totalCount === 0) {
this.messageService.add({
severity: 'warn',
@@ -647,10 +651,10 @@ export class BookdropFileReviewComponent implements OnInit {
openPatternExtractDialog(): void {
const selectedFiles = this.getSelectedFiles();
const totalCount = this.selectAllAcrossPages
? this.totalRecords - this.excludedFiles.size
const totalCount = this.selectAllAcrossPages
? this.totalRecords - this.excludedFiles.size
: selectedFiles.length;
if (totalCount === 0) {
this.messageService.add({
severity: 'warn',
@@ -60,6 +60,7 @@ export type RuleField =
| 'goodreadsReviewCount'
| 'hardcoverRating'
| 'hardcoverReviewCount'
| 'ranobedbRating'
| 'personalRating'
| 'fileType'
| 'fileSize'
@@ -142,7 +143,8 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
goodreadsRating: {label: 'Goodreads Rating', type: 'decimal', max: 5},
goodreadsReviewCount: {label: 'Goodreads Review Count', type: 'number'},
hardcoverRating: {label: 'Hardcover Rating', type: 'decimal', max: 5},
hardcoverReviewCount: {label: 'Hardcover Review Count', type: 'number'}
hardcoverReviewCount: {label: 'Hardcover Review Count', type: 'number'},
ranobedbRating: {label: 'Ranobedb Rating', type: 'decimal', max: 5}
};
@Component({
@@ -1,8 +1,8 @@
import {Injectable} from '@angular/core';
import {Book} from '../../book/model/book.model';
import {GroupRule, Rule, RuleField} from '../component/magic-shelf-component';
import { Injectable } from '@angular/core';
import { Book } from '../../book/model/book.model';
import { GroupRule, Rule, RuleField } from '../component/magic-shelf-component';
@Injectable({providedIn: 'root'})
@Injectable({ providedIn: 'root' })
export class BookRuleEvaluatorService {
evaluateGroup(book: Book, group: GroupRule): boolean {
@@ -252,6 +252,8 @@ export class BookRuleEvaluatorService {
return book.metadata?.hardcoverRating;
case 'hardcoverReviewCount':
return book.metadata?.hardcoverReviewCount;
case 'ranobedbRating':
return book.metadata?.ranobedbRating;
default:
return (book as Record<string, unknown>)[field];
}
@@ -507,6 +507,9 @@
}
</div>
</div>
</div>
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
<div class="field-group metadata-id-field">
<label for="lubimyczytacId">LC ID</label>
<div class="field-with-lock">
@@ -543,6 +546,30 @@
}
</div>
</div>
<div class="flex flex-col gap-1 md:w-1/6">
<label class="text-sm" for="ranobedbId">Ranobedb ID</label>
<div class="flex withbutton">
<input pSize="small" pInputText id="ranobedbId" formControlName="ranobedbId" class="w-full"/>
@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>
<div class="flex flex-col gap-1 md:w-1/6">
<label class="text-sm" for="ranobedbRating">Ranobedb ★</label>
<div class="flex withbutton">
<input pSize="small" pInputText id="ranobedbRating" formControlName="ranobedbRating" class="w-full"/>
@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>
</div>
<div class="description-section">
@@ -169,6 +169,8 @@ export class MetadataEditorComponent implements OnInit {
hardcoverReviewCount: new FormControl(""),
lubimyczytacId: new FormControl(""),
lubimyczytacRating: new FormControl(""),
ranobedbId: new FormControl(""),
ranobedbRating: new FormControl(""),
googleId: new FormControl(""),
seriesName: new FormControl(""),
seriesNumber: new FormControl(""),
@@ -201,6 +203,8 @@ export class MetadataEditorComponent implements OnInit {
hardcoverReviewCountLocked: new FormControl(false),
lubimyczytacIdLocked: new FormControl(false),
lubimyczytacRatingLocked: new FormControl(false),
ranobedbIdLocked: new FormControl(""),
ranobedbRatingLocked: new FormControl(false),
googleIdLocked: new FormControl(false),
seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false),
@@ -303,6 +307,8 @@ export class MetadataEditorComponent implements OnInit {
hardcoverReviewCount: metadata.hardcoverReviewCount ?? null,
lubimyczytacId: metadata.lubimyczytacId ?? null,
lubimyczytacRating: metadata.lubimyczytacRating ?? null,
ranobedbId: metadata.ranobedbId ?? null,
ranobedbRating: metadata.ranobedbRating ?? null,
googleId: metadata.googleId ?? null,
seriesName: metadata.seriesName ?? null,
seriesNumber: metadata.seriesNumber ?? null,
@@ -333,6 +339,8 @@ export class MetadataEditorComponent implements OnInit {
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked ?? false,
lubimyczytacIdLocked: metadata.lubimyczytacIdLocked ?? false,
lubimyczytacRatingLocked: metadata.lubimyczytacRatingLocked ?? false,
ranobedbIdLocked: metadata.ranobedbIdLocked ?? false,
ranobedbRatingLocked: metadata.ranobedbRatingLocked ?? false,
googleIdLocked: metadata.googleIdLocked ?? false,
seriesNameLocked: metadata.seriesNameLocked ?? false,
seriesNumberLocked: metadata.seriesNumberLocked ?? false,
@@ -366,6 +374,9 @@ export class MetadataEditorComponent implements OnInit {
{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: "pageCountLocked", control: "pageCount"},
{key: "descriptionLocked", control: "description"},
@@ -507,6 +518,8 @@ export class MetadataEditorComponent implements OnInit {
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,
language: form.get("language")?.value,
seriesName: form.get("seriesName")?.value,
@@ -541,6 +554,8 @@ export class MetadataEditorComponent implements OnInit {
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,
seriesNameLocked: form.get("seriesNameLocked")?.value,
seriesNumberLocked: form.get("seriesNumberLocked")?.value,
@@ -589,6 +604,8 @@ export class MetadataEditorComponent implements OnInit {
hardcoverId: wasCleared("hardcoverId"),
hardcoverRating: wasCleared("hardcoverRating"),
hardcoverReviewCount: wasCleared("hardcoverReviewCount"),
ranobedbId: wasCleared("ranobedbId"),
ranobedbRating: wasCleared("ranobedbRating"),
googleId: wasCleared("googleId"),
seriesName: wasCleared("seriesName"),
seriesNumber: wasCleared("seriesNumber"),
@@ -79,6 +79,8 @@ export class MetadataPickerComponent implements OnInit {
{label: 'HC Rating', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'LC ID', controlName: 'lubimyczytacId', lockedKey: 'lubimyczytacIdLocked', fetchedKey: 'lubimyczytacId'},
{label: 'LC Rating', controlName: 'lubimyczytacRating', lockedKey: 'lubimyczytacRatingLocked', fetchedKey: 'lubimyczytacRating'},
{label: 'Ranobedb ID', controlName: 'ranobedbId', lockedKey: 'ranobedbIdLocked', fetchedKey: 'ranobedbId'},
{label: 'RD Rating', controlName: 'ranobedbRating', lockedKey: 'ranobedbRatingLocked', fetchedKey: 'ranobedbRating'},
{label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
];
@@ -158,6 +160,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCount: new FormControl(''),
lubimyczytacId: new FormControl(''),
lubimyczytacRating: new FormControl(''),
ranobedbId: new FormControl(''),
ranobedbRating: new FormControl(''),
googleId: new FormControl(''),
seriesName: new FormControl(''),
seriesNumber: new FormControl(''),
@@ -190,6 +194,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCountLocked: new FormControl(false),
lubimyczytacIdLocked: new FormControl(false),
lubimyczytacRatingLocked: new FormControl(false),
ranobedbIdLocked: new FormControl(false),
ranobedbRatingLocked: new FormControl(false),
googleIdLocked: new FormControl(false),
seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false),
@@ -269,6 +275,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCount: metadata.hardcoverReviewCount || null,
lubimyczytacId: metadata.lubimyczytacId || null,
lubimyczytacRating: metadata.lubimyczytacRating || null,
ranobedbId: metadata.ranobedbId || null,
ranobedbRating: metadata.ranobedbRating || null,
googleId: metadata.googleId || null,
seriesName: metadata.seriesName || null,
seriesNumber: metadata.seriesNumber || null,
@@ -301,6 +309,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked || false,
lubimyczytacIdLocked: metadata.lubimyczytacIdLocked || false,
lubimyczytacRatingLocked: metadata.lubimyczytacRatingLocked || false,
ranobedbIdLocked: metadata.ranobedbIdLocked || false,
ranobedbRatingLocked: metadata.ranobedbRatingLocked || false,
googleIdLocked: metadata.googleIdLocked || false,
seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false,
@@ -340,6 +350,8 @@ export class MetadataPickerComponent implements OnInit {
if (metadata.hardcoverRatingLocked) this.metadataForm.get('hardcoverRating')?.disable({emitEvent: false});
if (metadata.lubimyczytacIdLocked) this.metadataForm.get('lubimyczytacId')?.disable({emitEvent: false});
if (metadata.lubimyczytacRatingLocked) this.metadataForm.get('lubimyczytacRating')?.disable({emitEvent: false});
if (metadata.ranobedbIdLocked) this.metadataForm.get('ranobedbId')?.disable({emitEvent: false});
if (metadata.ranobedbRatingLocked) this.metadataForm.get('ranobedbRating')?.disable({emitEvent: false});
if (metadata.googleIdLocked) this.metadataForm.get('googleId')?.disable({emitEvent: false});
if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable({emitEvent: false});
if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable({emitEvent: false});
@@ -421,6 +433,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCount: this.metadataForm.get('hardcoverReviewCount')?.value || this.copiedFields['hardcoverReviewCount'] ? this.getNumberOrCopied('hardcoverReviewCount') : null,
lubimyczytacId: this.metadataForm.get('lubimyczytacId')?.value || this.copiedFields['lubimyczytacId'] ? this.getValueOrCopied('lubimyczytacId') : '',
lubimyczytacRating: this.metadataForm.get('lubimyczytacRating')?.value || this.copiedFields['lubimyczytacRating'] ? this.getNumberOrCopied('lubimyczytacRating') : null,
ranobedbId: this.metadataForm.get('ranobedbId')?.value || this.copiedFields['ranobedbId'] ? this.getValueOrCopied('ranobedbId') : '',
ranobedbRating: this.metadataForm.get('ranobedbRating')?.value || this.copiedFields['ranobedbRating'] ? this.getNumberOrCopied('ranobedbRating') : null,
googleId: this.metadataForm.get('googleId')?.value || this.copiedFields['googleId'] ? this.getValueOrCopied('googleId') : '',
seriesName: this.metadataForm.get('seriesName')?.value || this.copiedFields['seriesName'] ? this.getValueOrCopied('seriesName') : '',
seriesNumber: this.metadataForm.get('seriesNumber')?.value || this.copiedFields['seriesNumber'] ? this.getNumberOrCopied('seriesNumber') : null,
@@ -453,6 +467,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCountLocked: this.metadataForm.get('hardcoverReviewCountLocked')?.value,
lubimyczytacIdLocked: this.metadataForm.get('lubimyczytacIdLocked')?.value,
lubimyczytacRatingLocked: this.metadataForm.get('lubimyczytacRatingLocked')?.value,
ranobedbIdLocked: this.metadataForm.get('ranobedbIdLocked')?.value,
ranobedbRatingLocked: this.metadataForm.get('ranobedbRatingLocked')?.value,
googleIdLocked: this.metadataForm.get('googleIdLocked')?.value,
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
@@ -498,6 +514,8 @@ export class MetadataPickerComponent implements OnInit {
hardcoverReviewCount: current.hardcoverReviewCount === null && original.hardcoverReviewCount !== null,
lubimyczytacId: !current.lubimyczytacId && !!original.lubimyczytacId,
lubimyczytacRating: current.lubimyczytacRating === null && original.lubimyczytacRating !== null,
ranobedbId: !current.ranobedbId && !!original.ranobedbId,
ranobedbRating: current.ranobedbRating === null && original.ranobedbRating !== null,
googleId: !current.googleId && !!original.googleId,
seriesName: !current.seriesName && !!original.seriesName,
seriesNumber: current.seriesNumber === null && original.seriesNumber !== null,
@@ -5,7 +5,8 @@ $provider-colors: (
'hardcover': #6366F1,
'douban': #1474E9,
'lubimyczytac': #FF5501,
'comicvine': #F9E04F
'comicvine': #F9E04F,
'ranobedb': #06b6d4
);
.metadata-container {
@@ -252,6 +252,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
if (metadata['doubanId']) return 'douban';
if (metadata['lubimyczytacId']) return 'lubimyczytac';
if (metadata.comicvineId) return 'comicvine';
if (metadata.ranobedbId) return 'ranobedb';
return null;
}
@@ -362,6 +363,8 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
}
const name = metadata.seriesName;
return `<a href="https://comicvine.gamespot.com/volume/${metadata.comicvineId}" target="_blank">Comicvine</a>`;
} else if (metadata.ranobedbId) {
return `<a href="https://ranobedb.org/book/${metadata.ranobedbId}" target="_blank">RanobeDB</a>`;
}
throw new Error("No provider ID found in metadata.");
}
@@ -154,7 +154,7 @@
</p-button>
</div>
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.lubimyczytacRating || book?.metadata?.googleId) {
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.lubimyczytacRating || book?.metadata?.ranobedbRating || book?.metadata?.googleId) {
<div class="gradient-divider"></div>
}
@@ -215,6 +215,20 @@
</a>
}
@if (book?.metadata?.ranobedbRating) {
<a
class="rating-link"
[href]="'https://ranobedb.org/book/' + (book.metadata?.ranobedbId ?? '')"
target="_blank"
rel="noopener noreferrer"
[pTooltip]="getRatingTooltip(book, 'ranobedb')"
tooltipPosition="top"
>
<img src="https://www.ranobedb.org/favicon.png" alt="Ranobedb" class="rating-favicon"/>
<span class="rating-value">{{ getRatingPercent(book.metadata!.ranobedbRating) }}%</span>
</a>
}
@if (book?.metadata?.googleId) {
<a
class="rating-link"
@@ -809,7 +809,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
return p != null ? Math.round(p * 10) / 10 : null;
}
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover' | 'lubimyczytac'): string {
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover' | 'lubimyczytac' | 'ranobedb'): string {
const meta = book?.metadata;
if (!meta) return '';
@@ -830,6 +830,10 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
return meta.lubimyczytacRating != null
? `★ ${meta.lubimyczytacRating}`
: '';
case 'ranobedb':
return meta.ranobedbRating != null
? `★ ${meta.ranobedbRating}`
: '';
default:
return '';
}
@@ -25,16 +25,16 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate',
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover', 'pageCount',
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating',
'moods', 'tags'
];
providerSpecificFields: (keyof FieldOptions)[] = [
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating',
'moods', 'tags'
];
@@ -44,8 +44,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'language', 'categories', 'cover', 'pageCount',
];
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac'];
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac'];
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb'];
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac', 'Ranobedb'];
refreshCovers: boolean = false;
mergeCategories: boolean = false;
@@ -64,9 +64,9 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
private justSubmitted = false;
private providerSpecificFieldsList = [
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
'asin', 'goodreadsId','comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating',
'moods', 'tags'
];
@@ -233,6 +233,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'hardcoverReviewCount': 'Hardcover Review Count',
'lubimyczytacId': 'LC ID',
'lubimyczytacRating': 'Lubimyczytac Rating',
'ranobedbId': 'Ranobedb ID',
'ranobedbRating': 'Ranobedb Rating',
'moods': 'Moods (Hardcover)',
'tags': 'Tags (Hardcover)'
};
@@ -43,6 +43,8 @@ export interface FieldOptions {
hardcoverRating: FieldProvider;
hardcoverReviewCount: FieldProvider;
lubimyczytacRating: FieldProvider;
ranobedbId: FieldProvider;
ranobedbRating: FieldProvider;
moods: FieldProvider;
tags: FieldProvider;
}
@@ -44,7 +44,8 @@ export class MetadataMatchWeightsComponent implements OnInit {
goodreadsRating: 'Goodreads Rating',
goodreadsReviewCount: 'Goodreads Rating #',
hardcoverRating: 'Hardcover Rating',
hardcoverReviewCount: 'Hardcover Rating #'
hardcoverReviewCount: 'Hardcover Rating #',
ranobedbRating: 'Ranobedb Rating',
};
form!: FormGroup;
@@ -79,6 +80,7 @@ export class MetadataMatchWeightsComponent implements OnInit {
goodreadsReviewCount: [0, [Validators.required, Validators.min(0)]],
hardcoverRating: [0, [Validators.required, Validators.min(0)]],
hardcoverReviewCount: [0, [Validators.required, Validators.min(0)]],
ranobedbRating: [0, [Validators.required, Validators.min(0)]],
coverImage: [0, [Validators.required, Validators.min(0)]],
});
this.appSettings$
@@ -154,6 +154,15 @@
</div>
</div>
</div>
<div class="provider-item">
<div class="provider-control">
<div class="provider-info">
<p-checkbox [(ngModel)]="ranobedbEnabled" [binary]="true"></p-checkbox>
<label class="provider-label">Ranobedb</label>
</div>
</div>
</div>
</div>
<div class="setting-actions">
@@ -77,6 +77,7 @@ export class MetadataProviderSettingsComponent implements OnInit {
comicvineToken: string = '';
doubanEnabled: boolean = false;
lubimyCzytacEnabled: boolean = false;
ranobedbEnabled: boolean = false;
private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService);
@@ -103,6 +104,7 @@ export class MetadataProviderSettingsComponent implements OnInit {
this.comicvineToken = metadataProviderSettings?.comicvine?.apiKey ?? '';
this.doubanEnabled = metadataProviderSettings?.douban?.enabled ?? false;
this.lubimyCzytacEnabled = metadataProviderSettings?.lubimyczytac?.enabled ?? false;
this.ranobedbEnabled = metadataProviderSettings?.ranobedb?.enabled ?? false;
});
}
@@ -146,7 +148,8 @@ export class MetadataProviderSettingsComponent implements OnInit {
apiKey: this.hardcoverToken.trim()
},
douban: {enabled: this.doubanEnabled},
lubimyczytac: {enabled: this.lubimyCzytacEnabled}
lubimyczytac: {enabled: this.lubimyCzytacEnabled},
ranobedb: {enabled: this.ranobedbEnabled}
}
}
];
@@ -217,6 +217,8 @@ export class LibraryMetadataSettingsComponent implements OnInit {
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},
moods: {p1: null, p2: null, p3: null, p4: null},
tags: {p1: null, p2: null, p3: null, p4: null}
}
@@ -47,6 +47,7 @@ export class ViewPreferencesComponent implements OnInit, OnDestroy {
{label: 'Goodreads #', field: 'goodreadsReviewCount'},
{label: 'Hardcover Rating', field: 'hardcoverRating'},
{label: 'Hardcover #', field: 'hardcoverReviewCount'},
{label: 'Ranobedb Rating', field: 'ranobedbRating'},
{label: 'Pages', field: 'pageCount'},
{label: 'Random', field: 'random'},
];
@@ -280,6 +280,7 @@ export class AuthorPopularityChartService implements OnDestroy {
if (book.metadata?.goodreadsRating) ratings.push(book.metadata.goodreadsRating);
if (book.metadata?.amazonRating) ratings.push(book.metadata.amazonRating);
if (book.metadata?.hardcoverRating) ratings.push(book.metadata.hardcoverRating);
if (book.metadata?.ranobedbRating) ratings.push(book.metadata.ranobedbRating);
if (book.personalRating) ratings.push(book.personalRating);
if (ratings.length > 0) {
@@ -247,6 +247,7 @@ export class BookRatingChartService implements OnDestroy {
if (book.metadata?.goodreadsRating) ratings.push(book.metadata.goodreadsRating);
if (book.metadata?.amazonRating) ratings.push(book.metadata.amazonRating);
if (book.metadata?.hardcoverRating) ratings.push(book.metadata.hardcoverRating);
if (book.metadata?.ranobedbRating) ratings.push(book.metadata.ranobedbRating);
if (ratings.length > 0) {
return ratings.reduce((sum, rating) => sum + rating, 0) / ratings.length;