mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 12:14:18 +00:00
reduce log spam from FileInfoService
This commit is contained in:
@@ -46,11 +46,13 @@ const TYPE_SVG = {
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class FileInfoService {
|
export class FileInfoService {
|
||||||
private logger: Logger;
|
private logger: Logger;
|
||||||
|
private ffprobeLogger: Logger;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private loggerService: LoggerService,
|
private loggerService: LoggerService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.loggerService.getLogger('file-info');
|
this.logger = this.loggerService.getLogger('file-info');
|
||||||
|
this.ffprobeLogger = this.logger.createSubLogger('ffprobe');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,20 +164,19 @@ export class FileInfoService {
|
|||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
private hasVideoTrackOnVideoFile(path: string): Promise<boolean> {
|
private hasVideoTrackOnVideoFile(path: string): Promise<boolean> {
|
||||||
const sublogger = this.logger.createSubLogger('ffprobe');
|
this.ffprobeLogger.debug(`Checking the video file. File path: ${path}`);
|
||||||
sublogger.info(`Checking the video file. File path: ${path}`);
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
try {
|
try {
|
||||||
FFmpeg.ffprobe(path, (err, metadata) => {
|
FFmpeg.ffprobe(path, (err, metadata) => {
|
||||||
if (err) {
|
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);
|
resolve(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resolve(metadata.streams.some((stream) => stream.codec_type === 'video'));
|
resolve(metadata.streams.some((stream) => stream.codec_type === 'video'));
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} 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);
|
resolve(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user