1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

Add compressed GPX delete button

#504
This commit is contained in:
Patrik J. Braun 2023-07-29 11:45:29 +02:00
parent afa3ad9f30
commit 041b984dbd
7 changed files with 29 additions and 2 deletions

View File

@ -15,6 +15,11 @@ export class GPXProcessing {
return SupportedFormats.WithDots.MetaFiles.indexOf(extension) !== -1; 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 { public static generateConvertedPath(filePath: string): string {
return path.join( return path.join(
ProjectPath.TranscodedFolder, ProjectPath.TranscodedFolder,

View File

@ -9,6 +9,7 @@ import {PreviewFillingJob} from './jobs/PreviewFillingJob';
import {PreviewRestJob} from './jobs/PreviewResetJob'; import {PreviewRestJob} from './jobs/PreviewResetJob';
import {GPXCompressionJob} from './jobs/GPXCompressionJob'; import {GPXCompressionJob} from './jobs/GPXCompressionJob';
import {AlbumRestJob} from './jobs/AlbumResetJob'; import {AlbumRestJob} from './jobs/AlbumResetJob';
import {GPXCompressionResetJob} from './jobs/GPXCompressionResetJob';
export class JobRepository { export class JobRepository {
private static instance: JobRepository = null; private static instance: JobRepository = null;
@ -43,3 +44,4 @@ JobRepository.Instance.register(new ThumbnailGenerationJob());
JobRepository.Instance.register(new GPXCompressionJob()); JobRepository.Instance.register(new GPXCompressionJob());
JobRepository.Instance.register(new TempFolderCleaningJob()); JobRepository.Instance.register(new TempFolderCleaningJob());
JobRepository.Instance.register(new AlbumRestJob()); JobRepository.Instance.register(new AlbumRestJob());
JobRepository.Instance.register(new GPXCompressionResetJob());

View 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);
}
}

View File

@ -10,7 +10,7 @@ import {GPXProcessing} from '../../fileprocessing/GPXProcessing';
export class TempFolderCleaningJob extends Job { export class TempFolderCleaningJob extends Job {
public readonly Name = DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']]; public readonly Name = DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']];
public readonly ConfigTemplate: ConfigTemplateEntry[] = null; public readonly ConfigTemplate: ConfigTemplateEntry[] = null;
public readonly Supported = true; public readonly Supported: boolean = true;
directoryQueue: string[] = []; directoryQueue: string[] = [];
private tempRootCleaned = false; private tempRootCleaned = false;

View File

@ -395,6 +395,9 @@ export class ServerMetaFileConfig extends ClientMetaFileConfig {
uiJob: [{ uiJob: [{
job: DefaultsJobs[DefaultsJobs['GPX Compression']], job: DefaultsJobs[DefaultsJobs['GPX Compression']],
relevant: (c) => c.MetaFile.GPXCompressing.enabled relevant: (c) => c.MetaFile.GPXCompressing.enabled
},{
job: DefaultsJobs[DefaultsJobs['Delete Compressed GPX']],
relevant: (c) => c.MetaFile.GPXCompressing.enabled
}] }]
} as TAGS } as TAGS
}) })

View File

@ -13,6 +13,7 @@ export enum DefaultsJobs {
'Preview Reset' = 8, 'Preview Reset' = 8,
'GPX Compression' = 9, 'GPX Compression' = 9,
'Album Reset' = 10, 'Album Reset' = 10,
'Delete Compressed GPX' = 11
} }
export interface ConfigTemplateEntry { export interface ConfigTemplateEntry {

View File

@ -129,7 +129,7 @@
[soloRun]="true" [soloRun]="true"
(jobError)="error=$event" (jobError)="error=$event"
[allowParallelRun]="false" [allowParallelRun]="false"
[danger]="job.job.includes('Reset')" [danger]="job.job.includes('Reset') || job.job.includes('Delete')"
[jobName]="job.job"></app-settings-job-button> [jobName]="job.job"></app-settings-job-button>
</ng-container> </ng-container>