mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-09 04:47:41 +00:00
streamer service: split to separate files
This commit is contained in:
@@ -29,8 +29,8 @@ export class AllFilesController {
|
||||
@Param('fileId') fileId: string,
|
||||
@Req() request: Request,
|
||||
@Res() response: Response,
|
||||
) {
|
||||
this.allFilesService.play(fileId, request, response);
|
||||
): Promise<void> {
|
||||
return this.allFilesService.play(fileId, request, response);
|
||||
}
|
||||
|
||||
@Get(':titleId/:seasonId?')
|
||||
|
||||
@@ -135,17 +135,16 @@ export class AllFilesService {
|
||||
response: Response,
|
||||
): Promise<void> {
|
||||
const id = parseInt(fileId);
|
||||
if (isNaN(id)) {
|
||||
throw new NotFoundException(`id #${fileId} not correct`);
|
||||
}
|
||||
|
||||
const entity = await this.fileRepository.findOne({ where: { id: id } });
|
||||
|
||||
if (entity === null) {
|
||||
response
|
||||
.status(404)
|
||||
.send('entity not found id: ' + fileId)
|
||||
.end();
|
||||
|
||||
return;
|
||||
throw new NotFoundException(`id #${fileId} not found`);
|
||||
}
|
||||
|
||||
this.streamerFacade.streamFile(request, response, entity.path);
|
||||
return this.streamerFacade.streamFile(request, response, entity.path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user