Finished up with Playlist Managment UI.
This commit is contained in:
parent
c8c59feb7f
commit
f21b66fae0
7 changed files with 180 additions and 42 deletions
|
|
@ -35,6 +35,7 @@ module.exports = class{
|
|||
socket.on("getChannelPlaylists", () => {this.getChannelPlaylists(socket)});
|
||||
socket.on("createChannelPlaylist", (data) => {this.createChannelPlaylist(socket, data)});
|
||||
socket.on("deleteChannelPlaylist", (data) => {this.deleteChannelPlaylist(socket, data)});
|
||||
socket.on("deleteChannelPlaylistMedia", (data) => {this.deleteChannelPlaylistMedia(socket, data)});
|
||||
socket.on("addToChannelPlaylist", (data) => {this.addToChannelPlaylist(socket, data)});
|
||||
socket.on("queueChannelPlaylist", (data) => {this.queueChannelPlaylist(socket, data)});
|
||||
socket.on("renameChannelPlaylist", (data) => {this.renameChannelPlaylist(socket, data)});
|
||||
|
|
@ -290,4 +291,30 @@ module.exports = class{
|
|||
return loggerUtils.socketExceptionHandler(socket, err);
|
||||
}
|
||||
}
|
||||
|
||||
async deleteChannelPlaylistMedia(socket, data, chanDB){
|
||||
try{
|
||||
//if we wherent handed a channel document
|
||||
if(chanDB == null){
|
||||
//Pull it based on channel name
|
||||
chanDB = await channelModel.findOne({name: this.channel.name});
|
||||
}
|
||||
|
||||
//If we don't have a valid UUID
|
||||
if(!validator.isUUID(data.uuid)){
|
||||
//Bitch, moan, complain...
|
||||
loggerUtils.socketErrorHandler(socket, `'${data.uuid}' is not a valid UUID!`, "validation");
|
||||
//and ignore it!
|
||||
return;
|
||||
}
|
||||
|
||||
//Delete media from channel playlist
|
||||
chanDB.deletePlaylistMediaByUUID(data.playlist, data.uuid);
|
||||
|
||||
//Return playlists from channel doc
|
||||
socket.emit('chanPlaylists', chanDB.getPlaylists());
|
||||
}catch(err){
|
||||
return loggerUtils.socketExceptionHandler(socket, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue