MPD protocol: update command supports uri argument
This commit is contained in:
parent
9be515c764
commit
667fd0c76f
2 changed files with 19 additions and 13 deletions
|
|
@ -208,7 +208,7 @@ Player.prototype.initialize = function(cb) {
|
|||
return;
|
||||
}
|
||||
|
||||
self.dirScanQueue.add(self.musicDirectory, self.musicDirectory);
|
||||
self.requestUpdateDb();
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
|
@ -253,6 +253,11 @@ Player.prototype.initialize = function(cb) {
|
|||
}
|
||||
};
|
||||
|
||||
Player.prototype.requestUpdateDb = function(dirName) {
|
||||
var fullPath = path.resolve(this.musicDirectory, dirName || "");
|
||||
this.dirScanQueue.add(fullPath, fullPath);
|
||||
};
|
||||
|
||||
Player.prototype.refreshFilesIndex = function(dir, cb) {
|
||||
var self = this;
|
||||
var walker = findit(dir, {followSymlinks: true});
|
||||
|
|
|
|||
|
|
@ -146,9 +146,6 @@ var commands = {
|
|||
cb();
|
||||
},
|
||||
},
|
||||
"config": {
|
||||
permission: 'disabled',
|
||||
},
|
||||
"consume": {
|
||||
permission: 'control',
|
||||
args: [
|
||||
|
|
@ -251,12 +248,6 @@ var commands = {
|
|||
cb();
|
||||
},
|
||||
},
|
||||
"disableoutput": {
|
||||
permission: 'disabled',
|
||||
},
|
||||
"enableoutput": {
|
||||
permission: 'disabled',
|
||||
},
|
||||
"find": {
|
||||
permission: 'read',
|
||||
manualArgParsing: true,
|
||||
|
|
@ -285,9 +276,6 @@ var commands = {
|
|||
},
|
||||
},
|
||||
"idle": {}, // handled in a special case
|
||||
"kill": {
|
||||
permission: 'disabled',
|
||||
},
|
||||
"list": {
|
||||
permission: 'read',
|
||||
manualArgParsing: true,
|
||||
|
|
@ -934,7 +922,20 @@ var commands = {
|
|||
},
|
||||
"update": {
|
||||
permission: 'admin',
|
||||
args: [
|
||||
{
|
||||
name: 'uri',
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
],
|
||||
fn: function (self, socket, args, cb) {
|
||||
var dirEntry = self.gb.player.dirs[args.uri || ""];
|
||||
if (!dirEntry) {
|
||||
cb(ERR_CODE_ARG, "Malformed path");
|
||||
return;
|
||||
}
|
||||
self.gb.player.requestUpdateDb(dirEntry.dirName);
|
||||
socket.write("updating_db: 1\n");
|
||||
cb();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue