forked from beardedspice/beardedspice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-explained.js
48 lines (43 loc) · 1.72 KB
/
template-explained.js
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
//
// NewStrategyName.js
// BeardedSpice
//
// Created by You on Today's Date.
// 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: "Strategy Name",
accepts: {
method: "predicateOnTab" /* OR "script" */,
/* Use these if "predicateOnTab" */
format: "%K LIKE[c] '*[YOUR-URL-DOMAIN-OR-TITLE-HERE]*'",
args: ["URL" /* OR "title" */]
/* Use "script" if method is "script" */
/* [ex] script: "some javascript here that returns a boolean value" */
},
isPlaying: function () { /* javascript that returns a boolean */ },
toggle: function () { /* toggle site playing */ },
previous: function () { /* switch to previous track if any */ },
next: function () { /* switch to next track if any */ },
pause: function () { /* pause site playing */ },
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': 'the name of the track',
'album': 'the name of the current album',
'artist': 'the name of the current artist',
'image': 'http://www.example.com/some/album/artwork.png',
'favorited': 'true/false if the track has been favorited',
};
}
}
// The file must have an empty line at the end.