-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathspotify.rb
More file actions
52 lines (38 loc) · 775 Bytes
/
spotify.rb
File metadata and controls
52 lines (38 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
framework 'ScriptingBridge'
class Spotify < Plugin
requires_version '1.0.3'
def self.play
app.play
end
def self.pause
app.pause
end
def self.play_pause
app.playpause
end
def self.next
app.nextTrack
end
def self.previous
app.previousTrack
end
def self.current_track
t = app.currentTrack
`/usr/local/bin/growlnotify -a Spotify -t "#{t.name}" -m "#{t.artist}\r#{t.album}"`
end
def self.app
SBApplication.applicationWithBundleIdentifier("com.spotify.client")
end
end
command "Spotify - Next Song" do
Spotify.next
end
command "Spotify - Previous Song" do
Spotify.previous
end
command "Spotify - Current Track" do
Spotify.current_track
end
command "Spotify - Play/Pause" do
Spotify.play_pause
end