-
Notifications
You must be signed in to change notification settings - Fork 6
/
Qobuz.bsstrategy
44 lines (44 loc) · 1.68 KB
/
Qobuz.bsstrategy
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
//
// Qobuz.js
// BeardedSpice
//
// Created by Roman Sokolov on 15.10.16.
// Copyright (c) 2016 GPL v3 http://www.gnu.org/licenses/gpl.html
//
BSStrategy = {
version:1,
displayName:"Qobuz",
accepts: {
method: "predicateOnTab",
format:"%K LIKE[c] '*player.qobuz.com*'",
args: ["URL"]
},
isPlaying: function () {return qbPlayer.playerManager.isPlaying();},
toggle: function () {qbPlayer.playerManager.togglePause();},
next: function () {qbPlayer.playerManager.next();},
previous: function () {qbPlayer.playerManager.previous();},
pause: function () {if (qbPlayer.playerManager.isPlaying()) qbPlayer.playerManager.togglePause();},
favorite: function () {
if (qbPlayer.globalManager.isFavorite("track", qbPlayer.playerManager.currentTrack.id)) {
qbPlayer.actionManager.triggerEvent("deleteFromFavorites", {
type: "track",
ids: [qbPlayer.playerManager.currentTrack.id],
label: qbPlayer.playerManager.currentTrack.metadata.title});
}
else {
qbPlayer.actionManager.triggerEvent("addToFavorites", {
type: "track",
ids: [qbPlayer.playerManager.currentTrack.id],
label: qbPlayer.playerManager.currentTrack.metadata.title});
}
},
trackInfo: function () {
return {
track: qbPlayer.playerManager.currentTrack.metadata.title,
artist: qbPlayer.playerManager.currentTrack.metadata.artistName,
album: qbPlayer.playerManager.currentTrack.metadata.albumTitle,
favorited: qbPlayer.globalManager.isFavorite("track", qbPlayer.playerManager.currentTrack.id),
image: qbPlayer.playerManager.currentTrack.metadata.picture
};
}
}