(sorry for the crappy layout, will make it nicer in time and add pictures and full HOWTO)
Apple Music scripts:
==> ilove.sh <==
#!/bin/bash
osascript -e 'tell application "Music" to set favorited of current track to true'
==> inext.sh <==
#!/bin/bash
osascript -e 'tell application "Music" to next track';
==> ipause.sh <==
#!/bin/bash
osascript -e 'tell application "Music" to pause';
echo $?
==> iplay.sh <==
#!/bin/bash
osascript -e 'tell application "Music" to playpause';
==> iprevious.sh <==
#!/bin/bash
osascript -e 'tell application "Music" to previous track';
==> ishuffle.sh <==
#!/bin/bash
shuffle=$(osascript -e 'tell application "Music" to get shuffle enabled');
if [ "${shuffle}" == "true" ] ; then
osascript -e 'tell application "Music" to set shuffle enabled to false';
else
osascript -e 'tell application "Music" to set shuffle enabled to true';
fi
==> ivoldown.sh <==
#!/bin/bash
currentvolume=$(osascript -e 'tell application "Music" to sound volume as integer')
newvol=$((currentvolume-5))
if [ ${newvol} -lt 0 ]
then
newvol=0
fi
osascript -e "tell application \"Music\" to set sound volume to $newvol";
==> ivolup.sh <==
#!/bin/bash
currentvolume=$(osascript -e 'tell application "Music" to sound volume as integer')
newvol=$((currentvolume+5))
if [ ${newvol} -gt 100 ]
then
newvol=100
fi
osascript -e "tell application \"Music\" to set sound volume to $newvol";