mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-24 00:40:25 +01:00
Edit tasks
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import Logger from '@ioc:Adonis/Core/Logger'
|
||||
import { getCurrentPlayingFromSpotify } from 'App/Utils/SongUtils'
|
||||
import { getCurrentPlayingFromSpotify, getSpotifyAccount } from 'App/Utils/SongUtils'
|
||||
|
||||
const MS = 1000
|
||||
let taskId
|
||||
|
||||
async function SpotifyCurrentListeningWatcher(): Promise<void> {
|
||||
if (getSpotifyAccount().access === '') return
|
||||
await getCurrentPlayingFromSpotify()
|
||||
}
|
||||
|
||||
export async function Activate(): Promise<void> {
|
||||
Logger.info(`Starting task runner for watching spotify current playing [${MS} ms]`)
|
||||
await getCurrentPlayingFromSpotify()
|
||||
taskId = setInterval(getCurrentPlayingFromSpotify, MS)
|
||||
await SpotifyCurrentListeningWatcher()
|
||||
taskId = setInterval(SpotifyCurrentListeningWatcher, MS)
|
||||
}
|
||||
|
||||
export function ShutDown(): void {
|
||||
|
||||
Reference in New Issue
Block a user