Finished up with backend for user playlists
This commit is contained in:
parent
aefc2dc1bd
commit
ed78bc7dfc
2 changed files with 507 additions and 124 deletions
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue