muse/src/index.ts
Max Isom f5149dfaba
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.
2021-11-19 12:13:45 -05:00

26 lines
726 B
TypeScript

import makeDir from 'make-dir';
import path from 'path';
import container from './inversify.config.js';
import {TYPES} from './types.js';
import Bot from './bot.js';
import {sequelize} from './utils/db.js';
import Config from './services/config.js';
import FileCacheProvider from './services/file-cache.js';
const bot = container.get<Bot>(TYPES.Bot);
(async () => {
// Create data directories if necessary
const config = container.get<Config>(TYPES.Config);
await makeDir(config.DATA_DIR);
await makeDir(config.CACHE_DIR);
await makeDir(path.join(config.CACHE_DIR, 'tmp'));
await sequelize.sync({alter: true});
await container.get<FileCacheProvider>(TYPES.FileCache).cleanup();
await bot.listen();
})();