mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-23 01:27:14 +02:00
parent
afa3ad9f30
commit
041b984dbd
@ -15,6 +15,11 @@ export class GPXProcessing {
|
||||
return SupportedFormats.WithDots.MetaFiles.indexOf(extension) !== -1;
|
||||
}
|
||||
|
||||
public static isGPXFile(fullPath: string): boolean {
|
||||
const extension = path.extname(fullPath).toLowerCase();
|
||||
return extension === '.gpx';
|
||||
}
|
||||
|
||||
public static generateConvertedPath(filePath: string): string {
|
||||
return path.join(
|
||||
ProjectPath.TranscodedFolder,
|
||||
|
@ -9,6 +9,7 @@ import {PreviewFillingJob} from './jobs/PreviewFillingJob';
|
||||
import {PreviewRestJob} from './jobs/PreviewResetJob';
|
||||
import {GPXCompressionJob} from './jobs/GPXCompressionJob';
|
||||
import {AlbumRestJob} from './jobs/AlbumResetJob';
|
||||
import {GPXCompressionResetJob} from './jobs/GPXCompressionResetJob';
|
||||
|
||||
export class JobRepository {
|
||||
private static instance: JobRepository = null;
|
||||
@ -43,3 +44,4 @@ JobRepository.Instance.register(new ThumbnailGenerationJob());
|
||||
JobRepository.Instance.register(new GPXCompressionJob());
|
||||
JobRepository.Instance.register(new TempFolderCleaningJob());
|
||||
JobRepository.Instance.register(new AlbumRestJob());
|
||||
JobRepository.Instance.register(new GPXCompressionResetJob());
|
||||
|
16
src/backend/model/jobs/jobs/GPXCompressionResetJob.ts
Normal file
16
src/backend/model/jobs/jobs/GPXCompressionResetJob.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {DefaultsJobs} from '../../../../common/entities/job/JobDTO';
|
||||
import {TempFolderCleaningJob} from './TempFolderCleaningJob';
|
||||
import {GPXProcessing} from '../../fileprocessing/GPXProcessing';
|
||||
|
||||
/**
|
||||
* Deletes all gpx file from the tmp folder
|
||||
*/
|
||||
export class GPXCompressionResetJob extends TempFolderCleaningJob {
|
||||
public readonly Name = DefaultsJobs[DefaultsJobs['Delete Compressed GPX']];
|
||||
|
||||
// returns false if the file is GPX
|
||||
protected async isValidFile(filePath: string): Promise<boolean> {
|
||||
return !GPXProcessing.isGPXFile(filePath);
|
||||
}
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ import {GPXProcessing} from '../../fileprocessing/GPXProcessing';
|
||||
export class TempFolderCleaningJob extends Job {
|
||||
public readonly Name = DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']];
|
||||
public readonly ConfigTemplate: ConfigTemplateEntry[] = null;
|
||||
public readonly Supported = true;
|
||||
public readonly Supported: boolean = true;
|
||||
directoryQueue: string[] = [];
|
||||
private tempRootCleaned = false;
|
||||
|
||||
|
@ -395,6 +395,9 @@ export class ServerMetaFileConfig extends ClientMetaFileConfig {
|
||||
uiJob: [{
|
||||
job: DefaultsJobs[DefaultsJobs['GPX Compression']],
|
||||
relevant: (c) => c.MetaFile.GPXCompressing.enabled
|
||||
},{
|
||||
job: DefaultsJobs[DefaultsJobs['Delete Compressed GPX']],
|
||||
relevant: (c) => c.MetaFile.GPXCompressing.enabled
|
||||
}]
|
||||
} as TAGS
|
||||
})
|
||||
|
@ -13,6 +13,7 @@ export enum DefaultsJobs {
|
||||
'Preview Reset' = 8,
|
||||
'GPX Compression' = 9,
|
||||
'Album Reset' = 10,
|
||||
'Delete Compressed GPX' = 11
|
||||
}
|
||||
|
||||
export interface ConfigTemplateEntry {
|
||||
|
@ -129,7 +129,7 @@
|
||||
[soloRun]="true"
|
||||
(jobError)="error=$event"
|
||||
[allowParallelRun]="false"
|
||||
[danger]="job.job.includes('Reset')"
|
||||
[danger]="job.job.includes('Reset') || job.job.includes('Delete')"
|
||||
[jobName]="job.job"></app-settings-job-button>
|
||||
</ng-container>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user