Skip to content

Instantly share code, notes, and snippets.

@iolate
Created Jan 6, 2017
Embed
What would you like to do?
BeardedSpice MediaStrategy for Soribada
//
// Soribada.js
// BeardedSpice
//
// Created by iolate <iolate@me.com> 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