From 4d06a170a614773c7e40aa247477aadf6700a5fe Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 25 May 2022 06:56:18 +0100 Subject: [PATCH] Rename file and add tests --- ...> Tdarr_Plugin_f4k1_aune_audio_to_flac.js} | 2 +- .../Tdarr_Plugin_f4k1_aune_audio_to_flac.js | 85 +++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) rename Community/{Tdarr_Plugin_fu69_aune_audio_to_flac.js => Tdarr_Plugin_f4k1_aune_audio_to_flac.js} (98%) create mode 100644 tests/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js diff --git a/Community/Tdarr_Plugin_fu69_aune_audio_to_flac.js b/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js similarity index 98% rename from Community/Tdarr_Plugin_fu69_aune_audio_to_flac.js rename to Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js index cf0064f..d2632a1 100644 --- a/Community/Tdarr_Plugin_fu69_aune_audio_to_flac.js +++ b/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js @@ -1,5 +1,5 @@ const details = () => ({ - id: 'Tdarr_Plugin_fu69_aune_audio_to_flac', + id: 'Tdarr_Plugin_f4k1_aune_audio_to_flac', Stage: 'Pre-processing', Name: 'Aune - Audio to FLAC', Type: 'Audio', diff --git a/tests/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js b/tests/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js new file mode 100644 index 0000000..20ef026 --- /dev/null +++ b/tests/Community/Tdarr_Plugin_f4k1_aune_audio_to_flac.js @@ -0,0 +1,85 @@ +/* eslint max-len: 0 */ +const _ = require('lodash'); +const run = require('../helpers/run'); + +const tests = [ + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + processFile: false, + preset: ' -c:a flac -f flac', + container: '.flac', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '☒File contains video!\n', + }, + }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleMP3_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + processFile: false, + preset: ' -c:a flac -f flac', + container: '.flac', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '☑No matching codecs found!\n', + }, + }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleMP3_1.json')), + librarySettings: {}, + inputs: { + codecs: 'mp3', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: ' -c:a flac -f flac', + container: '.flac', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '☒Found mp3 codec!\n', + }, + }, + { + input: { + file: (() => { + const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json')); + // mock audio file with multiple streams + file.ffProbeData.streams[0].codec_type = 'audio'; + return file; + })(), + librarySettings: {}, + inputs: { + codecs: 'ac3,eac3,aac', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: ' -c:a flac -f flac', + container: '.flac', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '☒Found ac3 codec!\n', + }, + }, +]; + +run(tests);