Finished up with backend for user playlists

This commit is contained in:
rainbow napkin 2025-04-07 03:49:20 -04:00
parent aefc2dc1bd
commit ed78bc7dfc
2 changed files with 507 additions and 124 deletions

View file

@ -91,9 +91,19 @@ playlistSchema.methods.deleteMedia = function(uuid){
this.media = keptMedia;
}
playlistSchema.methods.pickDefaultTitle = function(){
//Grab a random default title and return it
return this.defaultTitles[Math.floor(Math.random() * this.defaultTitles.length)];
playlistSchema.methods.pickDefaultTitle = function(title){
//If we don't have default titles in this playlist
if(this.defaultTitles.length <= 0){
//If we wheren't handed an original title
if(title == null || title == ''){
return 'Unnamed Media'
}else{
return title;
}
}else{
//Grab a random default title and return it
return this.defaultTitles[Math.floor(Math.random() * this.defaultTitles.length)];
}
}
module.exports = playlistSchema;