This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfo.plist
190 lines (175 loc) · 5.22 KB
/
info.plist
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?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>bundleid</key>
<string>jayj-google-music-shuffle</string>
<key>category</key>
<string>Internet</string>
<key>connections</key>
<dict>
<key>C10E966D-D737-4F08-92CC-5D2EAEA527A4</key>
<array>
<dict>
<key>destinationuid</key>
<string>380731B3-83F7-49BC-9BAA-63C27C271083</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Jesper Johansen</string>
<key>description</key>
<string>Shuffle your music or play the "I'm feeling lucky" radio</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Google Music Shuffle</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>keyword</key>
<string>shuffle</string>
<key>subtext</key>
<string>Optional arguments: latest, lucky, or radio</string>
<key>text</key>
<string>Shuffle music</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>C10E966D-D737-4F08-92CC-5D2EAEA527A4</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>#!/usr/bin/env osascript
-- Open Google Music in a new or existing tab
on gmusicOpenTab()
tell application "/Applications/Google Chrome.app"
-- Google Music is open, focus on the tab
repeat with w in windows
set i to 1
repeat with t in tabs of w
if URL of t contains "play.google.com/music" then
set active tab index of w to i
set index of w to 1
return
end if
set i to i + 1
end repeat
end repeat
-- Google Music is not open, open new tab
open location "https://play.google.com/music/listen#/ap/queue"
end tell
end gmusicOpenTab
-- Shuffle the music
on gmusicSendAction()
tell application "/Applications/Google Chrome.app"
-- Check if the Google Music is loaded
set is_loaded to false
repeat while is_loaded is false
tell active tab of first window to execute javascript "
var loading = document.getElementById('loading-progress'),
button = document.querySelector('[data-id=\"shuffle-my-library\"]' );
if (button && ! loading) { 'loaded' }"
-- The loading screen is gone, the page is loaded
if result is "loaded" then set is_loaded to true
-- Wait a bit before checking again
delay 0.5
end repeat
-- Click the shuffle or "I'm feeling lucky" button
if ("lucky" is equal to "{query}" or "radio" is equal to "{query}") then
tell active tab of first window to execute javascript "document.querySelector('[data-id=\"im-feeling-lucky\"]' ).click();"
else if ("latest" is equal to "{query}") then
tell active tab of first window to execute javascript "document.querySelector('[data-id=\"auto-playlist-recent\"]' ).click(); document.querySelector('[data-id=\"shuffle\"]' ).click();"
else
tell active tab of first window to execute javascript "document.querySelector('[data-id=\"shuffle-my-library\"]' ).click();"
end if
-- Go to the queue playlist
tell active tab of first window to execute javascript "document.querySelector('[data-id=\"queue\"]' ).click();"
end tell
end gmusicSendAction
on run {}
gmusicOpenTab()
gmusicSendAction()
end run</string>
<key>type</key>
<integer>6</integer>
</dict>
<key>type</key>
<string>alfred.workflow.output.script</string>
<key>uid</key>
<string>380731B3-83F7-49BC-9BAA-63C27C271083</string>
<key>version</key>
<integer>0</integer>
</dict>
</array>
<key>readme</key>
<string>Alfred workflow to shuffle music on Google Music in Chrome.
Trigger: `shuffle`
If Google Music is already open in Chrome, it will shuffle the music immediately. If not, it will open a new tab, wait for the page to load, and then shuffle the music.
The workflow also supports the “Last added” playlist and the "I'm feeling lucky" radio by adding the either `latest`, or `lucky`/`radio` argument after shuffle.</string>
<key>uidata</key>
<dict>
<key>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</key>
<dict>
<key>ypos</key>
<real>270</real>
</dict>
<key>380731B3-83F7-49BC-9BAA-63C27C271083</key>
<dict>
<key>ypos</key>
<real>70</real>
</dict>
<key>4E8505CA-F6B7-4C91-8F74-DEA732A88212</key>
<dict>
<key>ypos</key>
<real>170</real>
</dict>
<key>7DD3BDE5-A157-42E5-9376-F681FB50A4EE</key>
<dict>
<key>ypos</key>
<real>60</real>
</dict>
<key>A724FE2E-A195-44DF-9F78-FF9A8781B220</key>
<dict>
<key>ypos</key>
<real>60</real>
</dict>
<key>C10E966D-D737-4F08-92CC-5D2EAEA527A4</key>
<dict>
<key>ypos</key>
<real>70</real>
</dict>
<key>C8B08F32-A1AA-4A7F-AFE5-636F97434C7D</key>
<dict>
<key>ypos</key>
<real>60</real>
</dict>
<key>F22A7A13-B46A-4893-990B-294936F038AF</key>
<dict>
<key>ypos</key>
<real>160</real>
</dict>
</dict>
<key>webaddress</key>
<string>http://jayj.dk</string>
</dict>
</plist>