groovebasin/lib/plugins/delete.js
Andrew Kelley 83ec17de20 fix download plugin
also use config.js for config vars instead of leveldb
2013-09-26 04:21:31 -04:00

23 lines
546 B
JavaScript

var fs = require('fs');
var path = require('path');
module.exports = Delete;
function Delete(gb) {
this.gb = gb;
this.gb.on('socketConnect', onSocketConnection.bind(this));
}
function onSocketConnection(client) {
var self = this;
client.on('DeleteFromLibrary', function(data) {
if (!client.permissions.admin) {
console.warn("User without admin permission trying to delete songs");
return;
}
var files = JSON.parse(data);
files.forEach(function(file) {
self.gb.player.deleteFile(file);
});
});
}