diff --git a/drivers/mvcp/melted-node-driver.js b/drivers/mvcp/melted-node-driver.js index 1de951b..756961c 100644 --- a/drivers/mvcp/melted-node-driver.js +++ b/drivers/mvcp/melted-node-driver.js @@ -177,12 +177,22 @@ melted.prototype.sendClip = function(clip, command) { logger.debug(this.uuid + " - Generating file " + filename); logger.debug(this.uuid + " - Adding media [" + file + "] to file " + filename); - var video = new melted_xml.Producer.Video({ source: file, startFrame: clip.in, length: clip.length }); - xml.push(video); + var media = undefined; + if (clip.type === 'video') { + media = new melted_xml.Producer.Video({ source: file, startFrame: clip.in, length: clip.length }); + } else if (clip.type === 'image') { + media = new melted_xml.Producer.Image({ source: file, startFrame: clip.in, length: clip.length }); + } else { + var err = new Error("Media Type not supported:", clip.type); + logger.error(err); + throw err; + } + + xml.push(media); logger.debug(this.uuid + " - Creating playlist xml object for file " + filename); var pl = new melted_xml.Playlist; - pl.entry({producer: video}); + pl.entry({producer: media}); xml.push(pl); logger.debug(this.uuid + " - Creating track xml object for file " + filename); diff --git a/drivers/playlists/mongo-driver.js b/drivers/playlists/mongo-driver.js index 881a289..6903a6e 100644 --- a/drivers/playlists/mongo-driver.js +++ b/drivers/playlists/mongo-driver.js @@ -164,7 +164,7 @@ mongo_driver.prototype.createPlaylist = function(sched, callback) { var orig_order = order; var clip_name = block.name; // TODO: don't know what goes in type - var type = "default"; + var type = block.type; var file = block.file; var length = moment(block.durationraw, "HH:mm:ss.SSS"); var fps = block.video.fps; diff --git a/models/Mosto.js b/models/Mosto.js index 71c73bc..8078995 100644 --- a/models/Mosto.js +++ b/models/Mosto.js @@ -29,7 +29,7 @@ Mosto.Media = Backbone.Model.extend({ // playlist_order: undefined, // actual_order: undefined, name: '', - type: 'default', + type: 'video', // file: undefined, // length: undefined, // fps: undefined, diff --git a/test/media_helpers.js b/test/media_helpers.js index 5f06e4d..b024a33 100644 --- a/test/media_helpers.js +++ b/test/media_helpers.js @@ -50,7 +50,7 @@ exports.getMedia = function(path) { m.file = process.cwd() + "/" + path + elem.filename; m.fps = parseInt(elem.data["mlt"]["profile"][0]["$"]["frame_rate_num"], 10); m.playlist_id = "generated"; - m.type = "xml"; + m.type = "video"; // Milliseconds = Frames / FPS * 1000 var ms_length = parseInt(elem.data["mlt"]["producer"][0]["$"]["out"], 10) / m.fps * 1000; @@ -84,6 +84,7 @@ exports.getMBCMedia = function(path) { var frames = parseInt(elem.data.mlt.producer[0]["$"].out, 10); var duration = moment("0:0:0.0", "HH:mm:ss.SSS").add(exports.framesToMilliseconds(frames, params.fps)); params.durationraw = duration.format("HH:mm:ss.SSS"); + params.type = 'video'; return new CMedia.Model(params); }); return medias; diff --git a/test/mvcp-driver-test.js b/test/mvcp-driver-test.js index 0746de0..83743cb 100644 --- a/test/mvcp-driver-test.js +++ b/test/mvcp-driver-test.js @@ -107,7 +107,7 @@ describe('start mvcp-driver test', function(done) { var pl = undefined; var st = undefined; before(function(done) { - var clip = getMedia(1, 0, 1, file1.substring(file1.lastIndexOf("/") + 1), "default", file1, 1600, 25); + var clip = getMedia(1, 0, 1, file1.substring(file1.lastIndexOf("/") + 1), "video", file1, 1600, 25); // server.stop().then(server.clearPlaylist()).then(server.loadClip(clip)).then(function() { // return server.getServerPlaylist().then(function(playlist) { // pl = playlist; @@ -210,7 +210,7 @@ describe('start mvcp-driver test', function(done) { var pl = undefined; var st = undefined; before(function(done) { - var clip = getMedia(2, 1, 1, file2.substring(file1.lastIndexOf("/") + 1), "default", file2, 3200, 25); + var clip = getMedia(2, 1, 1, file2.substring(file1.lastIndexOf("/") + 1), "video", file2, 3200, 25); server.appendClip(clip).then(function() { return server.getServerPlaylist().then(function(playlist) { pl = playlist; @@ -260,7 +260,7 @@ describe('start mvcp-driver test', function(done) { var pl = undefined; var st = undefined; before(function(done) { - var clip = getMedia(3, 2, 1, file3.substring(file1.lastIndexOf("/") + 1), "default", file3, 6400, 25); + var clip = getMedia(3, 2, 1, file3.substring(file1.lastIndexOf("/") + 1), "video", file3, 6400, 25); server.insertClip(clip, 1).then(function() { return server.getServerPlaylist().then(function(playlist) { pl = playlist; @@ -420,7 +420,7 @@ describe('start mvcp-driver test', function(done) { var pl = undefined; var st = undefined; before(function(done) { - var clip = getMedia(4, 3, 1, file2.substring(file1.lastIndexOf("/") + 1), "default", file2, 3200, 25); + var clip = getMedia(4, 3, 1, file2.substring(file1.lastIndexOf("/") + 1), "video", file2, 3200, 25); server.appendClip(clip).then(function() { return server.getServerPlaylist().then(function(playlist) { pl = playlist; @@ -794,7 +794,7 @@ describe('start mvcp-driver test', function(done) { }); list.forEach(function(f, i) { var clip = getMedia(i, 0, 1, f.substring(f.lastIndexOf("/") + 1), - "default", f, 1600, 25); + "video", f, 1600, 25); server.appendClip(clip).then(function() { assert.equal(count, i); count++;