A few minor fixes

This commit is contained in:
calzoneman 2013-07-03 16:04:50 -04:00
parent 8a54000097
commit d34301e2e2
3 changed files with 7 additions and 3 deletions

View File

@ -159,6 +159,8 @@ Channel.prototype.loadDump = function() {
// Old // Old
if(data.queue) { if(data.queue) {
if(data.position < 0)
data.position = 0;
for(var i = 0; i < data.queue.length; i++) { for(var i = 0; i < data.queue.length; i++) {
var e = data.queue[i]; var e = data.queue[i];
var m = new Media(e.id, e.title, e.seconds, e.type); var m = new Media(e.id, e.title, e.seconds, e.type);
@ -167,10 +169,11 @@ Channel.prototype.loadDump = function() {
: ""; : "";
p.temp = e.temp; p.temp = e.temp;
this.playlist.items.append(p); this.playlist.items.append(p);
if(i == data.position)
this.playlist.current = p;
} }
this.sendAll("playlist", this.playlist.items.toArray()); this.sendAll("playlist", this.playlist.items.toArray());
this.broadcastPlaylistMeta(); this.broadcastPlaylistMeta();
this.playlist.current = this.playlist.first;
this.playlist.startPlayback(); this.playlist.startPlayback();
} }
// Current // Current

View File

@ -360,6 +360,8 @@ Playlist.prototype.lead = function(lead) {
} }
Playlist.prototype.startPlayback = function(time) { Playlist.prototype.startPlayback = function(time) {
if(!this.current || !this.current.media)
return false;
this.current.media.paused = false; this.current.media.paused = false;
this.current.media.currentTime = time || -1; this.current.media.currentTime = time || -1;
var pl = this; var pl = this;

View File

@ -35,12 +35,11 @@ function populateChannelOwners() {
var channels = res.fetchAllSync(); var channels = res.fetchAllSync();
channels.forEach(function(chan) { channels.forEach(function(chan) {
chan = chan.name; chan = chan.name;
console.log("Fixing " + chan);
query = "SELECT name FROM `chan_"+chan+"_ranks` WHERE rank>=10 ORDER BY rank"; query = "SELECT name FROM `chan_"+chan+"_ranks` WHERE rank>=10 ORDER BY rank";
res = db.querySync(query); res = db.querySync(query);
if(!res) { if(!res) {
console.log(db); console.log(db);
console.log("Update failed!"); console.log("failed to fix "+chan);
return; return;
} }