2023-04-15 22:06:35 +02:00
|
|
|
import { ExtendedClient } from "./server/structures/client"
|
|
|
|
import { config } from "./server/configuration"
|
2023-04-16 02:04:34 +02:00
|
|
|
import { logger } from "./server/logger"
|
2023-05-04 23:38:11 +02:00
|
|
|
import { JellyfinHandler } from "./server/jellyfin/handler"
|
2023-04-16 02:04:34 +02:00
|
|
|
const requestId = 'startup'
|
2023-04-15 22:06:35 +02:00
|
|
|
|
2023-04-18 23:44:42 +02:00
|
|
|
export const jellyfinHandler = new JellyfinHandler(config)
|
2023-04-16 02:04:34 +02:00
|
|
|
|
|
|
|
export const client = new ExtendedClient(jellyfinHandler)
|
|
|
|
|
|
|
|
async function init() {
|
|
|
|
try {
|
|
|
|
const users = await jellyfinHandler.getCurrentUsers("", requestId)
|
|
|
|
logger.info(`Fetched ${users.map(x => x.name).join(', ')} from JF`, { requestId })
|
|
|
|
} catch (error) {
|
|
|
|
logger.error(`Error fetching existing users from Jellyfin`, { requestId })
|
2023-04-15 22:06:35 +02:00
|
|
|
}
|
2023-04-16 02:04:34 +02:00
|
|
|
logger.info(`Starting client`, { requestId })
|
|
|
|
client.start()
|
2023-04-15 22:06:35 +02:00
|
|
|
}
|
2023-04-16 02:04:34 +02:00
|
|
|
init()
|