Skip to content
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

New command to retrieve player status #127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion spotify
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ showHelp () {
echo " vol <amount> # Sets the volume to an amount between 0 and 100.";
echo " vol [show] # Shows the current Spotify volume.";
echo;
echo " status # Shows the current player status.";
echo " status # Shows the current player status and details of the currently playing track.";
echo " status artist # Shows the currently playing artist.";
echo " status album # Shows the currently playing album.";
echo " status track # Shows the currently playing track.";
echo " status player # Shows the current status of the player.";
echo;
echo " share # Displays the current song's Spotify URL and URI."
echo " share url # Displays the current song's Spotify URL and copies it to the clipboard."
Expand Down Expand Up @@ -113,6 +114,10 @@ showTrack() {
echo `osascript -e 'tell application "Spotify" to name of current track as string'`;
}

showPlayerStatus(){
echo `osascript -e 'tell application "Spotify" to player state as string'`;
}

showStatus () {
state=`osascript -e 'tell application "Spotify" to player state as string'`;
cecho "Spotify is currently $state.";
Expand Down Expand Up @@ -390,6 +395,10 @@ while [ $# -gt 0 ]; do
"track" )
showTrack;
break ;;

"player" )
showPlayerStatus;
break ;;
esac
else
# status is the only param
Expand Down