Added scrobbling functionality. Changes all around to support scrobbling, such as named trackers and configuration changes.

This commit is contained in:
Tom
2024-12-05 17:32:37 +00:00
parent b30dc3396a
commit 5100d18ac6
10 changed files with 184 additions and 46 deletions

View File

@@ -2,10 +2,28 @@ const schema = {
type: 'object',
required: [],
properties: {
maloja: {
type: 'object',
required: ['name', 'url', 'token'],
properties: {
name: {
type: 'string'
},
url: {
type: 'string'
},
token: {
type: 'string'
},
}
},
plex: {
type: 'object',
required: ['url', 'token'],
required: ['name', 'url', 'token', 'scrobblers'],
properties: {
name: {
type: 'string'
},
url: {
type: 'string'
},
@@ -55,6 +73,13 @@ const schema = {
},
}
}
},
scrobblers: {
type: 'array',
items: {
type: 'string'
},
minItems: 1
}
}
},
@@ -78,8 +103,11 @@ const schema = {
spotify: {
type: 'object',
required: ['client_id', 'client_secret', 'redirect_uri'],
required: ['name', 'client_id', 'client_secret', 'redirect_uri', 'scrobblers'],
properties: {
name: {
type: 'string'
},
client_id: {
type: 'string'
},
@@ -88,6 +116,13 @@ const schema = {
},
redirect_uri: {
type: 'string'
},
scrobblers: {
type: 'array',
items: {
type: 'string'
},
minItems: 1
}
}
},

View File

@@ -5,9 +5,11 @@ const yaml = require("js-yaml");
const configurationBase = {
plex: {
name: null,
url: null,
token: null,
filters: [] // { library, ip, deviceId, platform, product }
filters: [], // { library, ip, deviceId, platform, product }
scrobblers: []
},
scrobble: {
minimum: {
@@ -16,9 +18,11 @@ const configurationBase = {
},
},
spotify: {
name: null,
client_id: null,
client_secret: null,
redirect_uri: null
redirect_uri: null,
scrobblers: []
},
web: {
host: null,
@@ -27,7 +31,6 @@ const configurationBase = {
};
const configurationFile = yaml.load(fs.readFileSync('config/config.yml'), yaml.JSON_SCHEMA);
const configuration = { ...configurationBase, ...configurationFile }
const ajv = new Ajv({ allErrors: true });
const schema = require("./config.schema");
@@ -40,4 +43,5 @@ if (!valid) {
(async () => { await new Promise(resolve => setTimeout(resolve, 1000)); exit(1); })();
}
const configuration = { ...configurationBase, ...configurationFile }
module.exports = configuration;