Created
January 6, 2017 18:25
-
-
Save iolate/d6af2f076fa8674c366077215477b26e to your computer and use it in GitHub Desktop.
BeardedSpice MediaStrategy for Soribada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Soribada.js | |
// BeardedSpice | |
// | |
// Created by iolate <[email protected]> on 2016. 12. 28.. | |
// Copyright © 2016 GPL v3 http://www.gnu.org/licenses/gpl.html | |
// | |
// http://www.soribada.com/ | |
// | |
BSStrategy = { | |
version: 1, | |
displayName: "Soribada", | |
accepts: { | |
method: "predicateOnTab", | |
format: "%K LIKE[c] '*www.soribada.com*'", | |
args: ["URL"] | |
}, | |
isPlaying: function () { return !S.app.player.player.getIsPaused(); }, | |
toggle: function () { document.querySelector('#play').click(); }, | |
previous: function () { document.querySelector('#prev').click(); }, | |
next: function () { document.querySelector('#next').click(); }, | |
pause: function () { S.app.player.player.pause(); }, | |
favorite: function () { document.querySelector('#favorite').click(); }, | |
trackInfo: function () { | |
var song = S.app.player.model.attributes.songs[S.app.player.model.attributes.position]; | |
return { | |
'track': song.attributes['Name'], | |
'album': song.attributes["Album"].Name, | |
'artist': song.attributes['Artists'].Artist.map(function(a) {return a.Name;}).join(', '), | |
'image': S.app.player.model.attributes['cover'], | |
'favorited': song.attributes['favorite'], | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment