mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
reduce log spam from FileInfoService
This commit is contained in:
parent
14440c7041
commit
2863f343f8
1 changed files with 5 additions and 4 deletions
|
@ -46,11 +46,13 @@ const TYPE_SVG = {
|
|||
@Injectable()
|
||||
export class FileInfoService {
|
||||
private logger: Logger;
|
||||
private ffprobeLogger: Logger;
|
||||
|
||||
constructor(
|
||||
private loggerService: LoggerService,
|
||||
) {
|
||||
this.logger = this.loggerService.getLogger('file-info');
|
||||
this.ffprobeLogger = this.logger.createSubLogger('ffprobe');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,20 +164,19 @@ export class FileInfoService {
|
|||
*/
|
||||
@bindThis
|
||||
private hasVideoTrackOnVideoFile(path: string): Promise<boolean> {
|
||||
const sublogger = this.logger.createSubLogger('ffprobe');
|
||||
sublogger.info(`Checking the video file. File path: ${path}`);
|
||||
this.ffprobeLogger.debug(`Checking the video file. File path: ${path}`);
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
FFmpeg.ffprobe(path, (err, metadata) => {
|
||||
if (err) {
|
||||
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err);
|
||||
this.ffprobeLogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err);
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
resolve(metadata.streams.some((stream) => stream.codec_type === 'video'));
|
||||
});
|
||||
} catch (err) {
|
||||
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err as Error);
|
||||
this.ffprobeLogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err as Error);
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue