Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Live Stream 'Now Playing' live text label
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set iTunesRunning to is_running("iTunes")
set noMusic to "no music is playing"
set song to noMusic
if iTunesRunning then
set song to run script "tell application \"iTunes\" to if player state is playing then \"now playing: \" & name of current track & \" by \" & artist of current track"
try
song
return song
on error
return noMusic
end try
else
return noMusic
end if
#!/bin/bash
# Adds the currently playing iTunes track to a text file for an OBS text label.
#
SONG=`osascript ~/bin/twitch-scripts/iTunesSong.scpt`
echo -e $SONG > ~/Documents/twitch/custom-labels/now-playing.txt
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>twitch.song_updater.write_file</string>
<key>Program</key>
<string>/Users/noopkat/bin/twitch-scripts/nowPlaying.sh</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>10</integer>
</dict>
</plist>
# run the following line in your terminal to load the launch agent:
sudo launchctl load ~/Library/LaunchAgents/twitch.song_updater.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.