stax76 / Get-MediaInfo

Get-MediaInfo is a PowerShell MediaInfo solution
76 stars 11 forks source link

Piping Get-ChildItem to Get-MediaInfoValue causes errors but no breakage #9

Open HASJ opened 3 years ago

HASJ commented 3 years ago

gci | gmiv -kind video -parameter CodecID | ogv

New-Object: D:\Documentos\PowerShell\Modules\Get-MediaInfo\3.7\Get-MediaInfo.psm1:193
Line |
 193 |  …       $mi = New-Object MediaInfoSharp -ArgumentList (Convert-Path -Li …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling ".ctor" with "1" argument(s): "Error MediaInfo_Open"

InvalidOperation: D:\Documentos\PowerShell\Modules\Get-MediaInfo\3.7\Get-MediaInfo.psm1:194
Line |
 194 |          $value = $mi.GetInfo($Kind, $Index, $Parameter)
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

InvalidOperation: D:\Documentos\PowerShell\Modules\Get-MediaInfo\3.7\Get-MediaInfo.psm1:195
Line |
 195 |          $mi.Dispose()
     |          ~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
stax76 commented 3 years ago

I think the problem is it tries to process any input like folders and non-media files.