add re-scan all option

This commit is contained in:
Jurgis Sakalauskas
2023-10-30 11:42:38 +02:00
parent e707fa838b
commit 67dc81090e
4 changed files with 19 additions and 2 deletions
@@ -30,6 +30,11 @@ export class AllFilesController {
return this.allFilesService.scanNewFiles();
}
@Get('scan-all')
scanAllFiles(): KodiApiResponse {
return this.allFilesService.scanAllFiles();
}
@Get('delete/:fileId')
async deleteFile(@Param('fileId') fileId: string): Promise<KodiApiResponse> {
return this.allFilesService.deleteFile(fileId);
@@ -26,6 +26,7 @@ export class AllFilesService {
['Movies', 'movie'],
['Shows', 'show'],
['Scan for new Files', 'scan'],
['Re-Scan Files', 'scan-all'],
],
'all/',
)
@@ -203,6 +204,14 @@ export class AllFilesService {
);
}
public scanAllFiles(): NotificationResponse {
this.videoFilesFacade.updateFsVideoFiles(true);
return this.koiApiResponseFactory.createNotificationResponse(
'Scanning for all files.',
false,
);
}
async deleteFile(fileId: string) {
const id = parseInt(fileId);
const result = await this.videoFilesFacade.deleteFile(id);
@@ -65,6 +65,9 @@ export class VideoFilesUpdateService {
}
await this.repository.saveFiles(entitiesToSave);
console.log(
`file scan and update complete - ${refresh ? 'full update' : 'only new'}`,
);
}
private isPathToIgnore(filePath: string): boolean {
+2 -2
View File
@@ -47,8 +47,8 @@ export class VideoFilesFacade {
* Scan for new files and remove deleted.
* Once all hooks are working correctly, this one shouldn't be needed anymore
*/
updateFsVideoFiles(): void {
this.videoFilesUpdateService.updateFsVideoFiles().then();
updateFsVideoFiles(refresh = false): void {
this.videoFilesUpdateService.updateFsVideoFiles(refresh).then();
}
addVideoFiles(