All checks were successful
Deploy production / deploy (push) Successful in 2m37s
- music schema: artists/albums/tracks (+album art), plays with source + dedupe, now_playing, spotify_auth, import_state; plays_deduped view hides Last.fm scrobbles Spotify also has - in-app Spotify poller (60s, leased) started from hooks init; no new role or env needed - /api/spotify/connect + callback (owner only), /trackers/music public stats - scripts: music-poll, music-import-lastfm (resumable), music-import-history - deploy/music-collector: optional host timer with its own role
19 lines
878 B
TypeScript
19 lines
878 B
TypeScript
// 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();
|
|
}
|