Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})*/
.then(libFast.bind(self.parseTrackInfo, self))
.then(function(trackinfo) {
collectedState.title = trackinfo.title;
collectedState.artist = trackinfo.artist;
collectedState.album = trackinfo.album;
collectedState.albumart = trackinfo.albumart;
return libQ.resolve(collectedState);
});
// Else return null track info
} else {
collectedState.title = null;
collectedState.artist = null;
collectedState.album = null;
collectedState.albumart = null;
return libQ.resolve(collectedState);
}
});
};
.then(function() {
// Then process the next task
var curTask = self.arrayTaskStack.shift();
var sTable = curTask.table;
var sKey = curTask.key;
var promisedSubTasks = libQ.resolve();
if (!(sTable in self.metadataCache)) {
self.metadataCache[sTable] = {};
}
if (!(sKey in self.metadataCache[sTable])) {
self.metadataCache[sTable][sKey] = {};
}
// All objects will first get their MBID (Musicbrainz ID) stored
var sType = self.musicLibrary.library[sTable][sKey].type;
var sName = self.musicLibrary.library[sTable][sKey].name;
if (!('mbid' in self.metadataCache[sTable][sKey])) {
promisedSubTasks = promisedSubTasks
.then(function() {
return self.fetchMbid(sType, sName);
Newer.prototype._transform = function(srcFile, encoding, done) {
if (!srcFile || !srcFile.stat) {
done(new PluginError(PLUGIN_NAME, 'Expected a source file with stats'));
return;
}
var self = this;
Q.resolve([this._destStats, this._extraStats])
.spread(function(destStats, extraStats) {
if ((destStats && destStats.isDirectory()) || self._ext || self._map) {
// stat dest/relative file
var relative = srcFile.relative;
var ext = path.extname(relative);
var destFileRelative = self._ext
? relative.substr(0, relative.length - ext.length) + self._ext
: relative;
if (self._map) {
destFileRelative = self._map(destFileRelative);
}
var destFileJoined = self._dest
? path.join(self._dest, destFileRelative)
: destFileRelative;
return Q.all([Q.nfcall(fs.stat, destFileJoined), extraStats]);
} else {
function makeLiteralHandler(val) {
val = val && val._literal ? val._literal : val
// Wrap undefined in a promise so we know it's there
var handlerVal = typeof val == 'undefined' ? Q.resolve(val) : val
var fn = function () {
return handlerVal
}
fn._literal = val
return fn
}
builder.add(function testAddToNullSet(test) {
var set = null
var additions = typeUtil.valueToObject([4])
test.equal(typeUtil.objectToType(additions), 'NS')
var modified = typeUtil.addToSet(set, additions)
test.equal(typeUtil.objectToType(modified), 'NS')
modified.NS.sort()
test.deepEqual(modified.NS, [4].map(String))
return Q.resolve()
})
"userId": "userA",
"column": "@",
"age": 29,
"someStringSet": ['a', 'b', 'c']
})
var updated = localUpdater.update(data, {
'someStringSet': {
Action: 'PUT',
Value: typeUtil.valueToObject(['b','c','d'])
}
})
test.deepEqual(data.someStringSet.SS, ['a', 'b', 'c'], 'someStringSet should not change')
test.deepEqual(updated.someStringSet.SS, ['b', 'c', 'd'], 'someStringSet should equal [\'b\', \'c\', \'d\']')
return Q.resolve()
})
return checkPhantomjsVersion(resolvedLocation).then(function (matches) {
if (matches) {
return kew.resolve(resolvedLocation)
}
})
}
CoreStateMachine.prototype.resetVolumioState = function () {
var self = this;
return libQ.resolve()
.then(function () {
self.commandRouter.pushConsoleMessage('[' + Date.now() + '] ' + 'CoreStateMachine::resetVolumioState');
self.currentStatus = 'stop';
self.currentPosition = 0;
self.currentSeek = 0;
self.currentDuration = 0;
self.currentTrackBlock = [];
self.timeLastServiceStateUpdate = 0;
this.currentTrackType = null;
self.timerPlayback = null;
self.currentTitle = null;
self.currentArtist = null;
self.currentAlbum = null;
self.currentUri = null;
self.currentAlbumArt = '/albumart';
self.currentSampleRate = null;
if (numFiles > 0) {
var file = payload['file0'];
var destFile = app.upload.dir + '/' + file.name;
var defer = Q.defer();
fs.rename(file.path, destFile, function(error) {
if (error) return defer.reject(error);
doc.file.url = '/upload/' + file.name;
defer.resolve(doc);
});
return defer.promise;
}
}
return Q.resolve(doc);
};
function setValues(valueMap, keys, values) {
for (var i = 0; i < keys.length; i++) {
valueMap[keys[i]] = values[i]
}
return Q.resolve(values)
}