Added backend functionality for channel playlist deletion
This commit is contained in:
parent
37f7f21c5a
commit
65b5ae9371
2 changed files with 36 additions and 1 deletions
|
|
@ -596,6 +596,26 @@ channelSchema.methods.getPlaylistByName = function(name){
|
|||
return foundPlaylist;
|
||||
}
|
||||
|
||||
channelSchema.methods.deletePlaylistByName = async function(name){
|
||||
//Create null value to hold our found playlist
|
||||
let foundIndex = null;
|
||||
|
||||
//Crawl through active playlists
|
||||
this.playlistCrawl((playlist, listIndex) => {
|
||||
//If we found a match based on name
|
||||
if(playlist.name == name){
|
||||
//Yoink it's index
|
||||
foundIndex = listIndex;
|
||||
}
|
||||
});
|
||||
|
||||
//splice out the given playlist
|
||||
this.media.playlists.splice(foundIndex, 1);
|
||||
|
||||
//save the channel document
|
||||
await this.save();
|
||||
}
|
||||
|
||||
channelSchema.methods.addToPlaylist = async function(name, media){
|
||||
//Create variable to hold found index
|
||||
let foundIndex = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue