Skip to content

Instantly share code, notes, and snippets.

@khaosx
Last active December 22, 2020 03:16
Show Gist options
  • Save khaosx/068f6e811cc67219f809661b52f5ca76 to your computer and use it in GitHub Desktop.
Save khaosx/068f6e811cc67219f809661b52f5ca76 to your computer and use it in GitHub Desktop.
Verifies that all media in source dir has been transcoded
# verify-media.ps1
#
# Copyright 2020 - K. Austin Newman
# Version: 1.0
# Verifies that all media in source dir has been transcoded
# Usage: verify-media <path>
if ( $args.count -eq 0 ) {
write-warning "No source specified. Exiting."
exit
}
else {
$dirSource = Resolve-Path -LiteralPath "$args"
}
write-host "Getting all MKV files for processing"
write-host "Source dir is $dirSource"
$fPrepArray = Get-ChildItem -recurse $dirSource -include *.mkv -File
$outputCSV = "movie_compare.csv"
New-Item -Force -Path d:\ -Name $outputCSV -ItemType "file"
"Movie Name,Status,Transcoded Date" | add-content -path d:\$outputCSV
foreach ( $element in $fPrepArray ) {
$strTheFile = $element.ToString()
$strFilename = (Get-Item $strTheFile).Basename
$target = "M:\Encoding Logs\$strFilename.mkv.log"
if ( Test-Path $target ) {
$fCreation = (Get-item $target).creationtime
"`"$strFilename`",Transcoded,`"$fCreation`"" | add-content -path d:\$outputCSV
}
else {
"`"$strFilename`",MISSING,-" | add-content -path d:\$outputCSV
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment