forked from beardedspice/BS-Strategies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerFM.bsstrategy
53 lines (47 loc) · 2.01 KB
/
PlayerFM.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
45
46
47
48
49
50
51
52
53
//
// PlayerFM.js
// BeardedSpice
//
// Created by Lukasz Chojnowski on 1 May 2019.
// Copyright (c) 2015-2017 GPL v3 http://www.gnu.org/licenses/gpl.html
//
// We put the copyright inside the plist to retain consistent syntax coloring.
// Use a syntax checker to ensure validity. One is provided by nodejs (`node -c filename.js`)
// Normal formatting is supported (can copy/paste with newlines and indentations)
BSStrategy = {
version: 1,
displayName: "Player FM",
accepts: {
method: "predicateOnTab" /* OR "script" */,
/* Use these if "predicateOnTab" */
format: "%K LIKE[c] '*player.fm*'",
args: ["URL" /* OR "title" */]
/* Use "script" if method is "script" */
/* [ex] script: "some javascript here that returns a boolean value" */
},
isPlaying: function () { return document.querySelector('.miniplayer.episode.populated-selections.paused') === null },
toggle: function () {
if (document.querySelector('.miniplayer.episode.populated-selections.paused') === null) {
document.querySelector('.control.pause').click();
} else {
document.querySelector('.control.play').click();
}
},
previous: function () { document.querySelector('.control.fast-backward').click(); },
next: function () { document.querySelector('.control.fast-forward').click(); },
pause: function () { document.querySelector('.control.pause').click() },
favorite: function () { /* toggles favorite on/off */},
/*
- Return a dictionary of namespaced key/values here.
All manipulation should be supported in javascript.
- Namespaced keys currently supported include: track, album, artist, favorited, image (URL)
*/
trackInfo: function () {
return {
'track': document.querySelector('a.current-series-link').innerText,
'album': document.querySelector('a.current-episode-link').innerText,
'image': document.querySelector('a.thumb img').getAttribute('src')
};
}
}
// The file must have an empty line at the end.