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
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

View file

@ -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;

View file

@ -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;
}