// One Spotify poll (now playing + recently played), for the optional host timer in // deploy/music-collector. The app normally does this itself every minute (see // src/lib/server/music/poller.ts); the lease in music.spotify_auth stops double polling. // MUSIC_DB_URL=... SPOTIFY_CLIENT_ID=... SPOTIFY_CLIENT_SECRET=... bun scripts/music-poll.ts import { pollSpotify } from '../src/lib/music/collector.server'; import { musicDb } from './music-db'; const clientId = process.env.SPOTIFY_CLIENT_ID; const clientSecret = process.env.SPOTIFY_CLIENT_SECRET; if (!clientId || !clientSecret) throw new Error('Set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET'); const sql = musicDb(); try { const result = await pollSpotify(sql, { clientId, clientSecret }); console.log(JSON.stringify(result)); if (result.status === 'error') process.exitCode = 1; } finally { await sql.end(); }