2024-12-04 23:18:35 -05:00
|
|
|
class AggregateTracker {
|
2024-12-05 12:32:37 -05:00
|
|
|
#name = null;
|
2024-12-05 03:26:31 -05:00
|
|
|
#trackers = []
|
2024-12-05 12:32:37 -05:00
|
|
|
provider = null;
|
2024-12-05 03:26:31 -05:00
|
|
|
|
2024-12-05 12:32:37 -05:00
|
|
|
constructor(name, trackers) {
|
|
|
|
this.#name = name;
|
2024-12-05 03:26:31 -05:00
|
|
|
this.#trackers = trackers;
|
2024-12-04 23:18:35 -05:00
|
|
|
}
|
|
|
|
|
2024-12-05 12:32:37 -05:00
|
|
|
get name() {
|
|
|
|
return this.#name;
|
|
|
|
}
|
|
|
|
|
|
|
|
get scrobblerNames() {
|
|
|
|
return this.#trackers.map(t => t.scrobblerNames)
|
|
|
|
.flat()
|
|
|
|
.filter((v, i, a) => a.indexOf(v) == i);
|
|
|
|
}
|
|
|
|
|
2024-12-05 03:26:31 -05:00
|
|
|
async poll() {
|
|
|
|
let media = []
|
|
|
|
for (let tracker of this.#trackers)
|
|
|
|
media = media.concat(await tracker.poll());
|
2024-12-04 23:18:35 -05:00
|
|
|
|
|
|
|
return media;
|
|
|
|
}
|
2024-12-05 03:26:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AggregateTracker;
|