parent
87d3051cfc
commit
f94a913f00
@ -1,77 +1,79 @@
|
|||||||
function details() {
|
const details = () => ({
|
||||||
return {
|
id: 'Tdarr_Plugin_fu69_aune_audio_to_flac',
|
||||||
id: 'Tdarr_Plugin_fu69_aune_audio_to_flac',
|
Stage: 'Pre-processing',
|
||||||
Stage: 'Pre-processing',
|
Name: 'Aune - Audio to FLAC',
|
||||||
Name: 'Aune - Audio to FLAC',
|
Type: 'Audio',
|
||||||
Type: 'Audio',
|
Operation: 'Transcode',
|
||||||
Operation: 'Transcode',
|
Description: 'This plugin transcodes different audio codecs to FLAC. '
|
||||||
Description: 'This plugin transcodes different audio codecs to FLAC. '
|
+ 'Leaving the default inputs results in lossless conversion as ALAC and'
|
||||||
+ 'Leaving the default inputs results in lossless conversion as ALAC and PCM codecs don\'t require transcoding for FLAC. It ignores files that contains video streams and is made for music libraries.\n\n',
|
+ ' PCM codecs don\'t require transcoding for FLAC. It ignores files that'
|
||||||
Version: '1.00',
|
+ ' contains video streams and is made for music libraries.\n\n',
|
||||||
Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_fu69_aune_audio_to_flac.js',
|
Version: '1.00',
|
||||||
Tags: 'pre-processing,ffmpeg,audio only',
|
Tags: 'pre-processing,ffmpeg,audio only',
|
||||||
Inputs: [
|
Inputs: [
|
||||||
{
|
{
|
||||||
name: "codecs",
|
name: 'codecs',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
defaultValue: 'alac,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le',
|
defaultValue: 'alac,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le',
|
||||||
inputUI: {
|
inputUI: {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
tooltip:
|
tooltip:
|
||||||
`Select the codec(s) (comma seperated) you would like to transcode to FLAC.
|
`Select the codec(s) (comma seperated) you would like to transcode to FLAC.
|
||||||
\\nExample:\\n
|
\\nExample:\\n
|
||||||
alac
|
alac
|
||||||
\\nExample:\\n
|
\\nExample:\\n
|
||||||
alac, pcm_s16be, mp3
|
alac, pcm_s16be, mp3
|
||||||
\\nExample:\\n
|
\\nExample:\\n
|
||||||
alac,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le`,
|
alac,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||||
|
const lib = require('../methods/lib')();
|
||||||
|
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
||||||
|
inputs = lib.loadDefaultValues(inputs, details);
|
||||||
|
|
||||||
|
const response = {
|
||||||
|
processFile: false,
|
||||||
|
preset: '<io> -c:a flac -f flac',
|
||||||
|
container: '.flac',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
if (inputs.codecs === '' || inputs.codecs === undefined) {
|
||||||
|
response.infoLog += '☒No codecs selected!\n';
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
// eslint-disable-next-line no-unused-vars
|
inputs.codecs = inputs.codecs.split(',');
|
||||||
function plugin(file, librarySettings, inputs, otherArguments) {
|
|
||||||
const lib = require('../methods/lib')();
|
|
||||||
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
|
||||||
inputs = lib.loadDefaultValues(inputs, details);
|
|
||||||
|
|
||||||
if (inputs.codecs == "" || inputs.codecs == "undefined") {
|
if (file.ffProbeData.streams.filter((x) => x.codec_type === 'video' && x.avg_frame_rate !== '0/0').length) {
|
||||||
response.infoLog += '☒No codecs selected!\n';
|
response.infoLog += '☒File contains video!\n';
|
||||||
return response;
|
return response;
|
||||||
} else {
|
}
|
||||||
inputs.codecs = inputs.codecs.split(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = {
|
// Either transcode to FLAC or ignore file
|
||||||
processFile: false,
|
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
|
||||||
preset: '<io> -c:a flac -f flac',
|
for (let j = 0; j < inputs.codecs.length; j += 1) {
|
||||||
container: '.flac',
|
if (
|
||||||
handBrakeMode: false,
|
file.ffProbeData.streams[i].codec_type === 'audio'
|
||||||
FFmpegMode: true,
|
&& file.ffProbeData.streams[i].codec_name.toLowerCase() === inputs.codecs[j].toLowerCase().trim()
|
||||||
reQueueAfter: true,
|
) {
|
||||||
infoLog: '',
|
response.processFile = true;
|
||||||
};
|
response.infoLog += `☒Found ${inputs.codecs[j].toLowerCase().trim()} codec!\n`;
|
||||||
|
return response;
|
||||||
if (file.ffProbeData.streams.filter((x) => x.codec_type === 'video' && x.avg_frame_rate !== '0/0').length) {
|
|
||||||
response.infoLog += '☒File contains video!\n';
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Either transcode to FLAC or ignore file
|
|
||||||
for(var i = 0; i < file.ffProbeData.streams.length; i++) {
|
|
||||||
for(var j = 0; j < inputs.codecs.length; j++) {
|
|
||||||
if(file.ffProbeData.streams[i].codec_type === 'audio' && file.ffProbeData.streams[i].codec_name.toLowerCase() === inputs.codecs[j].toLowerCase().trim()) {
|
|
||||||
response.processFile = true;
|
|
||||||
response.infoLog += '☒Found ' + inputs.codecs[j].toLowerCase().trim() + ' codec!\n';
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response.infoLog += '☑No matching codecs found!\n';
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
response.infoLog += '☑No matching codecs found!\n';
|
||||||
module.exports.details = details;
|
return response;
|
||||||
module.exports.plugin = plugin;
|
};
|
||||||
|
|
||||||
|
module.exports.details = details;
|
||||||
|
module.exports.plugin = plugin;
|
||||||
|
|||||||
Loading…
Reference in new issue