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:
+7
-3
@@ -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,
|
||||
|
||||
+10
-6
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user