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
@@ -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;
}