From 1d4a0113ec02082fe79ce2696f3e7950659d4096 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:53:07 +0000 Subject: [PATCH 1/8] Migz Plugins Update 1) Update CPU plugin description as it mentions using a GPU which is incorrect. 2) Update CPU & GPU plugins to remove `\n` and `\\n` from the description fields as the description field doesn't seem to use these as new lines and were instead displaying as text. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 8 ++++---- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index c87d265..753ef59 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -7,10 +7,10 @@ function details() { Type: 'Video', Operation: 'Transcode', Description: `Files not in H265 will be transcoded into H265 using Nvidia GPU with ffmpeg. - \\n Settings are dependant on file bitrate - \\n Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. - \\n NVDEC & NVENC compatable GPU required. - \\n This plugin will skip any files that are in the VP9 codec. \n\n`, + Settings are dependant on file bitrate + Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. + NVDEC & NVENC compatable GPU required. + This plugin will skip any files that are in the VP9 codec.`, Version: '3.0', Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js', Tags: 'pre-processing,ffmpeg,video only,nvenc h265,configurable', diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 88b87db..12a10ca 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -6,10 +6,10 @@ function details() { Name: 'Migz-Transcode Using CPU & FFMPEG', Type: 'Video', Operation: 'Transcode', - Description: `Files not in H265 will be transcoded into H265 using Nvidia GPU with ffmpeg. - \\n Settings are dependant on file bitrate - \\n Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. - \\n This plugin will skip any files that are in the VP9 codec. \n\n`, + Description: `Files not in H265 will be transcoded into H265 using CPU with ffmpeg. + Settings are dependant on file bitrate + Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. + This plugin will skip any files that are in the VP9 codec.`, Version: '1.9', Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js', Tags: 'pre-processing,ffmpeg,video only,configurable,h265', From 49829c9c24d73011bb1625d11921d8f8908bf808 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 9 Jan 2021 18:53:53 +0100 Subject: [PATCH 2/8] lint fix --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 12a10ca..093776d 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -8,8 +8,8 @@ function details() { Operation: 'Transcode', Description: `Files not in H265 will be transcoded into H265 using CPU with ffmpeg. Settings are dependant on file bitrate - Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. - This plugin will skip any files that are in the VP9 codec.`, + Working by the logic that H265 can support the same ammount of data at half the bitrate of H264. + This plugin will skip any files that are in the VP9 codec.`, Version: '1.9', Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js', Tags: 'pre-processing,ffmpeg,video only,configurable,h265', From 13b0ec02213dedfb7b7386cf47ed0e2a5080a034 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 24 Jan 2021 14:47:30 +0100 Subject: [PATCH 3/8] Add external dependencies --- Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js | 8 ++++++-- .../Tdarr_Plugin_z18s_rename_files_based_on_codec.js | 5 +++++ ...gin_z18t_rename_files_based_on_codec_and_resolution.js | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js index fbc2822..097861e 100644 --- a/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js +++ b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js @@ -1,5 +1,6 @@ -// eslint-disable-next-line import/no-unresolved -const request = require('request'); +module.exports.dependencies = [ + 'request', +]; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ module.exports.details = function details() { @@ -47,6 +48,9 @@ module.exports.details = function details() { }; module.exports.plugin = function plugin(file, librarySettings, inputs) { + // eslint-disable-next-line global-require,import/no-unresolved + const request = require('request'); + // Set up required variables. const ADDRESS = inputs.autoscan_address; const PORT = inputs.autoscan_port; diff --git a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js index b64d996..cc7b918 100644 --- a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js +++ b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js @@ -1,4 +1,9 @@ /* eslint-disable */ + +module.exports.dependencies = [ + 'fs-extra', +]; + module.exports.details = function details() { return { id: "Tdarr_Plugin_z18s_rename_files_based_on_codec", diff --git a/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js b/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js index 2c35f83..52d8e13 100644 --- a/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js +++ b/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js @@ -1,4 +1,9 @@ /* eslint-disable */ + +module.exports.dependencies = [ + 'fs-extra', +]; + module.exports.details = function details() { return { id: "Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution", From b79f45db6b7f004cea121e8dc405e3306b5ea2ed Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:25:11 +0100 Subject: [PATCH 4/8] v2 Dependencies addition --- Tdarr_Plugin_aaaa_Pre_Proc_Example.js | 105 +++++++++++++------------ Tdarr_Plugin_zzzz_Post_Proc_Example.js | 42 ++++++---- 2 files changed, 81 insertions(+), 66 deletions(-) diff --git a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js index d5583f3..713db5e 100644 --- a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js +++ b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js @@ -1,19 +1,24 @@ +// List any npm dependencies which the plugin needs, they will be auto installed when the plugin runs: +module.exports.dependencies = [ + 'import-fresh', +]; + module.exports.details = function details() { return { - id: "Tdarr_Plugin_aaaa_Pre_Proc_Example", - Stage: "Pre-processing", //Preprocessing or Post-processing. Determines when the plugin will be executed. - Name: "No title meta data ", - Type: "Video", - Operation: "Transcode", - Description: `This plugin removes metadata (if a title exists). The output container is the same as the original. \n\n`, - Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Pre_Proc_Example", - Tags: "ffmpeg,h265", //Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable + id: 'Tdarr_Plugin_aaaa_Pre_Proc_Example', + Stage: 'Pre-processing', // Preprocessing or Post-processing. Determines when the plugin will be executed. + Name: 'No title meta data ', + Type: 'Video', + Operation: 'Transcode', + Description: 'This plugin removes metadata (if a title exists). The output container is the same as the original. \n\n', + Version: '1.00', + Link: 'https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Pre_Proc_Example', + Tags: 'ffmpeg,h265', // Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable Inputs: [ - //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI + // (Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { - name: "language", + name: 'language', tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \\nExample:\\n @@ -25,10 +30,10 @@ module.exports.details = function details() { \\nExample:\\n - de`, //Each line following `Example:` will be clearly formatted. \\n used for line breaks + de`, // Each line following `Example:` will be clearly formatted. \\n used for line breaks }, { - name: "channels", + name: 'channels', tooltip: `Desired audio channel number. \\nExample:\\n @@ -39,67 +44,69 @@ module.exports.details = function details() { }; module.exports.plugin = function plugin(file, librarySettings, inputs) { - //Must return this object at some point in the function else plugin will fail. + // Only 'require' dependencies within this function or other functions. Do not require in the top scope. + const importFresh = require('import-fresh'); + + // Must return this object at some point in the function else plugin will fail. - var response = { - processFile: false, //If set to false, the file will be skipped. Set to true to have the file transcoded. - preset: "", //HandBrake/FFmpeg CLI arguments you'd like to use. - //For FFmpeg, the input arguments come first followed by , followed by the output argument. + const response = { + processFile: false, // If set to false, the file will be skipped. Set to true to have the file transcoded. + preset: '', // HandBrake/FFmpeg CLI arguments you'd like to use. + // For FFmpeg, the input arguments come first followed by , followed by the output argument. // Examples - //HandBrake + // HandBrake // '-Z "Very Fast 1080p30"' - //FFmpeg + // FFmpeg // '-sn -map_metadata -1 -c:v copy -c:a copy' - container: ".mp4", // The container of the transcoded output file. - handBrakeMode: false, //Set whether to use HandBrake or FFmpeg for transcoding + container: '.mp4', // The container of the transcoded output file. + handBrakeMode: false, // Set whether to use HandBrake or FFmpeg for transcoding FFmpegMode: false, - 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. + 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!') - //Optional (include together) + // Optional (include together) file, - removeFromDB: false, //Tell Tdarr to remove file from database if true - updateDB: false, //Change file object above and update database if true + removeFromDB: false, // Tell Tdarr to remove file from database if true + updateDB: false, // Change file object above and update database if true }; - console.log(inputs.language); //eng if user entered 'eng' in input box in Tdarr plugin UI - console.log(inputs.channels); //2 if user entered '2' in input box in Tdarr plugin UI + console.log(inputs.language); // eng if user entered 'eng' in input box in Tdarr plugin UI + console.log(inputs.channels); // 2 if user entered '2' in input box in Tdarr plugin UI - //Here we specify that we want the output file container to be the same as the current container. - response.container = "." + file.container; + // Here we specify that we want the output file container to be the same as the current container. + response.container = `.${file.container}`; - //We will use FFmpeg for this procedure. + // We will use FFmpeg for this procedure. response.FFmpegMode = true; - //Check if file has title metadata + // Check if file has title metadata if (file.meta.Title != undefined) { - //if so, remove it + // if so, remove it - response.infoLog += " File has title metadata"; - response.preset = ",-map_metadata -1 -c:v copy -c:a copy"; + response.infoLog += ' File has title metadata'; + response.preset = ',-map_metadata -1 -c:v copy -c:a copy'; response.processFile = true; return response; - } else { - response.infoLog += " File has no title metadata"; } + response.infoLog += ' File has no title metadata'; - response.infoLog += " File meets conditions!"; + response.infoLog += ' File meets conditions!'; return response; }; module.exports.onTranscodeSuccess = function onTranscodeSuccess( file, librarySettings, - inputs + inputs, ) { console.log( - "Transcode success! Now do some stuff with the newly scanned file." + 'Transcode success! Now do some stuff with the newly scanned file.', ); - //Optional response if you need to modify database - var response = { + // Optional response if you need to modify database + const response = { file, removeFromDB: false, updateDB: false, @@ -111,12 +118,12 @@ module.exports.onTranscodeSuccess = function onTranscodeSuccess( module.exports.onTranscodeError = function onTranscodeError( file, librarySettings, - inputs + inputs, ) { - console.log("Transcode fail! Now do some stuff with the original file."); + console.log('Transcode fail! Now do some stuff with the original file.'); - //Optional response if you need to modify database - var response = { + // Optional response if you need to modify database + const response = { file, removeFromDB: false, updateDB: false, @@ -125,7 +132,7 @@ module.exports.onTranscodeError = function onTranscodeError( return response; }; -//Example file object: +// Example file object: // { // _id: 'C:/Users/H/Desktop/Test Input1/Sample.mp4', // DB: 'ZRPDmnmpyuAEQi7nG', diff --git a/Tdarr_Plugin_zzzz_Post_Proc_Example.js b/Tdarr_Plugin_zzzz_Post_Proc_Example.js index 75c8958..3e0a195 100644 --- a/Tdarr_Plugin_zzzz_Post_Proc_Example.js +++ b/Tdarr_Plugin_zzzz_Post_Proc_Example.js @@ -1,19 +1,24 @@ +// List any npm dependencies which the plugin needs, they will be auto installed when the plugin runs: +module.exports.dependencies = [ + 'import-fresh', +]; + module.exports.details = function details() { return { - id: "Tdarr_Plugin_zzzz_Post_Proc_Example", - Stage: "Post-processing", //Preprocessing or Post-processing. Determines when the plugin will be executed. This plugin does some stuff after all plugins have been executed - Name: "Post proc ", - Type: "Video", - Operation: "", - Description: `This plugin does some stuff after all plugins have been executed. \n\n`, - Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Post_Proc_Example", - Tags: "ffmpeg,h265", //Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable + id: 'Tdarr_Plugin_zzzz_Post_Proc_Example', + Stage: 'Post-processing', // Preprocessing or Post-processing. Determines when the plugin will be executed. This plugin does some stuff after all plugins have been executed + Name: 'Post proc ', + Type: 'Video', + Operation: '', + Description: 'This plugin does some stuff after all plugins have been executed. \n\n', + Version: '1.00', + Link: 'https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Post_Proc_Example', + Tags: 'ffmpeg,h265', // Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable Inputs: [ - //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI + // (Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { - name: "language", + name: 'language', tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \\nExample:\\n @@ -23,10 +28,10 @@ module.exports.details = function details() { fr \\nExample:\\n - de`, //Each line following `Example:` will be clearly formatted. \\n used for line breaks + de`, // Each line following `Example:` will be clearly formatted. \\n used for line breaks }, { - name: "channels", + name: 'channels', tooltip: `Desired audio channel number. \\nExample:\\n @@ -37,12 +42,15 @@ module.exports.details = function details() { }; module.exports.plugin = function plugin(file, librarySettings, inputs) { + // Only 'require' dependencies within this function or other functions. Do not require in the top scope. + const importFresh = require('import-fresh'); + console.log( - "Transcode success! Now do some stuff with the newly scanned file." + 'Transcode success! Now do some stuff with the newly scanned file.', ); - //Optional response if you need to modify database - var response = { + // Optional response if you need to modify database + const response = { file, removeFromDB: false, updateDB: false, @@ -51,7 +59,7 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) { return response; }; -//Example file object: +// Example file object: // { // _id: 'C:/Users/H/Desktop/Test Input1/Sample.mp4', // DB: 'ZRPDmnmpyuAEQi7nG', From 98bd5a115f6702ba5c1686a83e5d32ee3e7b893b Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 28 Jan 2021 09:20:44 +0100 Subject: [PATCH 5/8] fix loop bug --- .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 2992a4b..0e26cc4 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -1,4 +1,3 @@ -/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ function details() { return { id: 'Tdarr_Plugin_MC93_Migz2CleanTitle', @@ -89,12 +88,18 @@ function plugin(file, librarySettings, inputs) { } // Go through each stream in the file. - for (let i = 0; i < file.ffProbeData.streams.length; i++) { + for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { // Check if stream is a video. if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'video') { try { // Check if stream title is not empty, if it's not empty set to "". - if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') { + if ( + !( + typeof file.ffProbeData.streams[i].tags.title === 'undefined' + || file.ffProbeData.streams[i].tags.title === '""' + || file.ffProbeData.streams[i].tags.title === '' + ) + ) { response.infoLog += `☒Video stream title is not empty. Removing title from stream ${i} \n`; ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `; convert = true; @@ -114,7 +119,13 @@ function plugin(file, librarySettings, inputs) { && inputs.clean_audio.toLowerCase() === 'true' ) { try { - if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') { + if ( + !( + typeof file.ffProbeData.streams[i].tags.title === 'undefined' + || file.ffProbeData.streams[i].tags.title === '""' + || file.ffProbeData.streams[i].tags.title === '' + ) + ) { if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) { try { response.infoLog += `☒More then 3 full stops in audio title. Removing title from stream ${i} \n`; @@ -151,7 +162,13 @@ function plugin(file, librarySettings, inputs) { && inputs.clean_subtitles.toLowerCase() === 'true' ) { try { - if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') { + if ( + !( + typeof file.ffProbeData.streams[i].tags.title === 'undefined' + || file.ffProbeData.streams[i].tags.title === '""' + || file.ffProbeData.streams[i].tags.title === '' + ) + ) { if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) { try { response.infoLog += `☒More then 3 full stops in subtitle title. Removing title from stream ${i} \n`; From 3f616d4406b25792f6a9be95e9e256cc2d10c13c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 28 Jan 2021 09:23:23 +0100 Subject: [PATCH 6/8] Check for extra empties --- Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 0e26cc4..79028e9 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -78,7 +78,13 @@ function plugin(file, librarySettings, inputs) { } // Check if overall file metadata title is not empty, if it's not empty set to "". - if (typeof file.meta.Title !== 'undefined') { + if ( + !( + typeof file.meta.Title === 'undefined' + || file.meta.Title === '""' + || file.meta.Title === '' + ) + ) { try { ffmpegCommandInsert += ' -metadata title="" '; convert = true; From d36ce1990b3299a75cf1eb132c3fe8acbe85fb0b Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 7 Feb 2021 14:37:56 +0100 Subject: [PATCH 7/8] Add import-fresh modules --- .gitignore | 1 - node_modules/callsites/index.d.ts | 96 +++++++++++++++++++++++++ node_modules/callsites/index.js | 13 ++++ node_modules/callsites/license | 9 +++ node_modules/callsites/package.json | 71 ++++++++++++++++++ node_modules/callsites/readme.md | 48 +++++++++++++ node_modules/import-fresh/index.d.ts | 30 ++++++++ node_modules/import-fresh/index.js | 33 +++++++++ node_modules/import-fresh/license | 9 +++ node_modules/import-fresh/package.json | 76 ++++++++++++++++++++ node_modules/import-fresh/readme.md | 48 +++++++++++++ node_modules/parent-module/index.js | 37 ++++++++++ node_modules/parent-module/license | 9 +++ node_modules/parent-module/package.json | 78 ++++++++++++++++++++ node_modules/parent-module/readme.md | 67 +++++++++++++++++ node_modules/resolve-from/index.js | 47 ++++++++++++ node_modules/resolve-from/license | 9 +++ node_modules/resolve-from/package.json | 66 +++++++++++++++++ node_modules/resolve-from/readme.md | 72 +++++++++++++++++++ 19 files changed, 818 insertions(+), 1 deletion(-) create mode 100644 node_modules/callsites/index.d.ts create mode 100644 node_modules/callsites/index.js create mode 100644 node_modules/callsites/license create mode 100644 node_modules/callsites/package.json create mode 100644 node_modules/callsites/readme.md create mode 100644 node_modules/import-fresh/index.d.ts create mode 100644 node_modules/import-fresh/index.js create mode 100644 node_modules/import-fresh/license create mode 100644 node_modules/import-fresh/package.json create mode 100644 node_modules/import-fresh/readme.md create mode 100644 node_modules/parent-module/index.js create mode 100644 node_modules/parent-module/license create mode 100644 node_modules/parent-module/package.json create mode 100644 node_modules/parent-module/readme.md create mode 100644 node_modules/resolve-from/index.js create mode 100644 node_modules/resolve-from/license create mode 100644 node_modules/resolve-from/package.json create mode 100644 node_modules/resolve-from/readme.md diff --git a/.gitignore b/.gitignore index 3c3629e..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/callsites/index.d.ts b/node_modules/callsites/index.d.ts new file mode 100644 index 0000000..61f597c --- /dev/null +++ b/node_modules/callsites/index.d.ts @@ -0,0 +1,96 @@ +declare namespace callsites { + interface CallSite { + /** + Returns the value of `this`. + */ + getThis(): unknown | undefined; + + /** + Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property. + */ + getTypeName(): string | null; + + /** + Returns the current function. + */ + getFunction(): Function | undefined; + + /** + Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context. + */ + getFunctionName(): string | null; + + /** + Returns the name of the property of `this` or one of its prototypes that holds the current function. + */ + getMethodName(): string | undefined; + + /** + Returns the name of the script if this function was defined in a script. + */ + getFileName(): string | null; + + /** + Returns the current line number if this function was defined in a script. + */ + getLineNumber(): number | null; + + /** + Returns the current column number if this function was defined in a script. + */ + getColumnNumber(): number | null; + + /** + Returns a string representing the location where `eval` was called if this function was created using a call to `eval`. + */ + getEvalOrigin(): string | undefined; + + /** + Returns `true` if this is a top-level invocation, that is, if it's a global object. + */ + isToplevel(): boolean; + + /** + Returns `true` if this call takes place in code defined by a call to `eval`. + */ + isEval(): boolean; + + /** + Returns `true` if this call is in native V8 code. + */ + isNative(): boolean; + + /** + Returns `true` if this is a constructor call. + */ + isConstructor(): boolean; + } +} + +declare const callsites: { + /** + Get callsites from the V8 stack trace API. + + @returns An array of `CallSite` objects. + + @example + ``` + import callsites = require('callsites'); + + function unicorn() { + console.log(callsites()[0].getFileName()); + //=> '/Users/sindresorhus/dev/callsites/test.js' + } + + unicorn(); + ``` + */ + (): callsites.CallSite[]; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function callsites(): callsites.CallSite[]; + // export = callsites; + default: typeof callsites; +}; + +export = callsites; diff --git a/node_modules/callsites/index.js b/node_modules/callsites/index.js new file mode 100644 index 0000000..486c241 --- /dev/null +++ b/node_modules/callsites/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const callsites = () => { + const _prepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = (_, stack) => stack; + const stack = new Error().stack.slice(1); + Error.prepareStackTrace = _prepareStackTrace; + return stack; +}; + +module.exports = callsites; +// TODO: Remove this for the next major release +module.exports.default = callsites; diff --git a/node_modules/callsites/license b/node_modules/callsites/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/callsites/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/callsites/package.json b/node_modules/callsites/package.json new file mode 100644 index 0000000..0f6defb --- /dev/null +++ b/node_modules/callsites/package.json @@ -0,0 +1,71 @@ +{ + "_from": "callsites@^3.0.0", + "_id": "callsites@3.1.0", + "_inBundle": false, + "_integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "_location": "/callsites", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "callsites@^3.0.0", + "name": "callsites", + "escapedName": "callsites", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/parent-module" + ], + "_resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "_shasum": "b3630abd8943432f54b3f0519238e33cd7df2f73", + "_spec": "callsites@^3.0.0", + "_where": "C:\\Users\\H\\Documents\\GitHub\\tdarr_express_node\\assets\\app\\plugins\\node_modules\\parent-module", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/callsites/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get callsites from the V8 stack trace API", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/callsites#readme", + "keywords": [ + "stacktrace", + "v8", + "callsite", + "callsites", + "stack", + "trace", + "function", + "file", + "line", + "debug" + ], + "license": "MIT", + "name": "callsites", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/callsites.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "3.1.0" +} diff --git a/node_modules/callsites/readme.md b/node_modules/callsites/readme.md new file mode 100644 index 0000000..fc84613 --- /dev/null +++ b/node_modules/callsites/readme.md @@ -0,0 +1,48 @@ +# callsites [![Build Status](https://travis-ci.org/sindresorhus/callsites.svg?branch=master)](https://travis-ci.org/sindresorhus/callsites) + +> Get callsites from the [V8 stack trace API](https://v8.dev/docs/stack-trace-api) + + +## Install + +``` +$ npm install callsites +``` + + +## Usage + +```js +const callsites = require('callsites'); + +function unicorn() { + console.log(callsites()[0].getFileName()); + //=> '/Users/sindresorhus/dev/callsites/test.js' +} + +unicorn(); +``` + + +## API + +Returns an array of callsite objects with the following methods: + +- `getThis`: returns the value of `this`. +- `getTypeName`: returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property. +- `getFunction`: returns the current function. +- `getFunctionName`: returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context. +- `getMethodName`: returns the name of the property of `this` or one of its prototypes that holds the current function. +- `getFileName`: if this function was defined in a script returns the name of the script. +- `getLineNumber`: if this function was defined in a script returns the current line number. +- `getColumnNumber`: if this function was defined in a script returns the current column number +- `getEvalOrigin`: if this function was created using a call to `eval` returns a string representing the location where `eval` was called. +- `isToplevel`: is this a top-level invocation, that is, is this the global object? +- `isEval`: does this call take place in code defined by a call to `eval`? +- `isNative`: is this call in native V8 code? +- `isConstructor`: is this a constructor call? + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/import-fresh/index.d.ts b/node_modules/import-fresh/index.d.ts new file mode 100644 index 0000000..36d7e20 --- /dev/null +++ b/node_modules/import-fresh/index.d.ts @@ -0,0 +1,30 @@ +/** +Import a module while bypassing the cache. + +@example +``` +// foo.js +let i = 0; +module.exports = () => ++i; + +// index.js +import importFresh = require('import-fresh'); + +require('./foo')(); +//=> 1 + +require('./foo')(); +//=> 2 + +importFresh('./foo')(); +//=> 1 + +importFresh('./foo')(); +//=> 1 + +const foo = importFresh('./foo'); +``` +*/ +declare function importFresh(moduleId: string): T; + +export = importFresh; diff --git a/node_modules/import-fresh/index.js b/node_modules/import-fresh/index.js new file mode 100644 index 0000000..0a4c5d5 --- /dev/null +++ b/node_modules/import-fresh/index.js @@ -0,0 +1,33 @@ +'use strict'; +const path = require('path'); +const resolveFrom = require('resolve-from'); +const parentModule = require('parent-module'); + +module.exports = moduleId => { + if (typeof moduleId !== 'string') { + throw new TypeError('Expected a string'); + } + + const parentPath = parentModule(__filename); + + const cwd = parentPath ? path.dirname(parentPath) : __dirname; + const filePath = resolveFrom(cwd, moduleId); + + const oldModule = require.cache[filePath]; + // Delete itself from module parent + if (oldModule && oldModule.parent) { + let i = oldModule.parent.children.length; + + while (i--) { + if (oldModule.parent.children[i].id === filePath) { + oldModule.parent.children.splice(i, 1); + } + } + } + + delete require.cache[filePath]; // Delete module from cache + + const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step + + return parent === undefined ? require(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require +}; diff --git a/node_modules/import-fresh/license b/node_modules/import-fresh/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/import-fresh/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/import-fresh/package.json b/node_modules/import-fresh/package.json new file mode 100644 index 0000000..481d601 --- /dev/null +++ b/node_modules/import-fresh/package.json @@ -0,0 +1,76 @@ +{ + "_from": "import-fresh", + "_id": "import-fresh@3.3.0", + "_inBundle": false, + "_integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "_location": "/import-fresh", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "import-fresh", + "name": "import-fresh", + "escapedName": "import-fresh", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "_shasum": "37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b", + "_spec": "import-fresh", + "_where": "C:\\Users\\H\\Documents\\GitHub\\tdarr_express_node", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/import-fresh/issues" + }, + "bundleDependencies": false, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "deprecated": false, + "description": "Import a module while bypassing the cache", + "devDependencies": { + "ava": "^1.0.1", + "heapdump": "^0.3.12", + "tsd": "^0.7.3", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "homepage": "https://github.com/sindresorhus/import-fresh#readme", + "keywords": [ + "require", + "cache", + "uncache", + "uncached", + "module", + "fresh", + "bypass" + ], + "license": "MIT", + "name": "import-fresh", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/import-fresh.git" + }, + "scripts": { + "heapdump": "node heapdump.js", + "test": "xo && ava && tsd" + }, + "version": "3.3.0" +} diff --git a/node_modules/import-fresh/readme.md b/node_modules/import-fresh/readme.md new file mode 100644 index 0000000..bd14c79 --- /dev/null +++ b/node_modules/import-fresh/readme.md @@ -0,0 +1,48 @@ +# import-fresh + +> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching) + +Useful for testing purposes when you need to freshly import a module. + +## Install + +``` +$ npm install import-fresh +``` + +## Usage + +```js +// foo.js +let i = 0; +module.exports = () => ++i; +``` + +```js +const importFresh = require('import-fresh'); + +require('./foo')(); +//=> 1 + +require('./foo')(); +//=> 2 + +importFresh('./foo')(); +//=> 1 + +importFresh('./foo')(); +//=> 1 +``` + +## import-fresh for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of import-fresh and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily diff --git a/node_modules/parent-module/index.js b/node_modules/parent-module/index.js new file mode 100644 index 0000000..a26f953 --- /dev/null +++ b/node_modules/parent-module/index.js @@ -0,0 +1,37 @@ +'use strict'; +const callsites = require('callsites'); + +module.exports = filepath => { + const stacks = callsites(); + + if (!filepath) { + return stacks[2].getFileName(); + } + + let seenVal = false; + + // Skip the first stack as it's this function + stacks.shift(); + + for (const stack of stacks) { + const parentFilepath = stack.getFileName(); + + if (typeof parentFilepath !== 'string') { + continue; + } + + if (parentFilepath === filepath) { + seenVal = true; + continue; + } + + // Skip native modules + if (parentFilepath === 'module.js') { + continue; + } + + if (seenVal && parentFilepath !== filepath) { + return parentFilepath; + } + } +}; diff --git a/node_modules/parent-module/license b/node_modules/parent-module/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/parent-module/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/parent-module/package.json b/node_modules/parent-module/package.json new file mode 100644 index 0000000..9b1cb96 --- /dev/null +++ b/node_modules/parent-module/package.json @@ -0,0 +1,78 @@ +{ + "_from": "parent-module@^1.0.0", + "_id": "parent-module@1.0.1", + "_inBundle": false, + "_integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "_location": "/parent-module", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parent-module@^1.0.0", + "name": "parent-module", + "escapedName": "parent-module", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/import-fresh" + ], + "_resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "_shasum": "691d2709e78c79fae3a156622452d00762caaaa2", + "_spec": "parent-module@^1.0.0", + "_where": "C:\\Users\\H\\Documents\\GitHub\\tdarr_express_node\\assets\\app\\plugins\\node_modules\\import-fresh", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/parent-module/issues" + }, + "bundleDependencies": false, + "dependencies": { + "callsites": "^3.0.0" + }, + "deprecated": false, + "description": "Get the path of the parent module", + "devDependencies": { + "ava": "^1.4.1", + "execa": "^1.0.0", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/parent-module#readme", + "keywords": [ + "parent", + "module", + "package", + "pkg", + "caller", + "calling", + "module", + "path", + "callsites", + "callsite", + "stacktrace", + "stack", + "trace", + "function", + "file" + ], + "license": "MIT", + "name": "parent-module", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/parent-module.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.1" +} diff --git a/node_modules/parent-module/readme.md b/node_modules/parent-module/readme.md new file mode 100644 index 0000000..dffb4ce --- /dev/null +++ b/node_modules/parent-module/readme.md @@ -0,0 +1,67 @@ +# parent-module [![Build Status](https://travis-ci.org/sindresorhus/parent-module.svg?branch=master)](https://travis-ci.org/sindresorhus/parent-module) + +> Get the path of the parent module + +Node.js exposes `module.parent`, but it only gives you the first cached parent, which is not necessarily the actual parent. + + +## Install + +``` +$ npm install parent-module +``` + + +## Usage + +```js +// bar.js +const parentModule = require('parent-module'); + +module.exports = () => { + console.log(parentModule()); + //=> '/Users/sindresorhus/dev/unicorn/foo.js' +}; +``` + +```js +// foo.js +const bar = require('./bar'); + +bar(); +``` + + +## API + +### parentModule([filepath]) + +By default, it will return the path of the immediate parent. + +#### filepath + +Type: `string`
+Default: [`__filename`](https://nodejs.org/api/globals.html#globals_filename) + +Filepath of the module of which to get the parent path. + +Useful if you want it to work [multiple module levels down](https://github.com/sindresorhus/parent-module/tree/master/fixtures/filepath). + + +## Tip + +Combine it with [`read-pkg-up`](https://github.com/sindresorhus/read-pkg-up) to read the package.json of the parent module. + +```js +const path = require('path'); +const readPkgUp = require('read-pkg-up'); +const parentModule = require('parent-module'); + +console.log(readPkgUp.sync({cwd: path.dirname(parentModule())}).pkg); +//=> {name: 'chalk', version: '1.0.0', …} +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js new file mode 100644 index 0000000..d092447 --- /dev/null +++ b/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDir, moduleId, silent) => { + if (typeof fromDir !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDir = fs.realpathSync(fromDir); + } catch (err) { + if (err.code === 'ENOENT') { + fromDir = path.resolve(fromDir); + } else if (silent) { + return null; + } else { + throw err; + } + } + + const fromFile = path.join(fromDir, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (err) { + return null; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); +module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); diff --git a/node_modules/resolve-from/license b/node_modules/resolve-from/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/resolve-from/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/resolve-from/package.json b/node_modules/resolve-from/package.json new file mode 100644 index 0000000..7749891 --- /dev/null +++ b/node_modules/resolve-from/package.json @@ -0,0 +1,66 @@ +{ + "_from": "resolve-from@^4.0.0", + "_id": "resolve-from@4.0.0", + "_inBundle": false, + "_integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "_location": "/resolve-from", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-from@^4.0.0", + "name": "resolve-from", + "escapedName": "resolve-from", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/import-fresh" + ], + "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "_shasum": "4abcd852ad32dd7baabfe9b40e00a36db5f392e6", + "_spec": "resolve-from@^4.0.0", + "_where": "C:\\Users\\H\\Documents\\GitHub\\tdarr_express_node\\assets\\app\\plugins\\node_modules\\import-fresh", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/resolve-from/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Resolve the path of a module like `require.resolve()` but from a given path", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/resolve-from#readme", + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "license": "MIT", + "name": "resolve-from", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/resolve-from.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.0.0" +} diff --git a/node_modules/resolve-from/readme.md b/node_modules/resolve-from/readme.md new file mode 100644 index 0000000..e539f85 --- /dev/null +++ b/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDir, moduleId) + +Returns `null` instead of throwing when the module can't be found. + +#### fromDir + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) From 330dc5b2ea00b561bc3a873704d19bc5f32b8514 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 7 Feb 2021 15:19:19 +0100 Subject: [PATCH 8/8] Add -max_muxing_queue_size 999 --- Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js | 2 +- .../Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js index 382847f..28d7bc3 100644 --- a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js +++ b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js @@ -42,7 +42,7 @@ function plugin(file) { } response.processFile = true; - response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 libx265 `; + response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 libx265 -max_muxing_queue_size 9999`; response.container = ".mkv"; response.handBrakeMode = false; response.FFmpegMode = true; diff --git a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js index 6a5a41b..4ef8a3c 100644 --- a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js +++ b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js @@ -42,7 +42,7 @@ function plugin(file) { } response.processFile = true; - response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265`; + response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265 -max_muxing_queue_size 9999`; response.container = ".mkv"; response.handBrakeMode = false; response.FFmpegMode = true;