-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnp.scpt
More file actions
executable file
·65 lines (56 loc) · 1.89 KB
/
np.scpt
File metadata and controls
executable file
·65 lines (56 loc) · 1.89 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
on textualcmd()
set nowPlaying to "I'm not currently playing anything. Check that QuickTime Player, Spotify, or iTunes is open and playing something."
set isNowPlaying to 0
# VLC
if isRunning("VLC") then
tell application "VLC"
if playing then
set nowPlaying to "is playing " & name of current item
set isNowPlaying to 1
end if
end tell
end if
# QuickTime Player
if isRunning("QuickTime Player") then
tell application "QuickTime Player"
if playing of document 1 then
set nowPlaying to "is playing " & name of document 1
set isNowPlaying to 1
end if
end tell
end if
# Spotify
if isRunning("Spotify") then
tell application "Spotify"
if player state is playing then
set nowPlaying to "is listening to " & artist of current track & " - " & name of current track & ", from the album " & album of current track
set isNowPlaying to 1
end if
end tell
end if
# iTunes
if isRunning("iTunes") then
tell application "iTunes"
if player state is playing then
set nowPlaying to "is listening to " & artist of current track & " - " & name of current track & ", from the album " & album of current track
set isNowPlaying to 1
end if
end tell
end if
# Cog
# if isRunning("Cog") then
# tell application "Cog"
# set nowPlaying to "is listening to " & artist of currententry & " - " & title of currententry & ", from the album " & album of currententry & " (" & year of currententry & ") [" & bitrate of currententry & "kbps]"
# end tell
# end if
if isNowPlaying is 0 then
return "/debug " & nowPlaying
else
return "/me " & nowPlaying
end if
end textualcmd
on isRunning(mediaPlayer)
tell application "System Events"
tell application "System Events" to return exists (processes where name is mediaPlayer)
end tell
end isRunning