diff --git a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js new file mode 100644 index 0000000..f295eee --- /dev/null +++ b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js @@ -0,0 +1,66 @@ +function details() { + + return { + id: "Tdarr_Plugin_lmg1_Reorder_Streams", + Name: "Tdarr_Plugin_lmg1_Reorder_Streams ", + Type: "Video", + Description: `This plugin will move the video stream to the front so Tdarr will recognize the codec correctly.\n\n`, + Version: "1.00", + Link: "https://github.com/luigi311/Tdarr_Plugin_lmg1_Reorder_Streams" + } + +} + +function plugin(file) { + + //Must return this object + + var response = { + + processFile : false, + preset : '', + container : '.mp4', + handBrakeMode : false, + FFmpegMode : false, + reQueueAfter : false, + infoLog : '', + + } + + if (file.fileMedium !== "video") { + + console.log("File is not video") + + response.infoLog += " File is not video\n" + response.processFile = false; + + return response + + } else { + + response.FFmpegMode = true + response.container = '.' + file.container + + if(file.ffProbeData.streams[0].codec_type != 'video') { + + response.infoLog += "Video is not in the first stream" + response.preset = ',-map 0:v? -map 0:a? -map 0:s? -map 0:d? -map 0:t? -c copy' + response.reQueueAfter = true; + response.processFile = true; + + return response + + } else { + + response.infoLog += "File has video in first stream\n" + + } + + response.infoLog += " File meets conditions!\n" + return response + + } +} + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Tdarr_Plugin_nc7x_Example.js b/Tdarr_Plugin_nc7x_Example.js index 691975d..8aa8a2c 100644 --- a/Tdarr_Plugin_nc7x_Example.js +++ b/Tdarr_Plugin_nc7x_Example.js @@ -33,9 +33,7 @@ function plugin(file) { container: '.mp4', // The container of the transcoded output file. handBrakeMode: false, //Set whether to use HandBrake or FFmpeg for transcoding FFmpegMode: false, - reQueueAfter: false, //If you can't do all tasks in one pass, set this to true. The file will be re-added to the transcode queue - //afterwards for additional processing. See Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle - //In that plugin, several passes are used to remove subs, metadata and add an aac track. + reQueueAfter: true, //Leave as true. File will be re-qeued afterwards and pass through the plugin filter again to make sure it meets conditions. infoLog: '', //This will be shown when the user clicks the 'i' (info) button on a file in the output queue if //it has been skipped. // Give reasons why it has been skipped ('File has no title metadata, File meets conditions!') @@ -65,7 +63,6 @@ function plugin(file) { response.infoLog += " File has title metadata" response.preset = ',-map_metadata -1 -c:v copy -c:a copy' - response.reQueueAfter = true; response.processFile = true; return response } else {