Feature: Add Comicvine to metadata providers. (#804)

* added comcivine
* updated comicvine schema
* added comic vine support
* changed SQL changes
* fixed init provider bug
* updated changes for Flyway migration.

---------

Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
This commit is contained in:
Rprasad2400
2025-08-06 11:29:12 -06:00
committed by GitHub
co-authored by Aditya Chandel
parent e027225775
commit 46f86deb24
40 changed files with 610 additions and 7 deletions
@@ -32,7 +32,8 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
'isbn13Locked', 'isbn10Locked', 'asinLocked', 'pageCountLocked', 'thumbnailLocked', 'languageLocked', 'coverLocked',
'seriesNameLocked', 'seriesNumberLocked', 'seriesTotalLocked', 'authorsLocked', 'categoriesLocked',
'amazonRatingLocked', 'amazonReviewCountLocked', 'goodreadsRatingLocked', 'goodreadsReviewCountLocked',
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'googleIdLocked'
'hardcoverRatingLocked', 'hardcoverReviewCountLocked', 'goodreadsIdLocked', 'hardcoverIdLocked', 'googleIdLocked',
'comicvineIdLocked'
];
fieldLabels: Record<string, string> = {
@@ -62,6 +63,7 @@ export class LockUnlockMetadataDialogComponent implements OnInit {
goodreadsIdLocked: 'Goodreads ID',
hardcoverIdLocked: 'Hardcover ID',
googleIdLocked: 'Google ID',
comicvineIdLocked: 'Comicvine ID',
};
isSaving = false;
@@ -65,6 +65,9 @@
@if (backupMetadata.amazonReviewCount !== null) {
<div><strong>Amazon Review Count:</strong> {{ backupMetadata.amazonReviewCount }}</div>
}
@if (backupMetadata.comicvineId) {
<div><strong>Comicvine ID:</strong> {{ backupMetadata.comicvineId }}</div>
}
@if (backupMetadata.goodreadsId) {
<div><strong>Goodreads ID:</strong> {{ backupMetadata.goodreadsId }}</div>
}
@@ -54,6 +54,7 @@ export interface BookMetadata {
isbn10?: string;
asin?: string;
goodreadsId?: string;
comicvineId?: string;
hardcoverId?: string;
googleId?: string;
pageCount?: number | null;
@@ -85,6 +86,7 @@ export interface BookMetadata {
isbn13Locked?: boolean;
isbn10Locked?: boolean;
asinLocked?: boolean;
comicvineIdLocked?: boolean;
goodreadsIdLocked?: boolean;
hardcoverIdLocked?: boolean;
googleIdLocked?: boolean;
@@ -118,6 +120,7 @@ export interface MetadataClearFlags {
isbn10?: boolean;
asin?: boolean;
goodreadsId?: boolean;
comicvineId?: boolean;
hardcoverId?: boolean;
googleId?: boolean;
pageCount?: boolean;
@@ -68,6 +68,7 @@ export class BookdropFileMetadataPickerComponent {
{label: 'HC Reviews', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
{label: 'HC Rating', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleIdRating'},
{label: 'CV ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
];
@@ -155,6 +156,7 @@ export class BookdropFileMetadataPickerComponent {
hardcoverRating: this.originalMetadata.hardcoverRating || null,
hardcoverReviewCount: this.originalMetadata.hardcoverReviewCount || null,
googleId: this.originalMetadata.googleId || null,
comicvineId: this.originalMetadata.comicvineId || null,
seriesName: this.originalMetadata.seriesName || null,
seriesNumber: this.originalMetadata.seriesNumber || null,
seriesTotal: this.originalMetadata.seriesTotal || null,
@@ -252,6 +252,7 @@ export class BookdropFileReviewComponent implements OnInit {
hardcoverRating: original.hardcoverRating ?? null,
hardcoverReviewCount: original.hardcoverReviewCount ?? null,
googleId: original.googleId ?? null,
comicvineId: original.comicvineId ?? null,
seriesName: original.seriesName ?? null,
seriesNumber: original.seriesNumber ?? null,
seriesTotal: original.seriesTotal ?? null,
@@ -495,6 +496,7 @@ export class BookdropFileReviewComponent implements OnInit {
hardcoverRating: new FormControl(original.hardcoverRating ?? ''),
hardcoverReviewCount: new FormControl(original.hardcoverReviewCount ?? ''),
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 ?? ''),
@@ -46,6 +46,7 @@ export interface MetadataProviderSettings {
google: Google;
goodReads: Goodreads;
hardcover: Hardcover;
comicvine: Comicvine;
}
export interface Amazon {
@@ -66,7 +67,10 @@ export interface Hardcover {
enabled: boolean;
apiKey: string;
}
export interface Comicvine {
enabled: boolean;
apiKey: string;
}
export interface MetadataPersistenceSettings {
saveToOriginalFile: boolean;
backupMetadata: boolean;
@@ -355,6 +355,18 @@
}
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="comicvineId">Comicvine ID</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="comicvineId" formControlName="comicvineId" class="w-full"/>
@if (!book.metadata!['comicvineIdLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('comicvineId')" severity="success"></p-button>
}
@if (book.metadata!['comicvineIdLocked']) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('comicvineId')" severity="warn"></p-button>
}
</div>
</div>
</div>
</div>
</div>
@@ -97,6 +97,7 @@ export class MetadataEditorComponent implements OnInit {
amazonRating: new FormControl(''),
amazonReviewCount: new FormControl(''),
goodreadsId: new FormControl(''),
comicvineId: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
hardcoverId: new FormControl(''),
@@ -123,6 +124,7 @@ export class MetadataEditorComponent implements OnInit {
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),
@@ -189,6 +191,7 @@ export class MetadataEditorComponent implements OnInit {
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,
@@ -214,6 +217,7 @@ export class MetadataEditorComponent implements OnInit {
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,
@@ -241,6 +245,7 @@ export class MetadataEditorComponent implements OnInit {
{key: 'amazonRatingLocked', control: 'amazonRating'},
{key: 'personalRatingLocked', control: 'personalRating'},
{key: 'goodreadsIdLocked', control: 'goodreadsId'},
{key: 'comicvineIdLocked', control: 'comicvineId'},
{key: 'goodreadsReviewCountLocked', control: 'goodreadsReviewCount'},
{key: 'goodreadsRatingLocked', control: 'goodreadsRating'},
{key: 'hardcoverIdLocked', control: 'hardcoverId'},
@@ -352,6 +357,7 @@ export class MetadataEditorComponent implements OnInit {
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,
@@ -380,6 +386,7 @@ export class MetadataEditorComponent implements OnInit {
personalRatingLocked: form.get('personalRatingLocked')?.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,
@@ -423,6 +430,7 @@ export class MetadataEditorComponent implements OnInit {
amazonRating: wasCleared('personalRating'),
amazonReviewCount: wasCleared('amazonReviewCount'),
goodreadsId: wasCleared('goodreadsId'),
comicvineId: wasCleared('comicvineId'),
goodreadsRating: wasCleared('goodreadsRating'),
goodreadsReviewCount: wasCleared('goodreadsReviewCount'),
hardcoverId: wasCleared('hardcoverId'),
@@ -62,6 +62,7 @@ export class MetadataPickerComponent implements OnInit {
{label: 'Amz Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
{label: 'Amz Rating', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating'},
{label: 'GR ID', controlName: 'goodreadsId', lockedKey: 'goodreadsIdLocked', fetchedKey: 'goodreadsId'},
{label: 'CV ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId'},
{label: 'GR Reviews', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'GR Rating', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'HC ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId'},
@@ -105,6 +106,7 @@ export class MetadataPickerComponent implements OnInit {
amazonRating: new FormControl(''),
amazonReviewCount: new FormControl(''),
goodreadsId: new FormControl(''),
comicvineId: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
hardcoverId: new FormControl(''),
@@ -132,6 +134,7 @@ export class MetadataPickerComponent implements OnInit {
amazonRatingLocked: new FormControl(false),
amazonReviewCountLocked: new FormControl(false),
goodreadsIdLocked: new FormControl(false),
comicvineIdLocked: new FormControl(false),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
hardcoverIdLocked: new FormControl(false),
@@ -180,6 +183,7 @@ export class MetadataPickerComponent implements OnInit {
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,
@@ -207,6 +211,7 @@ export class MetadataPickerComponent implements OnInit {
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,
@@ -287,6 +292,7 @@ export class MetadataPickerComponent implements OnInit {
amazonRating: this.metadataForm.get('amazonRating')?.value || this.copiedFields['amazonRating'] ? this.getNumberOrCopied('amazonRating') : null,
amazonReviewCount: this.metadataForm.get('amazonReviewCount')?.value || this.copiedFields['amazonReviewCount'] ? this.getNumberOrCopied('amazonReviewCount') : null,
goodreadsId: this.metadataForm.get('goodreadsId')?.value || this.copiedFields['goodreadsId'] ? this.getValueOrCopied('goodreadsId') : '',
comicvineId: this.metadataForm.get('comicvineId')?.value || this.copiedFields['comicvineId'] ? this.getValueOrCopied('comicvineId') : '',
goodreadsRating: this.metadataForm.get('goodreadsRating')?.value || this.copiedFields['goodreadsRating'] ? this.getNumberOrCopied('goodreadsRating') : null,
goodreadsReviewCount: this.metadataForm.get('goodreadsReviewCount')?.value || this.copiedFields['goodreadsReviewCount'] ? this.getNumberOrCopied('goodreadsReviewCount') : null,
hardcoverId: this.metadataForm.get('hardcoverId')?.value || this.copiedFields['hardcoverId'] ? this.getValueOrCopied('hardcoverId') : '',
@@ -314,6 +320,7 @@ export class MetadataPickerComponent implements OnInit {
amazonRatingLocked: this.metadataForm.get('amazonRatingLocked')?.value,
amazonReviewCountLocked: this.metadataForm.get('amazonReviewCountLocked')?.value,
goodreadsIdLocked: this.metadataForm.get('goodreadsIdLocked')?.value,
comicvineIdLocked: this.metadataForm.get('comicvineIdLocked')?.value,
goodreadsRatingLocked: this.metadataForm.get('goodreadsRatingLocked')?.value,
goodreadsReviewCountLocked: this.metadataForm.get('goodreadsReviewCountLocked')?.value,
hardcoverIdLocked: this.metadataForm.get('hardcoverIdLocked')?.value,
@@ -353,6 +360,7 @@ export class MetadataPickerComponent implements OnInit {
amazonRating: current.amazonRating === null && original.amazonRating !== null,
amazonReviewCount: current.amazonReviewCount === null && original.amazonReviewCount !== null,
goodreadsId: !current.goodreadsId && !!original.goodreadsId,
comicvineId: !current.comicvineId && !!original.comicvineId,
goodreadsRating: current.goodreadsRating === null && original.goodreadsRating !== null,
goodreadsReviewCount: current.goodreadsReviewCount === null && original.goodreadsReviewCount !== null,
hardcoverId: !current.hardcoverId && !!original.hardcoverId,
@@ -183,7 +183,14 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
} else if (metadata.hardcoverId) {
return `<a href="https://hardcover.app/books/${metadata.hardcoverId}" target="_blank">Hardcover</a>`;
}
else if (metadata.comicvineId) {
if( metadata.comicvineId.startsWith('4000')) {
const name = metadata.seriesName ? metadata.seriesName.replace(/ /g, '-').toLowerCase() + "-" + metadata.seriesNumber : '';
return `<a href="https://comicvine.gamespot.com/${name}/${metadata.comicvineId}" target="_blank">Comicvine</a>`;
}
const name = metadata.seriesName;
return `<a href="https://comicvine.gamespot.com/volume/${metadata.comicvineId}" target="_blank">Comicvine</a>`;
}
throw new Error("No provider ID found in metadata.");
}
}
@@ -181,9 +181,25 @@
/>
</a>
}
@if (book?.metadata?.comicvineId) {
<a
class="flex items-center gap-1"
[href]="'https://comicvine.gamespot.com/' + book.metadata!.comicvineId"
target="_blank"
rel="noopener noreferrer"
>
<img
src="https://www.comicvine.com/favicon.ico"
alt="Comic Vine"
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
/>
</a>
}
</div>
</div>
@if (book?.metadata?.categories?.length) {
<div class="overflow-x-auto scrollbar-hide max-w-7xl pt-2 md:pt-0">
<div class="flex gap-2 w-max max-w-[1150px]">
@@ -32,7 +32,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover'
];
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover'];
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine'];
refreshCovers: boolean = false;
mergeCategories: boolean = false;
@@ -52,6 +52,7 @@
<p-checkbox [(ngModel)]="googleEnabled" [binary]="true"></p-checkbox>
<label class="font-medium">Google</label>
</div>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-4">
@@ -72,7 +73,33 @@
[(ngModel)]="hardcoverToken"
(ngModelChange)="onTokenChange($event)" />
</div>
</div>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-4">
<p-checkbox
[binary]="true"
[(ngModel)]="comicvineEnabled"
[disabled]="!comicvineToken">
</p-checkbox>
<label class="font-medium">Comic Vine</label>
</div>
<div class="flex flex-col gap-2 pl-9 pt-1">
<label class="font-medium text-sm">API Token</label>
<input
type="text"
pInputText
placeholder="Enter Comic Vine API token"
class="w-full max-w-3xl"
[(ngModel)]="comicvineToken"
(ngModelChange)="onComicTokenChange($event)" />
</div>
</div>
</div>
<div class="flex justify-start px-4">
@@ -58,6 +58,8 @@ export class MetadataProviderSettingsComponent implements OnInit {
amazonEnabled: boolean = false;
goodreadsEnabled: boolean = false;
googleEnabled: boolean = false;
comicvineEnabled: boolean = false;
comicvineToken: string = '';
private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService);
@@ -79,6 +81,8 @@ export class MetadataProviderSettingsComponent implements OnInit {
this.googleEnabled = metadataProviderSettings?.google?.enabled ?? false;
this.hardcoverToken = metadataProviderSettings?.hardcover?.apiKey ?? '';
this.hardcoverEnabled = metadataProviderSettings?.hardcover?.enabled ?? false;
this.comicvineEnabled = metadataProviderSettings?.comicvine?.enabled ?? false;
this.comicvineToken = metadataProviderSettings?.comicvine?.apiKey ?? '';
});
}
@@ -89,6 +93,13 @@ export class MetadataProviderSettingsComponent implements OnInit {
}
}
onComicTokenChange(newToken: string): void {
this.comicvineToken = newToken;
if (!newToken.trim()) {
this.comicvineEnabled = false;
}
}
saveSettings(): void {
const payload = [
{
@@ -99,6 +110,12 @@ export class MetadataProviderSettingsComponent implements OnInit {
cookie: this.amazonCookie,
domain: this.selectedAmazonDomain
},
comicvine: {
enabled: this.comicvineEnabled,
apiKey: this.comicvineToken.trim()
},
goodReads: {enabled: this.goodreadsEnabled},
google: {enabled: this.googleEnabled},
hardcover: {