diff --git a/channel.js b/channel.js index 97942c67..daa3720f 100644 --- a/channel.js +++ b/channel.js @@ -159,6 +159,8 @@ Channel.prototype.loadDump = function() { // Old if(data.queue) { + if(data.position < 0) + data.position = 0; for(var i = 0; i < data.queue.length; i++) { var e = data.queue[i]; var m = new Media(e.id, e.title, e.seconds, e.type); @@ -167,10 +169,11 @@ Channel.prototype.loadDump = function() { : ""; p.temp = e.temp; this.playlist.items.append(p); + if(i == data.position) + this.playlist.current = p; } this.sendAll("playlist", this.playlist.items.toArray()); this.broadcastPlaylistMeta(); - this.playlist.current = this.playlist.first; this.playlist.startPlayback(); } // Current diff --git a/playlist.js b/playlist.js index 56679943..1e0005d8 100644 --- a/playlist.js +++ b/playlist.js @@ -360,6 +360,8 @@ Playlist.prototype.lead = function(lead) { } Playlist.prototype.startPlayback = function(time) { + if(!this.current || !this.current.media) + return false; this.current.media.paused = false; this.current.media.currentTime = time || -1; var pl = this; diff --git a/update.js b/update.js index 1c9e93ce..dc1602c5 100644 --- a/update.js +++ b/update.js @@ -35,12 +35,11 @@ function populateChannelOwners() { var channels = res.fetchAllSync(); channels.forEach(function(chan) { chan = chan.name; - console.log("Fixing " + chan); query = "SELECT name FROM `chan_"+chan+"_ranks` WHERE rank>=10 ORDER BY rank"; res = db.querySync(query); if(!res) { console.log(db); - console.log("Update failed!"); + console.log("failed to fix "+chan); return; }