2024-12-04 20:05:58 -05:00
|
|
|
class Session {
|
2024-12-05 03:27:45 -05:00
|
|
|
#id = null;
|
|
|
|
#started = null;
|
|
|
|
#current = null;
|
|
|
|
#lastScrobble = null;
|
|
|
|
#pauseDuration = 0;
|
|
|
|
|
2024-12-04 20:05:58 -05:00
|
|
|
constructor(id) {
|
2024-12-05 03:27:45 -05:00
|
|
|
this.#id = id;
|
|
|
|
this.#started = Date.now();
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get id() {
|
2024-12-05 03:27:45 -05:00
|
|
|
return this.#id;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get playing() {
|
2024-12-05 03:27:45 -05:00
|
|
|
return this.#current;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
set playing(value) {
|
2024-12-05 03:27:45 -05:00
|
|
|
console.log('playing =', value);
|
|
|
|
this.#current = value;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get started() {
|
2024-12-05 03:27:45 -05:00
|
|
|
return this.#started;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get lastScrobbleTimestamp() {
|
2024-12-05 03:27:45 -05:00
|
|
|
return this.#lastScrobble;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
set lastScrobbleTimestamp(value) {
|
2024-12-05 03:27:45 -05:00
|
|
|
this.#lastScrobble = value;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get pauseDuration() {
|
2024-12-05 03:27:45 -05:00
|
|
|
return this.#pauseDuration;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
set pauseDuration(value) {
|
2024-12-05 03:27:45 -05:00
|
|
|
this.#pauseDuration = value;
|
2024-12-04 20:05:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Session;
|