mirror of https://github.com/calzoneman/sync.git
Fix playlist movement bug (Issue#16)
This commit is contained in:
parent
fab4039fc1
commit
c175f461d1
14
channel.js
14
channel.js
|
@ -70,7 +70,10 @@ var Channel = function(name) {
|
||||||
pl: this.queue
|
pl: this.queue
|
||||||
});
|
});
|
||||||
this.currentPosition = data.currentPosition - 1;
|
this.currentPosition = data.currentPosition - 1;
|
||||||
this.playNext();
|
if(this.currentPosition < -1)
|
||||||
|
this.currentPosition = -1;
|
||||||
|
if(this.queue.length > 0)
|
||||||
|
this.playNext();
|
||||||
this.opts = data.opts;
|
this.opts = data.opts;
|
||||||
if(data.filters) {
|
if(data.filters) {
|
||||||
this.filters = new Array(data.filters.length);
|
this.filters = new Array(data.filters.length);
|
||||||
|
@ -750,8 +753,13 @@ Channel.prototype.moveMedia = function(data) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var media = this.queue[data.src];
|
var media = this.queue[data.src];
|
||||||
this.queue.splice(data.dest + 1, 0, media);
|
// Took me a while to figure out why the queue was going insane
|
||||||
this.queue.splice(data.src, 1);
|
// Gotta account for when you've copied it to the destination
|
||||||
|
// but not removed the source yet
|
||||||
|
var dest = data.dest > data.src ? data.dest + 1 : data.dest;
|
||||||
|
var src = data.dest > data.src ? data.src : data.src + 1;
|
||||||
|
this.queue.splice(dest, 0, media);
|
||||||
|
this.queue.splice(src, 1);
|
||||||
this.sendAll("moveVideo", {
|
this.sendAll("moveVideo", {
|
||||||
src: data.src,
|
src: data.src,
|
||||||
dest: data.dest
|
dest: data.dest
|
||||||
|
|
Loading…
Reference in New Issue