30 lines
542 B
JavaScript
30 lines
542 B
JavaScript
class AggregateTracker {
|
|
#name = null;
|
|
#trackers = []
|
|
provider = null;
|
|
|
|
constructor(name, trackers) {
|
|
this.#name = name;
|
|
this.#trackers = trackers;
|
|
}
|
|
|
|
get name() {
|
|
return this.#name;
|
|
}
|
|
|
|
get scrobblerNames() {
|
|
return this.#trackers.map(t => t.scrobblerNames)
|
|
.flat()
|
|
.filter((v, i, a) => a.indexOf(v) == i);
|
|
}
|
|
|
|
async poll() {
|
|
let media = []
|
|
for (let tracker of this.#trackers)
|
|
media = media.concat(await tracker.poll());
|
|
|
|
return media;
|
|
}
|
|
}
|
|
|
|
module.exports = AggregateTracker; |