aboutsummaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2021-11-19 12:13:45 -0500
committerMax Isom <[email protected]>2021-11-19 12:13:45 -0500
commitf5149dfaba64c62f0a9ea6deab600b3d4d9b0f39 (patch)
tree8bec60ce93ca8926a28414f972007e2e22a75bdd /src/managers
parent04d8f8d39000b711ec862043b687b8f47e454957 (diff)
downloadmuse-f5149dfaba64c62f0a9ea6deab600b3d4d9b0f39.tar.xz
muse-f5149dfaba64c62f0a9ea6deab600b3d4d9b0f39.zip
Move file caching logic to new FileCache service
Also: removes the -re ffmpeg option. If this option is passed, ffmpeg won't write to fs-capacitor (and the cache file) as fast as possible. In other words, the cache file won't finish writing until the entire stream has been played.
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/player.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/managers/player.ts b/src/managers/player.ts
index 02e4ba0..5d816b8 100644
--- a/src/managers/player.ts
+++ b/src/managers/player.ts
@@ -2,25 +2,25 @@ import {inject, injectable} from 'inversify';
import {Client} from 'discord.js';
import {TYPES} from '../types.js';
import Player from '../services/player.js';
-import Config from '../services/config.js';
+import FileCacheProvider from '../services/file-cache.js';
@injectable()
export default class {
private readonly guildPlayers: Map<string, Player>;
- private readonly cacheDir: string;
private readonly discordClient: Client;
+ private readonly fileCache: FileCacheProvider;
- constructor(@inject(TYPES.Config) config: Config, @inject(TYPES.Client) client: Client) {
+ constructor(@inject(TYPES.FileCache) fileCache: FileCacheProvider, @inject(TYPES.Client) client: Client) {
this.guildPlayers = new Map();
- this.cacheDir = config.CACHE_DIR;
this.discordClient = client;
+ this.fileCache = fileCache;
}
get(guildId: string): Player {
let player = this.guildPlayers.get(guildId);
if (!player) {
- player = new Player(this.cacheDir, this.discordClient);
+ player = new Player(this.discordClient, this.fileCache);
this.guildPlayers.set(guildId, player);
}