Scanner Bugfixes (#2818)

This commit is contained in:
Joe Milazzo 2024-03-25 16:28:10 -05:00 committed by GitHub
parent 829a610579
commit 93a8883fe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 180 additions and 99 deletions

View file

@ -14,6 +14,6 @@ export class FilterPipe implements PipeTransform {
const ret = items.filter(item => callback(item));
if (ret.length === items.length) return items; // This will prevent a re-render
return ret;
}
}
}

View file

@ -339,6 +339,9 @@ export class SeriesDetailComponent implements OnInit, AfterContentChecked {
get ShowStorylineTab() {
if (this.libraryType === LibraryType.ComicVine) return false;
// Edge case for bad pdf parse
if (this.libraryType === LibraryType.Book && (this.volumes.length === 0 && this.chapters.length === 0 && this.storyChapters.length > 0)) return true;
return (this.libraryType !== LibraryType.Book && this.libraryType !== LibraryType.LightNovel && this.libraryType !== LibraryType.Comic)
&& (this.volumes.length > 0 || this.chapters.length > 0);
}
@ -727,7 +730,12 @@ export class SeriesDetailComponent implements OnInit, AfterContentChecked {
// Book libraries only have Volumes or Specials enabled
if (this.libraryType === LibraryType.Book || this.libraryType === LibraryType.LightNovel) {
if (this.volumes.length === 0) {
this.activeTabId = TabID.Specials;
if (this.specials.length === 0 && this.storyChapters.length > 0) {
// NOTE: This is an edge case caused by bad parsing of pdf files. Once the new pdf parser is in place, this should be removed
this.activeTabId = TabID.Storyline;
} else {
this.activeTabId = TabID.Specials;
}
} else {
this.activeTabId = TabID.Volumes;
}

View file

@ -258,7 +258,10 @@ export class LibrarySettingsModalComponent implements OnInit {
forceScan() {
this.libraryService.scan(this.library!.id, true)
.subscribe(() => this.toastr.info(translate('toasts.forced-scan-queued', {name: this.library!.name})));
.subscribe(() => {
this.toastr.info(translate('toasts.forced-scan-queued', {name: this.library!.name}));
this.close();
});
}
async save() {

View file

@ -1,37 +1,23 @@
<ng-container *transloco="let t; read: 'kavitaplus-metadata-breakdown-stats'">
<div class="dashboard-card-content">
<h4>{{t('title')}}</h4>
<p>{{t('description')}}</p>
@if(breakdown) {
@if(breakdown.totalSeries === 0 || breakdown.seriesCompleted === 0) {
<div>{{t('no-data')}}</div>
}
@if (percentDone >= 1) {
<p>{{t('complete') }}</p>
} @else {
<p>{{t('total-series-progress-label', {percent: percentDone * 100 | percent}) }}</p>
<div class="day-breakdown-chart">
<table class="charts-css pie show-labels">
<tbody>
<tr>
<th scope="row">{{t('completed-series-label')}}</th>
<td class="completed" style="--start: 0; --end: ' + {{ completedEnd }}">
<span class="data">{{ breakdown.seriesCompleted }}</span>
</td>
</tr>
<tr>
<th scope="row">{{t('errored-series-label')}}</th>
<td class="error" style="--start: ' + {{ errorStart }}; --end: {{ errorEnd }}'">
<span class="data">{{ breakdown.erroredSeries }}</span>
</td>
</tr>
</tbody>
</table>
</div>
<ngb-progressbar-stacked>
<ngb-progressbar type="danger" [value]="errorPercent" [ngbTooltip]="t('errored-series-label') + ' ' + breakdown.erroredSeries"></ngb-progressbar>
<ngb-progressbar type="success" [value]="completedPercent" [ngbTooltip]="t('completed-series-label') + ' ' + breakdown.seriesCompleted"></ngb-progressbar>
</ngb-progressbar-stacked>
@if (breakdown.seriesCompleted >= breakdown.totalSeries) {
<p>{{t('complete') }}
@if (breakdown.erroredSeries > 0) {
{{t('errored-series-label') }} {{breakdown.erroredSeries}}
}
</p>
}
}
}
</div>

View file

@ -3,13 +3,17 @@ import {StatisticsService} from "../../../_services/statistics.service";
import {KavitaPlusMetadataBreakdown} from "../../_models/kavitaplus-metadata-breakdown";
import {TranslocoDirective} from "@ngneat/transloco";
import {PercentPipe} from "@angular/common";
import {NgbProgressbar, NgbProgressbarStacked, NgbTooltip} from "@ng-bootstrap/ng-bootstrap";
@Component({
selector: 'app-kavitaplus-metadata-breakdown-stats',
standalone: true,
imports: [
TranslocoDirective,
PercentPipe
PercentPipe,
NgbProgressbarStacked,
NgbProgressbar,
NgbTooltip
],
templateUrl: './kavitaplus-metadata-breakdown-stats.component.html',
styleUrl: './kavitaplus-metadata-breakdown-stats.component.scss',
@ -20,20 +24,18 @@ export class KavitaplusMetadataBreakdownStatsComponent {
private readonly statsService = inject(StatisticsService);
breakdown: KavitaPlusMetadataBreakdown | undefined;
completedStart!: number;
completedEnd!: number;
errorStart!: number;
errorEnd!: number;
percentDone!: number;
errorPercent!: number;
completedPercent!: number;
constructor() {
this.statsService.getKavitaPlusMetadataBreakdown().subscribe(res => {
this.breakdown = res;
this.completedStart = 0;
this.completedEnd = ((res.seriesCompleted - res.erroredSeries) / res.totalSeries);
this.errorStart = this.completedEnd;
this.errorEnd = Math.max(1, ((res.seriesCompleted) / res.totalSeries));
this.percentDone = res.seriesCompleted / res.totalSeries;
this.errorPercent = (res.erroredSeries / res.totalSeries) * 100;
this.completedPercent = ((res.seriesCompleted - res.erroredSeries) / res.totalSeries) * 100;
this.cdRef.markForCheck();
});
}

View file

@ -579,7 +579,7 @@
"published-label": "Published: ",
"available": "Available",
"description": "If you do not see an {{installed}}",
"description-continued": "tag, you are on a nightly release. Only major versions will show as available."
"description-continued": "tag, you are on a nightly release. Only major versions will show as available. A nightly tag will show when on a nightly from that stable."
},
"invite-user": {
@ -1786,10 +1786,10 @@
"kavitaplus-metadata-breakdown-stats": {
"title": "Kavita+ Metadata Breakdown",
"description": "Kavita fetches metadata (ratings, reviews, recommendations, etc) slowly over time for eligible series.",
"no-data": "No data",
"errored-series-label": "Errored Series",
"completed-series-label": "Completed Series",
"total-series-progress-label": "Series Processed: {{percent}}",
"complete": "All Series have metadata"
},