Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Add support for the "Last added" playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
jayj committed Oct 3, 2015
1 parent a032280 commit b0a5d7f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

#### Alfred workflow to shuffle music on Google Music in Chrome.


#### Shuffle all songs

Trigger: `shuffle`

![The Alfred window](http://imgur.com/UBo4UsI.png)
![Shuffle all songs](http://i.imgur.com/9KtZlnR.png)

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 "I'm feeling lucky" radio by adding the `lucky` or `radio` argument after `shuffle`:
#### Shuffle the "Last added" playlist

Trigger: `shuffle latest`

![Shuffle radio](http://imgur.com/C545hPD.png)
![Shuffle Last added playlist](http://i.imgur.com/MOeSEaL.png)

#### Play "I'm feeling lucky" radio

Trigger: `shuffle lucky` or `shuffle radio`

![Play I'm lucky radio radio](http://i.imgur.com/b8dbvyK.png)

### Download

Expand All @@ -22,6 +31,10 @@ You'll need to have the Powerpack to use this workflow.

### Changelog

#### 1.1 – October 3, 2015

* Added support for the "Last added" playlist

#### 1.0.2

* Added support for the "I'm feeling lucky" radio
Expand Down
Binary file modified google-music-shuffle.alfredworkflow
Binary file not shown.
11 changes: 9 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<key>keyword</key>
<string>shuffle</string>
<key>subtext</key>
<string>Shuffle on Google Music</string>
<string>Optional arguments: latest, lucky, or radio</string>
<key>text</key>
<string>Shuffle music</string>
<key>withspace</key>
Expand All @@ -54,6 +54,8 @@
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>127</integer>
<key>script</key>
Expand Down Expand Up @@ -104,10 +106,15 @@ on gmusicSendAction()
-- 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
Expand All @@ -133,7 +140,7 @@ 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 "I'm feeling lucky" radio by adding the `lucky` or `radio` argument after shuffle.</string>
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>
Expand Down
7 changes: 6 additions & 1 deletion shuffle.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ on gmusicSendAction()
delay 0.5
end repeat

-- Click the shuffle or "I'm feeling lucky" button
-- Click the shuffle, Latest playlist, 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

-- Open the queue window
tell active tab of first window to execute javascript "document.querySelector('[data-id=\"queue\"]' ).click();"

end tell
end gmusicSendAction

Expand Down

0 comments on commit b0a5d7f

Please sign in to comment.