Improve metadata quality assessment with new Metadata Match Score and filtering feature
This commit is contained in:
committed by
Aditya Chandel
parent
986599a913
commit
49b56b78e9
+13
-3
@@ -133,11 +133,9 @@
|
||||
<img src="https://books.google.com/favicon.ico" alt="Google Books"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
</a>
|
||||
|
||||
}
|
||||
|
||||
} @else {
|
||||
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.rating"
|
||||
readonly
|
||||
@@ -179,10 +177,22 @@
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Published:</span> {{ metadata.publishedDate || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Language:</span> {{ metadata.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 10:</span> {{ metadata.isbn10 || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 13:</span> {{ metadata.isbn13 || '-' }}</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Match Score:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
{{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}%
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Page Count:</span> {{ metadata.pageCount || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">File Size:</span> {{ getFileSizeInMB() }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Progress:</span> {{ getProgressPercent() !== null ? getProgressPercent() + '%' : '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 13:</span> {{ metadata.isbn13 || '-' }}</p>
|
||||
</div>
|
||||
<div class="pt-2 flex items-center gap-2 w-full">
|
||||
<span class="font-semibold flex-shrink-0">File Path:</span>
|
||||
|
||||
+15
-6
@@ -1,6 +1,6 @@
|
||||
import {Component, DestroyRef, inject, Input, OnChanges, OnInit, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import {Button, ButtonDirective} from 'primeng/button';
|
||||
import { AsyncPipe, DecimalPipe, NgClass } from '@angular/common';
|
||||
import {AsyncPipe, DecimalPipe, NgClass} from '@angular/common';
|
||||
import {first, Observable} from 'rxjs';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
import {BookMetadataCenterService} from '../book-metadata-center.service';
|
||||
@@ -258,15 +258,14 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
getFileTypeColorClass(fileType: string | null | undefined): string {
|
||||
if (!fileType) return 'bg-gray-500 text-white';
|
||||
|
||||
if (!fileType) return 'bg-gray-600 text-white';
|
||||
switch (fileType.toLowerCase()) {
|
||||
case 'pdf':
|
||||
return 'bg-red-700 text-white';
|
||||
return 'bg-pink-700 text-white';
|
||||
case 'epub':
|
||||
return 'bg-yellow-600 text-gray-900';
|
||||
return 'bg-indigo-600 text-white';
|
||||
case 'cbz':
|
||||
return 'bg-green-700 text-white';
|
||||
return 'bg-teal-600 text-white';
|
||||
case 'cbr':
|
||||
return 'bg-purple-700 text-white';
|
||||
case 'cb7':
|
||||
@@ -291,4 +290,14 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
return 'rgb(239, 68, 68)';
|
||||
}
|
||||
}
|
||||
|
||||
getMatchScoreColorClass(score: number): string {
|
||||
if (score >= 0.95) return 'bg-green-600 border-green-700';
|
||||
if (score >= 0.90) return 'bg-green-500 border-green-600';
|
||||
if (score >= 0.80) return 'bg-green-400 border-green-500';
|
||||
if (score >= 0.70) return 'bg-yellow-500 border-yellow-600';
|
||||
if (score >= 0.50) return 'bg-yellow-400 border-yellow-500';
|
||||
if (score >= 0.30) return 'bg-red-500 border-red-600';
|
||||
return 'bg-red-600 border-red-700';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user