Skip to content

Commit

Permalink
Repeat/shuffle integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-m-s committed Sep 17, 2018
1 parent 1b9b1a3 commit 74fa997
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ Changelog
----------------

* Add Italian region support.
* Add playlist repeat integration.
* Add playlist shuffle integration.

5.7 - May 8th, 2018
-------------------
Expand Down
16 changes: 16 additions & 0 deletions integrate.js
Expand Up @@ -210,6 +210,14 @@
actionsEnabled[ACTION_THUMBS_DOWN] = !!elm
actionsStates[ACTION_THUMBS_DOWN] = (elm ? elm.attributes['aria-checked'].value === 'true' : false)

elm = document.querySelector('.shuffleButton')
actionsEnabled[PlayerAction.SHUFFLE] = !!elm
actionsStates[PlayerAction.SHUFFLE] = (elm ? elm.attributes['aria-checked'].value === 'true' : false)

elm = document.querySelector('.repeatButton')
actionsEnabled[PlayerAction.REPEAT] = !!elm
actionsStates[PlayerAction.REPEAT] = (elm && elm.attributes['aria-checked'].value === 'true' ? Nuvola.PlayerRepeat.PLAYLIST : Nuvola.PlayerRepeat.NONE)

This comment has been minimized.

Copy link
@jiri-janousek

jiri-janousek Sep 18, 2018

Member

Do I understand correctly that Nuvola.PlayerRepeat.TRACK is not supported by Amazon player?

This comment has been minimized.

Copy link
@a-m-s

a-m-s Sep 18, 2018

Author Contributor

That's correct, as far as I can tell.


Nuvola.actions.updateEnabledFlags(actionsEnabled)
Nuvola.actions.updateStates(actionsStates)
} catch (e) {}
Expand Down Expand Up @@ -305,6 +313,14 @@
button = document.querySelector('.thumbsDownButton')
if (button) Nuvola.clickOnElement(button)
break
case PlayerAction.SHUFFLE:
button = document.querySelector('.shuffleButton')
if (button) Nuvola.clickOnElement(button)
break
case PlayerAction.REPEAT:

This comment has been minimized.

Copy link
@jiri-janousek

jiri-janousek Sep 18, 2018

Member

This doesn't seem correct. If param is Nuvola.PlayerRepeat.TRACK, this call should do nothing but it toggles the repeat status. If param is Nuvola.PlayerRepeat.PLAYLIST and the repeat mode is already toggled on, this call should be ignored but it toggles the repeat mode off.

This comment has been minimized.

Copy link
@a-m-s

a-m-s Sep 18, 2018

Author Contributor

Hmm, OK. I can fix that.

button = document.querySelector('.repeatButton')
if (button) Nuvola.clickOnElement(button)
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion metadata.in.json
Expand Up @@ -6,7 +6,7 @@
"version_major": 5,
"version_minor": 7,
"api_major": 4,
"api_minor": 11,
"api_minor": 13,
"categories": "AudioVideo;Audio;",
"dark_theme": true,
"license": "2-Clause BSD-license",
Expand Down

0 comments on commit 74fa997

Please sign in to comment.