Added persistent rescheduling of nowPlaying after server goes down.
This commit is contained in:
parent
179a10fb72
commit
a41541d07b
10 changed files with 124 additions and 25 deletions
|
|
@ -19,16 +19,44 @@ const {mongoose} = require('mongoose');
|
|||
|
||||
//Local Imports
|
||||
const mediaSchema = require('./mediaSchema');
|
||||
const queuedMedia = require('../../../app/channel/media/queuedMedia');
|
||||
|
||||
const queuedProperties = new mongoose.Schema({
|
||||
startTime: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
},
|
||||
startTimeStamp: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: false,
|
||||
},
|
||||
earlyEnd: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: false,
|
||||
},
|
||||
uuid: {
|
||||
type: mongoose.SchemaTypes.UUID,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
discriminatorKey: 'status'
|
||||
});
|
||||
|
||||
module.exports = mediaSchema.descriminiator('queued', queuedProperties);
|
||||
//methods
|
||||
queuedProperties.methods.rehydrate = function(){
|
||||
return new queuedMedia(
|
||||
this.title,
|
||||
this.fileName,
|
||||
this.url,
|
||||
this.id,
|
||||
this.type,
|
||||
this.duration,
|
||||
this.startTime,
|
||||
this.startTimeStamp,
|
||||
this.earlyEnd,
|
||||
this.uuid.toString()
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = mediaSchema.discriminator('queued', queuedProperties);
|
||||
Loading…
Add table
Add a link
Reference in a new issue