-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spotify #2
Comments
hey @ThatOneCalculator, Actually I have no idea. I did this project for experiment. |
Gotcha. If I ever figure it out, I'll post it here. |
Thanks man. I really appreciate it. Have a nice day |
I figured it out! As it turns out, the Spotify API is actual bs, so I did the only sensible thing... ...cut it out entirely! Turns out, AppleScript has a giant built in dictionary for accessing info about Spotify. How neat! I put this addition into Pecan bar, but it can super easily be replicated in your bar.
const command = 'bash pecan/scripts/song';
const refreshFrequency = 500; //ms
let render = ({ output }) => {
if (String(output).includes('No song playing')){
return (<div></div>);
}
else{
return (<div class='screen'><div class='pecansong'>{output}</div></div>);
}
}
export { command, refreshFrequency, render };
#!/pecan/scripts/song'
spotify=$(osascript -e 'if application "Spotify" is running then
set myvar to "running"
end if')
if [ "$spotify" == "running" ]; then
song=$(osascript -e 'tell application "Spotify"
set track_name to name of current track
end tell')
artist=$(osascript -e 'tell application "Spotify"
set track_artist to artist of current track
end tell')
echo "$song by $artist"
else
echo "No song playing"
fi |
@ThatOneCalculator Hey, thank you for your contribution. I will check and implement it in next monday. Currently I don't have any mac to test. |
Is it next monday? 🙃 |
How do I get a refresh token so the Spotify token doesn't expire?
The text was updated successfully, but these errors were encountered: