forked from jmt-gh/audiobookshelf-sonos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsonos-service.js
executable file
·36 lines (34 loc) · 1.14 KB
/
sonos-service.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
const { getMetadataResult, getMediaURI, getMediaMetadataResult} = require("./utils");
const sonosService = {
Sonos: {
SonosSoap: {
getMetadata: function (args) {
let type = args["id"]; // "root" or station id
switch (type) {
case "root": // first request after selecting "ARD Audiothek" in the Sonos app. Returns the list of institutions as folders.
return getMetadataResult(type);
default: // request after selecting a specific item inside a folder
return getMetadataResult(type);
}
},
getMediaMetadata: function (args) {
return getMediaMetadataResult(args);
},
// get the actual stream url of the radio station
getMediaURI: function (args) {
return getMediaURI(args["id"]);
},
getLastUpdate: function (args) {
return {
getLastUpdateResult: {
catalog: `${Date.now()}`, // just force update every single time :D
autoRefreshEnabled: true,
favorites: `${Date.now()}`,
pollInterval: 10,
},
};
},
},
},
};
module.exports = sonosService;