-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspotify.lua
More file actions
42 lines (33 loc) · 865 Bytes
/
spotify.lua
File metadata and controls
42 lines (33 loc) · 865 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
local spotify = {}
function spotify.toggle()
if (hs.spotify.isPlaying()) then
hs.spotify.pause()
else
hs.spotify.play()
end
end
function spotify.next()
hs.spotify.next()
end
function spotify.previous()
hs.spotify.previous()
end
function spotify.playing()
local album = hs.spotify.getCurrentAlbum()
local artist = hs.spotify.getCurrentArtist()
local track = hs.spotify.getCurrentTrack()
local message = "Now playing: \n" .. artist .. " - " .. track .. " - " .. album
if hs.spotify.isPlaying() ~= true then
message = message .. "\n Paused"
end
hs.alert.show(message)
end
function spotify.nextNotify()
spotify.next()
hs.timer.doAfter(0.5, spotify.playing)
end
function spotify.previousNotify()
spotify.previous()
hs.timer.doAfter(0.5, spotify.playing)
end
return spotify