November 11, 201411 yr I have a mixture of DVD movies and Blu-Ray movies on my server, I think I have most of them sorted but to save from checking every movie does anyone have a script they use to list all media files in a directory with the file name, extension and video/audio codecs? I initially searched for anything that wasn't mkv and went through those, but I've ran across a few MKV's that I ripped a long time ago (when I only had ONE storage drive!) that in order to save space I ripped with lower quality audio losing 5.1 to stereo.
November 11, 201411 yr You can do what you want with FileBot. filebot -mediainfo path/to/files --format "{fn} {resolution} {vc} {ac}" I put together a little PowerShell script that queries a share for all the movies, then runs FileBot against each one, and then exports it all out to a CSV. Im sure there are easier ways to do this, but I'm very familiar with PowerShell. $Now = Get-Date -Format yyyy-MM-dd $MovieShare = "\\nas\BluRay" $CSV = "$MovieShare\Movies.$Now.csv" $Movies = @(Get-ChildItem $MovieShare -Directory | Sort-Object) $MovieInfo = @() foreach ($movie in $Movies) { Write-Host "Fetching"$movie.fullname"..." -ForegroundColor Magenta #Finds the largest file $file = $null $file = Get-ChildItem $movie.fullname -file | sort length | select -last 1 $FilePath = $file.fullname $filebot = "C:\Progra~1\FileBot\filebot.exe -mediainfo `"$FilePath`" --format `"{source},{resolution},{vc},{ac}`"" $Return = Invoke-Expression $filebot $Source = ($Return.split(","))[0] $Resolution = ($Return.split(","))[1] $VC = ($Return.split(","))[2] $AC = ($Return.split(","))[3] $file | Add-Member -MemberType NoteProperty -Name Source -Value $Source $file | Add-Member -MemberType NoteProperty -Name Resolution -Value $Resolution $file | Add-Member -MemberType NoteProperty -Name VC -Value $VC $file | Add-Member -MemberType NoteProperty -Name AC -Value $AC $MovieInfo += $file } $MovieInfo | select Name,Directory,Source,Resolution,VC,AC | Sort-Object | Export-Csv $CSV -NoTypeInformation
November 11, 201411 yr Author Getting an error that the parameter -Directory cannot be found? Ok, changed that to recurse which seemed to work. Now getting the attached errors.
November 12, 201411 yr I didnt even think about this... what version of PowerShell are you running? The '-Directory' parameter is only in PS 3.0+. I'm running 4.0.
November 12, 201411 yr Author Not sure, lol. I'll check tonight when I get home. I did end up getting it to run but it ran for hours and it never finished fetching the files, I think I got it stuck in an endless loop. Edit: just dialed in and checked. I'm on 2.0, I'll update and try again tonight.
November 12, 201411 yr Try changing: $Movies = @(Get-ChildItem $MovieShare -Directory | Sort-Object) to: $Movies = @(Get-ChildItem $MovieShare | ? { $_.PSIsContainer } | Sort-Object) and $file = Get-ChildItem $movie.fullname -file | sort length | select -last 1 to: $file = Get-ChildItem $movie.fullname | ? { !$_.PSIsContainer } | sort length | select -last 1
November 12, 201411 yr Author Updating to PS 4.0 now, if that doesn't work I'll make the changes and see where that leaves me. Thanks for the help, I've got zero powershell experience so your saving me a lot of googling, lol. I know I could script something on the linux side but I don't want to mess with installing the needed packages to get that info. Mainly all of the dependencies for ffmpeg!
Archived
This topic is now archived and is closed to further replies.