Feat/lubimyczytac metadata provider (#2019)
* feat: add LubimyCzytac metadata provider - Add LubimyCzytac parser with web scraping for lubimyczytac.pl - Extract book metadata including title, authors, description, ratings - Parse JSON-LD structured data for reliable metadata extraction - Add database migration with columns and JSON property name updates - Add comprehensive test coverage for parser * feat: add LubimyCzytac UI integration - Add LC ID and LC Rating fields to metadata picker - Update settings page with Lubimyczytac provider toggle - Add LubimyCzytac to metadata searcher provider list - Display Lubimyczytac in all metadata viewer sections - Add Lubimyczytac to advanced fetch options - Update TypeScript models to match backend serialization
This commit is contained in:
+24
@@ -507,6 +507,30 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label class="text-sm" for="lubimyczytacId">LC ID</label>
|
||||
<div class="flex withbutton">
|
||||
<input pSize="small" pInputText id="lubimyczytacId" formControlName="lubimyczytacId" class="w-full"/>
|
||||
@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>
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label class="text-sm" for="lubimyczytacRating">LC ★</label>
|
||||
<div class="flex withbutton">
|
||||
<input pSize="small" pInputText id="lubimyczytacRating" formControlName="lubimyczytacRating" class="w-full"/>
|
||||
@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>
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label class="text-sm" for="comicvineId">Comicvine ID</label>
|
||||
<div class="flex withbutton">
|
||||
|
||||
+8
@@ -166,6 +166,8 @@ export class MetadataEditorComponent implements OnInit {
|
||||
hardcoverBookId: new FormControl(""),
|
||||
hardcoverRating: new FormControl(""),
|
||||
hardcoverReviewCount: new FormControl(""),
|
||||
lubimyczytacId: new FormControl(""),
|
||||
lubimyczytacRating: new FormControl(""),
|
||||
googleId: new FormControl(""),
|
||||
seriesName: new FormControl(""),
|
||||
seriesNumber: new FormControl(""),
|
||||
@@ -196,6 +198,8 @@ export class MetadataEditorComponent implements OnInit {
|
||||
hardcoverBookIdLocked: new FormControl(false),
|
||||
hardcoverRatingLocked: new FormControl(false),
|
||||
hardcoverReviewCountLocked: new FormControl(false),
|
||||
lubimyczytacIdLocked: new FormControl(false),
|
||||
lubimyczytacRatingLocked: new FormControl(false),
|
||||
googleIdLocked: new FormControl(false),
|
||||
seriesNameLocked: new FormControl(false),
|
||||
seriesNumberLocked: new FormControl(false),
|
||||
@@ -296,6 +300,8 @@ export class MetadataEditorComponent implements OnInit {
|
||||
hardcoverBookId: metadata.hardcoverBookId ?? null,
|
||||
hardcoverRating: metadata.hardcoverRating ?? null,
|
||||
hardcoverReviewCount: metadata.hardcoverReviewCount ?? null,
|
||||
lubimyczytacId: metadata.lubimyczytacId ?? null,
|
||||
lubimyczytacRating: metadata.lubimyczytacRating ?? null,
|
||||
googleId: metadata.googleId ?? null,
|
||||
seriesName: metadata.seriesName ?? null,
|
||||
seriesNumber: metadata.seriesNumber ?? null,
|
||||
@@ -324,6 +330,8 @@ export class MetadataEditorComponent implements OnInit {
|
||||
hardcoverBookIdLocked: metadata.hardcoverBookIdLocked ?? false,
|
||||
hardcoverRatingLocked: metadata.hardcoverRatingLocked ?? false,
|
||||
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked ?? false,
|
||||
lubimyczytacIdLocked: metadata.lubimyczytacIdLocked ?? false,
|
||||
lubimyczytacRatingLocked: metadata.lubimyczytacRatingLocked ?? false,
|
||||
googleIdLocked: metadata.googleIdLocked ?? false,
|
||||
seriesNameLocked: metadata.seriesNameLocked ?? false,
|
||||
seriesNumberLocked: metadata.seriesNumberLocked ?? false,
|
||||
|
||||
+18
@@ -76,6 +76,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
{label: 'Hardcover Book ID', controlName: 'hardcoverBookId', lockedKey: 'hardcoverBookIdLocked', fetchedKey: 'hardcoverBookId'},
|
||||
{label: 'HC Reviews', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
|
||||
{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: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'},
|
||||
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
|
||||
];
|
||||
@@ -153,6 +155,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookId: new FormControl(''),
|
||||
hardcoverRating: new FormControl(''),
|
||||
hardcoverReviewCount: new FormControl(''),
|
||||
lubimyczytacId: new FormControl(''),
|
||||
lubimyczytacRating: new FormControl(''),
|
||||
googleId: new FormControl(''),
|
||||
seriesName: new FormControl(''),
|
||||
seriesNumber: new FormControl(''),
|
||||
@@ -183,6 +187,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookIdLocked: new FormControl(false),
|
||||
hardcoverRatingLocked: new FormControl(false),
|
||||
hardcoverReviewCountLocked: new FormControl(false),
|
||||
lubimyczytacIdLocked: new FormControl(false),
|
||||
lubimyczytacRatingLocked: new FormControl(false),
|
||||
googleIdLocked: new FormControl(false),
|
||||
seriesNameLocked: new FormControl(false),
|
||||
seriesNumberLocked: new FormControl(false),
|
||||
@@ -260,6 +266,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookId: metadata.hardcoverBookId || null,
|
||||
hardcoverRating: metadata.hardcoverRating || null,
|
||||
hardcoverReviewCount: metadata.hardcoverReviewCount || null,
|
||||
lubimyczytacId: metadata.lubimyczytacId || null,
|
||||
lubimyczytacRating: metadata.lubimyczytacRating || null,
|
||||
googleId: metadata.googleId || null,
|
||||
seriesName: metadata.seriesName || null,
|
||||
seriesNumber: metadata.seriesNumber || null,
|
||||
@@ -290,6 +298,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookIdLocked: metadata.hardcoverBookIdLocked || false,
|
||||
hardcoverRatingLocked: metadata.hardcoverRatingLocked || false,
|
||||
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked || false,
|
||||
lubimyczytacIdLocked: metadata.lubimyczytacIdLocked || false,
|
||||
lubimyczytacRatingLocked: metadata.lubimyczytacRatingLocked || false,
|
||||
googleIdLocked: metadata.googleIdLocked || false,
|
||||
seriesNameLocked: metadata.seriesNameLocked || false,
|
||||
seriesNumberLocked: metadata.seriesNumberLocked || false,
|
||||
@@ -327,6 +337,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
if (metadata.hardcoverBookIdLocked) this.metadataForm.get('hardcoverBookId')?.disable({emitEvent: false});
|
||||
if (metadata.hardcoverReviewCountLocked) this.metadataForm.get('hardcoverReviewCount')?.disable({emitEvent: false});
|
||||
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.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});
|
||||
@@ -406,6 +418,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookId: this.metadataForm.get('hardcoverBookId')?.value || this.copiedFields['hardcoverBookId'] ? (this.getNumberOrCopied('hardcoverBookId') ?? null) : null,
|
||||
hardcoverRating: this.metadataForm.get('hardcoverRating')?.value || this.copiedFields['hardcoverRating'] ? this.getNumberOrCopied('hardcoverRating') : null,
|
||||
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,
|
||||
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,
|
||||
@@ -436,6 +450,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookIdLocked: this.metadataForm.get('hardcoverBookIdLocked')?.value,
|
||||
hardcoverRatingLocked: this.metadataForm.get('hardcoverRatingLocked')?.value,
|
||||
hardcoverReviewCountLocked: this.metadataForm.get('hardcoverReviewCountLocked')?.value,
|
||||
lubimyczytacIdLocked: this.metadataForm.get('lubimyczytacIdLocked')?.value,
|
||||
lubimyczytacRatingLocked: this.metadataForm.get('lubimyczytacRatingLocked')?.value,
|
||||
googleIdLocked: this.metadataForm.get('googleIdLocked')?.value,
|
||||
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
|
||||
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
|
||||
@@ -479,6 +495,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
hardcoverBookId: current.hardcoverBookId === null && original.hardcoverBookId !== null,
|
||||
hardcoverRating: current.hardcoverRating === null && original.hardcoverRating !== null,
|
||||
hardcoverReviewCount: current.hardcoverReviewCount === null && original.hardcoverReviewCount !== null,
|
||||
lubimyczytacId: !current.lubimyczytacId && !!original.lubimyczytacId,
|
||||
lubimyczytacRating: current.lubimyczytacRating === null && original.lubimyczytacRating !== null,
|
||||
googleId: !current.googleId && !!original.googleId,
|
||||
seriesName: !current.seriesName && !!original.seriesName,
|
||||
seriesNumber: current.seriesNumber === null && original.seriesNumber !== null,
|
||||
|
||||
+2
@@ -189,6 +189,8 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
|
||||
return `<a href="https://hardcover.app/books/${metadata.hardcoverId}" target="_blank">Hardcover</a>`;
|
||||
} else if (metadata['doubanId']) {
|
||||
return `<a href="https://book.douban.com/subject/${metadata['doubanId']}" target="_blank">Douban</a>`;
|
||||
} else if (metadata['lubimyczytacId']) {
|
||||
return `<a href="https://lubimyczytac.pl/ksiazka/${metadata['lubimyczytacId']}" target="_blank">Lubimyczytac</a>`;
|
||||
} else if (metadata.comicvineId) {
|
||||
if (metadata.comicvineId.startsWith('4000')) {
|
||||
const name = metadata.seriesName ? metadata.seriesName.replace(/ /g, '-').toLowerCase() + "-" + metadata.seriesNumber : '';
|
||||
|
||||
+15
-1
@@ -154,7 +154,7 @@
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.googleId) {
|
||||
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.lubimyczytacRating || book?.metadata?.googleId) {
|
||||
<div class="gradient-divider"></div>
|
||||
}
|
||||
|
||||
@@ -201,6 +201,20 @@
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.lubimyczytacRating) {
|
||||
<a
|
||||
class="rating-link"
|
||||
[href]="'https://lubimyczytac.pl/ksiazka/' + (book.metadata?.lubimyczytacId ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'lubimyczytac')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img src="https://lubimyczytac.pl/favicon.ico" alt="Lubimyczytac" class="rating-favicon"/>
|
||||
<span class="rating-value">{{ getRatingPercent(book.metadata!.lubimyczytacRating) }}%</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.googleId) {
|
||||
<a
|
||||
class="rating-link"
|
||||
|
||||
+5
-1
@@ -788,7 +788,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
return p != null ? Math.round(p * 10) / 10 : null;
|
||||
}
|
||||
|
||||
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover'): string {
|
||||
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover' | 'lubimyczytac'): string {
|
||||
const meta = book?.metadata;
|
||||
if (!meta) return '';
|
||||
|
||||
@@ -805,6 +805,10 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
return meta.hardcoverRating != null
|
||||
? `★ ${meta.hardcoverRating} | ${meta.hardcoverReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
case 'lubimyczytac':
|
||||
return meta.lubimyczytacRating != null
|
||||
? `★ ${meta.lubimyczytacRating}`
|
||||
: '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
+13
-8
@@ -25,15 +25,17 @@ 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',
|
||||
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
|
||||
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags'
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
|
||||
'moods', 'tags'
|
||||
];
|
||||
|
||||
providerSpecificFields: (keyof FieldOptions)[] = [
|
||||
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId',
|
||||
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
|
||||
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags'
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
|
||||
'moods', 'tags'
|
||||
];
|
||||
|
||||
nonProviderSpecificFields: (keyof FieldOptions)[] = [
|
||||
@@ -42,8 +44,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'language', 'categories', 'cover', 'pageCount',
|
||||
];
|
||||
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban'];
|
||||
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban'];
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac'];
|
||||
providersWithClear: string[] = ['Clear All', 'Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban', 'Lubimyczytac'];
|
||||
|
||||
refreshCovers: boolean = false;
|
||||
mergeCategories: boolean = false;
|
||||
@@ -62,9 +64,10 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
private justSubmitted = false;
|
||||
|
||||
private providerSpecificFieldsList = [
|
||||
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId',
|
||||
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId',
|
||||
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags'
|
||||
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating',
|
||||
'moods', 'tags'
|
||||
];
|
||||
|
||||
private initializeFieldOptions(): FieldOptions {
|
||||
@@ -228,6 +231,8 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'goodreadsReviewCount': 'Goodreads Review Count',
|
||||
'hardcoverRating': 'Hardcover Rating',
|
||||
'hardcoverReviewCount': 'Hardcover Review Count',
|
||||
'lubimyczytacId': 'LC ID',
|
||||
'lubimyczytacRating': 'Lubimyczytac Rating',
|
||||
'moods': 'Moods (Hardcover)',
|
||||
'tags': 'Tags (Hardcover)'
|
||||
};
|
||||
|
||||
@@ -35,12 +35,14 @@ export interface FieldOptions {
|
||||
comicvineId: FieldProvider;
|
||||
hardcoverId: FieldProvider;
|
||||
googleId: FieldProvider;
|
||||
lubimyczytacId: FieldProvider;
|
||||
amazonRating: FieldProvider;
|
||||
amazonReviewCount: FieldProvider;
|
||||
goodreadsRating: FieldProvider;
|
||||
goodreadsReviewCount: FieldProvider;
|
||||
hardcoverRating: FieldProvider;
|
||||
hardcoverReviewCount: FieldProvider;
|
||||
lubimyczytacRating: FieldProvider;
|
||||
moods: FieldProvider;
|
||||
tags: FieldProvider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user