work on streamer

This commit is contained in:
bkfox
2019-09-21 17:44:23 +02:00
parent d3f39c5ade
commit cbfd1c1449
2 changed files with 10 additions and 8 deletions

View File

@ -13,8 +13,8 @@ export class Streamer extends Model {
if(!this.data)
this.data = { id: data.id, playlists: [], queues: [] }
data.playlists = Playlist.updateList(data.playlists, this.playlists)
data.queues = Queue.updateList(data.queues, this.queues)
data.playlists = Playlist.updateList(data.playlists, this.playlists, {streamer: this})
data.queues = Queue.updateList(data.queues, this.queues, {streamer: this})
super.commit(data)
}
}
@ -24,8 +24,9 @@ export class Request extends Model {
}
export class Source extends Model {
constructor(...args) {
super(...args);
constructor(data, {streamer=null, ...options}={}) {
super(data, options);
this.streamer = streamer;
setInterval(() => this.tick(), 1000)
}
@ -44,7 +45,6 @@ export class Source extends Model {
String(seconds).padStart(2, '0');
}
sync() { return this.action('sync/', {method: 'POST'}, true); }
skip() { return this.action('skip/', {method: 'POST'}, true); }
restart() { return this.action('restart/', {method: 'POST'}, true); }
@ -66,9 +66,10 @@ export class Source extends Model {
commit(data) {
if(data.air_time)
data.air_time = new Date(data.air_time);
Vue.set(this, 'remaining', data.remaining)
this.commitDate = Date.now()
super.commit(data)
Vue.set(this, 'remaining', data.remaining)
}
}