close grooveFile instances at the correct time. closes #200
This commit is contained in:
parent
d17157fcc9
commit
92f0c80e9f
1 changed files with 15 additions and 4 deletions
|
|
@ -266,6 +266,8 @@ function Player(db, musicDirectory) {
|
|||
this.lastEncodeItem = null;
|
||||
this.lastEncodePos = null;
|
||||
this.expectHeaders = true;
|
||||
|
||||
this.playlistItemDeleteQueue = [];
|
||||
}
|
||||
|
||||
Player.prototype.initialize = function(cb) {
|
||||
|
|
@ -1116,10 +1118,7 @@ Player.prototype.removePlaylistItems = function(ids) {
|
|||
|
||||
delCmds.push({type: 'del', key: PLAYLIST_KEY_PREFIX + id});
|
||||
|
||||
if (item.grooveFile) closeFile(item.grooveFile);
|
||||
// we set this so that any callbacks that return which were trying to
|
||||
// set the grooveItem can check if the item got deleted
|
||||
item.deleted = true;
|
||||
if (item.grooveFile) this.playlistItemDeleteQueue.push(item);
|
||||
if (item === this.currentTrack) {
|
||||
this.currentTrack = null;
|
||||
currentTrackChanged = true;
|
||||
|
|
@ -1597,11 +1596,23 @@ function playlistChanged(self) {
|
|||
self.pausedTime = 0;
|
||||
}
|
||||
checkUpdateGroovePlaylist(self);
|
||||
performGrooveFileDeletes(self);
|
||||
|
||||
self.checkDynamicMode();
|
||||
|
||||
self.emit('playlistUpdate');
|
||||
}
|
||||
|
||||
function performGrooveFileDeletes(self) {
|
||||
while (self.playlistItemDeleteQueue.length) {
|
||||
var item = self.playlistItemDeleteQueue.shift();
|
||||
// we set this so that any callbacks that return which were trying to
|
||||
// set the grooveItem can check if the item got deleted
|
||||
item.deleted = true;
|
||||
closeFile(item.grooveFile);
|
||||
}
|
||||
}
|
||||
|
||||
function preloadFile(self, track) {
|
||||
var relPath = self.libraryIndex.trackTable[track.key].file;
|
||||
var fullPath = path.join(self.musicDirectory, relPath);
|
||||
|
|
|
|||
Loading…
Reference in a new issue