1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing FileJob metadata only jobs. Fixes GPX compression progress error. Fixes #684

This commit is contained in:
Patrik J. Braun 2023-08-03 00:13:53 +02:00
parent 45295a14e9
commit c39c1d7d99

View File

@ -77,11 +77,10 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
}
if (!this.config.indexedOnly) {
if (this.directoryQueue.length > 0) {
await this.loadADirectoryFromDisk();
return true
return true;
} else if (this.fileQueue.length > 0) {
this.Progress.Left = this.fileQueue.length;
}
@ -138,6 +137,11 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
DirectoryDTOUtils.addReferences(scanned as DirectoryBaseDTO);
if (this.scanFilter.noPhoto !== true || this.scanFilter.noVideo !== true) {
const scannedAndFiltered = await this.filterMediaFiles(scanned.media);
const skipped = scanned.media.length - scannedAndFiltered.length;
if (skipped > 0) {
this.Progress.log('batch skipping: ' + skipped);
this.Progress.Skipped += skipped;
}
for (const item of scannedAndFiltered) {
this.fileQueue.push(
path.join(
@ -151,6 +155,11 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
}
if (this.scanFilter.noMetaFile !== true) {
const scannedAndFiltered = await this.filterMetaFiles(scanned.metaFile);
const skipped = scanned.metaFile.length - scannedAndFiltered.length;
if (skipped > 0) {
this.Progress.log('batch skipping: ' + skipped);
this.Progress.Skipped += skipped;
}
for (const item of scannedAndFiltered) {
this.fileQueue.push(
path.join(
@ -203,6 +212,11 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
hasMoreFile.media = result.length > 0;
this.DBProcessing.mediaLoaded += result.length;
const scannedAndFiltered = await this.filterMediaFiles(result);
const skipped = result.length - scannedAndFiltered.length;
if (skipped > 0) {
this.Progress.log('batch skipping: ' + skipped);
this.Progress.Skipped += skipped;
}
for (const item of scannedAndFiltered) {
this.fileQueue.push(
path.join(
@ -229,6 +243,11 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
hasMoreFile.metafile = result.length > 0;
this.DBProcessing.mediaLoaded += result.length;
const scannedAndFiltered = await this.filterMetaFiles(result);
const skipped = result.length - scannedAndFiltered.length;
if (skipped > 0) {
this.Progress.log('batch skipping: ' + skipped);
this.Progress.Skipped += skipped;
}
for (const item of scannedAndFiltered) {
this.fileQueue.push(
path.join(
@ -266,16 +285,16 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
.getRepository(usedEntity)
.createQueryBuilder('media')
.getCount();
if (!this.scanFilter.noMetaFile) {
count += await connection
.getRepository(FileEntity)
.createQueryBuilder('file')
.getCount();
}
return count;
}
if (!this.scanFilter.noMetaFile) {
count += await connection
.getRepository(FileEntity)
.createQueryBuilder('file')
.getCount();
}
return count;
}
}