mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
add re-scan all option
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user