Skip to content

Commit 0b649fd

Browse files
Fix config parsing
Fix config parsing when non-parameter options are in encoder.ini.
1 parent a433179 commit 0b649fd

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

FFEncoder.ps1

+18-17
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ param (
278278
[Alias('Enc')]
279279
[string]$Encoder = 'x265',
280280

281-
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'CRF')]
282-
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'VMAF')]
283-
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'PASS')]
284-
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'QP')]
281+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'CRF', HelpMessage='Enter full path to source file')]
282+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'VMAF', HelpMessage='Enter full path to source file')]
283+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'PASS', HelpMessage='Enter full path to source file')]
284+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'QP', HelpMessage='Enter full path to source file')]
285285
[ValidateScript( { if (Test-Path $_) { $true } else { throw 'Input path does not exist' } } )]
286286
[Alias('I', 'Reference', 'Source')]
287287
[string]$InputPath,
@@ -330,7 +330,8 @@ param (
330330
[Parameter(Mandatory = $false, ParameterSetName = 'QP')]
331331
[ValidateSet('copy', 'c', 'copyall', 'ca', 'aac', 'none', 'n', 'ac3', 'dee_dd', 'dee_ac3', 'dd', 'dts', 'flac', 'f',
332332
'eac3', 'ddp', 'dee_ddp', 'dee_eac3', 'dee_ddp_51', 'dee_eac3_51', 'dee_thd', 'fdkaac', 'faac', 'aac_at',
333-
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)]
333+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
334+
)]
334335
[Alias('A2')]
335336
[string]$Audio2 = "none",
336337

@@ -352,10 +353,11 @@ param (
352353
[Parameter(Mandatory = $false, ParameterSetName = 'QP')]
353354
[ValidateSet('all', 'a', 'copyall', 'ca', 'none', 'default', 'd', 'n', 'eng', 'fre', 'ger', 'spa', 'dut', 'dan',
354355
'fin', 'nor', 'cze', 'pol', 'chi', 'zho', 'kor', 'gre', 'rum', 'rus', 'swe', 'est', 'ind', 'slv', 'tur', 'vie',
355-
'hin', 'heb', 'ell', 'bul', 'ara', 'por', 'nld',
356+
'hin', 'heb', 'ell', 'bul', 'ara', 'por', 'nld', 'tha',
356357
'!eng', '!fre', '!ger', '!spa', '!dut', '!dan', '!fin', '!nor', '!cze', '!pol', '!chi', '!zho', '!kor', '!ara',
357358
'!rum', '!rus', '!swe', '!est', '!ind', '!slv', '!tur', '!vie', '!hin', '!heb', '!gre', '!ell', '!bul', '!por',
358-
'!nld')]
359+
'!nld', '!tha'
360+
)]
359361
[Alias('S', 'Subs')]
360362
[string]$Subtitles = 'default',
361363

@@ -366,7 +368,7 @@ param (
366368
[Alias('P')]
367369
[string]$Preset = 'slow',
368370

369-
[Parameter(Mandatory = $true, ParameterSetName = 'CRF')]
371+
[Parameter(Mandatory = $true, ParameterSetName = 'CRF', HelpMessage = 'Enter CRF value (1-51)')]
370372
[ValidateRange(0.0, 51.0)]
371373
[Alias('C')]
372374
[double]$CRF,
@@ -376,7 +378,7 @@ param (
376378
[Alias('QP')]
377379
[int]$ConstantQP,
378380

379-
[Parameter(Mandatory = $true, ParameterSetName = 'PASS')]
381+
[Parameter(Mandatory = $true, ParameterSetName = 'PASS', HelpMessage = 'Enter 2-pass Average Bitrate (Ex: 5M or 5000k)')]
380382
[Alias('VBitrate')]
381383
[ValidateScript(
382384
{
@@ -706,10 +708,10 @@ param (
706708
[Alias('CreateTagFile')]
707709
[hashtable]$GenerateMKVTagFile,
708710

709-
[Parameter(Mandatory = $true, ParameterSetName = 'CRF')]
710-
[Parameter(Mandatory = $true, ParameterSetName = 'VMAF')]
711-
[Parameter(Mandatory = $true, ParameterSetName = 'PASS')]
712-
[Parameter(Mandatory = $true, ParameterSetName = 'QP')]
711+
[Parameter(Mandatory = $true, ParameterSetName = 'CRF', HelpMessage = 'Enter full path to encoded output file')]
712+
[Parameter(Mandatory = $true, ParameterSetName = 'VMAF', HelpMessage = 'Enter full path to encoded output file')]
713+
[Parameter(Mandatory = $true, ParameterSetName = 'PASS', HelpMessage = 'Enter full path to encoded output file')]
714+
[Parameter(Mandatory = $true, ParameterSetName = 'QP', HelpMessage = 'Enter full path to encoded output file')]
713715
[ValidateNotNullOrEmpty()]
714716
[Alias('O', 'Encode', 'Distorted')]
715717
[string]$OutputPath,
@@ -1011,12 +1013,11 @@ if ($EncoderExtra) {
10111013
}
10121014
foreach ($item in $EncoderExtra.GetEnumerator()) {
10131015
# If setting is in hash, get the key
1014-
if ($paramHash.Values.Contains($item.Name.ToLower())) {
1015-
$key = $paramHash.Keys.Where({ $paramHash[$_] -contains $item.Name })
1016-
}
1017-
else {
1016+
$hasValue = $paramHash.Values.Contains($item.Name)
1017+
if ($hasValue -notcontains $true) {
10181018
continue
10191019
}
1020+
$key = $paramHash.Keys.Where({ $paramHash[$_] -contains $item.Name })
10201021
# Related setting param not passed via CLI
10211022
if (!$PSBoundParameters[$key]) {
10221023
if ($key -eq 'VBV') {

modules/FFTools/FFTools.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ___________ .__ __ .__ ______________________
138138
'@
139139

140140
# Current script release version. Used for download prompt
141-
[version]$release = '2.4.2'
141+
[version]$release = '2.4.3'
142142

143143

144144
#### End module variables ####

0 commit comments

Comments
 (0)