Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicholas Penree
committed
Jun 17, 2010
0 parents
commit 97645c5
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Spotify Now Playing Agent | ||
==================================== | ||
|
||
This script utilizes Growl diagnostic messages to capture song change notifications and writes the new song metadata to a file in /tmp as well as setting iChat or Adium's status message if they are running. | ||
|
||
Installation | ||
------------- | ||
|
||
1. Move com.spotify.NowPlayingAgent.plist to ~/Library/LaunchAgents | ||
2. Copy SpotifyNowPlayingAgent to /usr/local/bin/ | ||
3. Open Terminal.app | ||
4. Enter the following commands: | ||
|
||
> chmod +x /usr/local/bin/SpotifyNowPlayingAgent | ||
> launchctl load -w ~/Library/LaunchAgents/com.spotify.NowPlayingAgent.plist | ||
Credits | ||
--------- | ||
|
||
* Kaatje Galway | ||
* Nicholas 'drudge' Penree | ||
* [This snippet](http://codesnippets.joyent.com/posts/show/1954) | ||
|
||
License | ||
--------- | ||
|
||
(The MIT License) | ||
|
||
Copyright (c) 2010 Nicholas Penree <drudge@conceited.net> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
## NOTE: run the following once! | ||
|
||
# defaults write com.Growl.GrowlHelperApp GrowlLoggingEnabled -int 1 | ||
# sudo killall GrowlHelperApp | ||
# open ~/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app | ||
|
||
syslog -F '$(Message)' -E vis -d -w 1 -k Sender GrowlHelperApp | while read song; do | ||
if [[ "$song" =~ "Spotify" ]]; then read song2; | ||
echo "$song + $song2" | perl -ne 'if (/Spotify: ([^(]+) \((.*?)\)/) { print "$1 ($2 $3)\n";}' > /tmp/spotify.current | ||
|
||
STATUSMSG=`echo "$song)" | perl -ne 'if (/Spotify: ([^(]+) \((.*?)\)/) { print "$1 - $2\n";}'` | ||
ICHATPID=$(ps axc|awk "{if (\$5==\"iChat\") print \$1}") | ||
ADIUMPID=$(ps axc|awk "{if (\$5==\"Adium\") print \$1}") | ||
|
||
if [ "$ICHATPID" != "" ]; then | ||
echo "tell application \"iChat\" to set the status message to \"$STATUSMSG\"" | osascript | ||
fi | ||
|
||
if [ "$ADIUMPID" != "" ]; then | ||
echo "tell application \"Adium\" to set status message of every account to \"$STATUSMSG\"" | osascript | ||
fi | ||
fi | ||
done | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?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>com.spotify.NowPlayingAgent</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/usr/local/bin/SpotifyNowPlayingAgent</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
</dict> | ||
</plist> |