import "@johnlindquist/kit"
const spotify = await npm("spotify-node-applescript")
spotify.isRunning((err, isRunning) => {
if (!isRunning) return exit();
spotify.getTrack(async (err: any, track: any) => {
if (err) return exit();
const { artist, name } = track;
const term = `${artist}+${name}`.replace("&", "");
const site = await arg(`${name} - ${artist}`, [
{
name: "Genius.com",
description: 'Search for song lyrics',
value: 'genius',
},
{
name: "Whosampled.com",
description: 'Search for samples',
value: 'whosampled',
},
])
const uri = encodeURI(`https://www.${site}.com/search?q=${term}`)
exec(`open '${uri}'`)
})
})