mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-11-06 18:58:01 +00:00
streamer service: split to separate files
This commit is contained in:
1 parent
72c5684da9
commit
2fb78b61c4
14 files changed
+204
-128
No files matched your search
@@ -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