feat: Leverage fuzzy logic for more accurate metadata resolution and support Amazon cookies

- Improved metadata matching using fuzzy string comparison with threshold-based author validation
- Added support for optional Amazon session cookie to enhance data retrieval and bypass rate limiting
This commit is contained in:
aditya.chandel
2025-05-30 12:29:00 -06:00
committed by Aditya Chandel
parent b6e9a73cf9
commit 204a155582
9 changed files with 139 additions and 74 deletions
@@ -27,6 +27,7 @@ export interface MetadataProviderSettings {
export interface Amazon {
enabled: boolean;
cookie: string;
}
export interface Google {
@@ -1,7 +1,7 @@
<p class="text-lg flex items-center gap-2">
Enabled Metadata Providers:
<i
class="pi pi-info-circle"
class="pi pi-info-circle text-sky-600"
pTooltip="Enable or configure third-party metadata sources for enhanced book information."
tooltipPosition="right"
style="cursor: pointer;">
@@ -10,9 +10,25 @@
<div class="flex flex-col gap-4 p-4">
<div class="flex items-center gap-4">
<p-checkbox [(ngModel)]="amazonEnabled" [binary]="true"></p-checkbox>
<label>Amazon</label>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-4">
<p-checkbox [(ngModel)]="amazonEnabled" [binary]="true"></p-checkbox>
<label>Amazon</label>
</div>
<div class="flex items-center gap-4 pl-6">
<input
type="text"
pInputText
placeholder="Amazon Cookie (Optional)"
class="w-full max-w-3xl"
[(ngModel)]="amazonCookie" />
<i
class="pi pi-info-circle text-sky-600"
pTooltip="Providing your Amazon session cookie allows the app to access richer book metadata and bypass rate limits. Optional but recommended for best results."
tooltipPosition="right"
style="cursor: pointer;">
</i>
</div>
</div>
<div class="flex items-center gap-4">
@@ -39,7 +55,7 @@
type="text"
pInputText
placeholder="API Token"
class="w-full max-w-sm"
class="w-full max-w-3xl"
[(ngModel)]="hardcoverToken"
(ngModelChange)="onTokenChange($event)" />
</div>
@@ -26,6 +26,7 @@ import {AppSettingKey} from '../../../core/model/app-settings.model';
})
export class MetadataProviderSettingsComponent implements OnInit {
hardcoverToken: string = '';
amazonCookie: string = '';
hardcoverEnabled: boolean = false;
amazonEnabled: boolean = false;
goodreadsEnabled: boolean = false;
@@ -45,6 +46,7 @@ export class MetadataProviderSettingsComponent implements OnInit {
.subscribe(settings => {
const metadataProviderSettings = settings!.metadataProviderSettings;
this.amazonEnabled = metadataProviderSettings?.amazon?.enabled ?? false;
this.amazonCookie = metadataProviderSettings?.amazon?.cookie ?? "";
this.goodreadsEnabled = metadataProviderSettings?.goodReads?.enabled ?? false;
this.googleEnabled = metadataProviderSettings?.google?.enabled ?? false;
this.hardcoverToken = metadataProviderSettings?.hardcover?.apiKey ?? '';
@@ -64,7 +66,10 @@ export class MetadataProviderSettingsComponent implements OnInit {
{
key: AppSettingKey.METADATA_PROVIDER_SETTINGS,
newValue: {
amazon: {enabled: this.amazonEnabled},
amazon: {
enabled: this.amazonEnabled,
cookie: this.amazonCookie
},
goodReads: {enabled: this.goodreadsEnabled},
google: {enabled: this.googleEnabled},
hardcover: {