Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanMicai committed Feb 9, 2025
1 parent 6de5782 commit 60c9368
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/services/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,18 +665,24 @@ export default class {
}
}

private async createReadStream(options: {url: string; cacheKey: string; ffmpegInputOptions?: string[]; cache?: boolean; volumeAdjustment?: string}): Promise<Readable> {
private async createReadStream(options: {

Check failure on line 668 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
url: string;

Check failure on line 669 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
cacheKey: string;

Check failure on line 670 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
ffmpegInputOptions?: string[];

Check failure on line 671 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
cache?: boolean;

Check failure on line 672 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
volumeAdjustment?: string;
}): Promise<Readable> {
return new Promise((resolve, reject) => {
const capacitor = new WriteStream();

let hasReturnedStreamClosed = false;

Check failure on line 678 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
if (options?.cache) {
const cacheStream = this.fileCache.createWriteStream(this.getHashForCache(options.cacheKey));
capacitor.createReadStream().pipe(cacheStream);
capacitor.createReadStream()?.pipe(cacheStream);
}

Check failure on line 683 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
const returnedStream = capacitor.createReadStream();
let hasReturnedStreamClosed = false;


Check failure on line 685 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
const stream = ffmpeg(options.url)
.inputOptions(options?.ffmpegInputOptions ?? ['-re'])
.noVideo()
Expand All @@ -689,19 +695,18 @@ export default class {
}
})
.on('start', command => {
debug(`Spawned ffmpeg with ${command as string}`);
debug(`Spawned ffmpeg with ${command}`);
});

Check failure on line 700 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
stream.pipe(capacitor);

Check failure on line 702 in src/services/player.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
returnedStream.on('close', () => {
if (!options.cache) {
if (!options?.cache) {
stream.kill('SIGKILL');
}

hasReturnedStreamClosed = true;
});

resolve(returnedStream);
});
}
Expand Down

0 comments on commit 60c9368

Please sign in to comment.