Compare commits

..

No commits in common. "2b2cc20a1d2c07bc14099e9733bc5c268dde4b27" and "748d9de02ac37646ec5618d9d47ecd509ca7d377" have entirely different histories.

5 changed files with 93 additions and 109 deletions

2
.gitignore vendored
View File

@ -4,4 +4,4 @@ config/*
!config/configuration.js !config/configuration.js
!config.schema.js !config.schema.js
credentials.* credentials.*
*.yml config*.yml

View File

@ -14,4 +14,4 @@ COPY . .
EXPOSE ${WEB_PORT} EXPOSE ${WEB_PORT}
CMD ["npm", "run", "start"] CMD [ "node", "app.js" ]

13
app.js
View File

@ -10,16 +10,11 @@ const Recorder = require("./services/recorder");
const MalojaScrobbler = require("./services/scrobblers/maloja-scrobbler"); const MalojaScrobbler = require("./services/scrobblers/maloja-scrobbler");
let trackers = [] const maloja = new MalojaScrobbler(config.maloja, logger);
trackers = trackers.concat(config.spotify.map(config => new SpotifyTracker(config))); const spotify = new SpotifyTracker(config.spotify);
trackers = trackers.concat(config.plex.map(config => new PlexTracker(config)));
const uniqueSpotifys = new Set(config.spotify.map(c => c.client_id));
for (let spotify of uniqueSpotifys)
(async () => await spotify.loadCredentials())(); (async () => await spotify.loadCredentials())();
const plex = new PlexTracker(config.plex);
const scrobblers = config.maloja.map(config => new MalojaScrobbler(config, logger)); const recorder = new Recorder(sessions, [plex, spotify], [maloja], config.scrobble, logger);
const recorder = new Recorder(sessions, trackers, scrobblers, config.scrobble, logger);
setInterval(() => recorder.record(), 5000); setInterval(() => recorder.record(), 5000);

View File

@ -3,8 +3,6 @@ const schema = {
required: [], required: [],
properties: { properties: {
maloja: { maloja: {
type: 'array',
items: {
type: 'object', type: 'object',
required: ['name', 'url', 'token'], required: ['name', 'url', 'token'],
properties: { properties: {
@ -18,11 +16,8 @@ const schema = {
type: 'string' type: 'string'
}, },
} }
}
}, },
plex: { plex: {
type: 'array',
items: {
type: 'object', type: 'object',
required: ['name', 'url', 'token', 'scrobblers'], required: ['name', 'url', 'token', 'scrobblers'],
properties: { properties: {
@ -87,7 +82,6 @@ const schema = {
minItems: 1 minItems: 1
} }
} }
}
}, },
scrobble: { scrobble: {
@ -108,8 +102,6 @@ const schema = {
}, },
spotify: { spotify: {
type: 'array',
items: {
type: 'object', type: 'object',
required: ['name', 'client_id', 'client_secret', 'redirect_uri', 'scrobblers'], required: ['name', 'client_id', 'client_secret', 'redirect_uri', 'scrobblers'],
properties: { properties: {
@ -133,7 +125,6 @@ const schema = {
minItems: 1 minItems: 1
} }
} }
}
}, },
web: { web: {

View File

@ -3,8 +3,6 @@
"version": "0.0.0", "version": "0.0.0",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"start": "NODE_ENV=production node app.js",
"dev": "NODE_ENV=development node app.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "", "author": "",