Adding feature to override and review all corrupted files

This commit is contained in:
Michael Reber 2020-04-27 12:58:50 +02:00
parent f7768b4a68
commit 24a6f024b1

View File

@ -4,12 +4,13 @@
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Edit the $videoPath variable to point to your video-files folder: # Edit the $videoPath variable to point to your video-files folder:
#$videoPath = 'M:\1_movies\_main.movies\' $videoPath = 'M:\1_movies\_main.movies\'
$videoPath = 'M:\2_serien\_main.series\' #$videoPath = 'M:\2_serien\_main.series\'
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# HEVC profiles: main, main10, main444 # HEVC profiles: main, main10, main444
$profile = 'main10' $profile = 'main10'
$forceReviewAll = $false # If set to $true all failed conversions are reviewed even those that are obviously corrupt.
$NVEncoder = "$PSScriptRoot\encoder\NVEncC64.exe" $NVEncoder = "$PSScriptRoot\encoder\NVEncC64.exe"
$fileTester = "$PSScriptRoot\mediainfo.exe" $fileTester = "$PSScriptRoot\mediainfo.exe"
@ -152,7 +153,7 @@ foreach($video in $videos)
{ {
if (($StreamSize_new -eq $($StreamSize_old - 1)) -or ($($StreamSize_new - 1) -eq $StreamSize_old)) if (($StreamSize_new -eq $($StreamSize_old - 1)) -or ($($StreamSize_new - 1) -eq $StreamSize_old))
{ {
# Delete old video File! # Newly converted file does not match exactly the old duration!
Write-Host "Conversion Done! - But streamsize is not exactly the same. - Please review!" Write-Host "Conversion Done! - But streamsize is not exactly the same. - Please review!"
Write-Host Write-Host
Write-Host "------------------------------------------------------------------------------------------------" Write-Host "------------------------------------------------------------------------------------------------"
@ -162,15 +163,28 @@ foreach($video in $videos)
LogWrite "$inputFile,$outputFile" LogWrite "$inputFile,$outputFile"
} else } else
{ {
# Delete corrupt File! if ($forceReviewAll)
Write-Host "Conversion Failded! - Deleting new converted file.." -ForegroundColor Red {
Write-Host # Mark probably corrupted file for review
Write-Host "------------------------------------------------------------------------------------------------" Write-Host "Conversion Failed! - Marked for review! because it is desired."
Remove-Item -LiteralPath $outputFile Write-Host
$failedVideos = $failedVideos + 1 Write-Host "------------------------------------------------------------------------------------------------"
$notConvertedVideos = $notConvertedVideos + 1 $review = $true
$Logfile = "$PSScriptRoot\logs\$logFolderName\error_during_conversion.log" $convertedVideos = $convertedVideos + 1
LogWrite "$inputFile,$StreamSize_new,$StreamSize_old," $Logfile = "$PSScriptRoot\logs\$logFolderName\review_needed.log"
LogWrite "$inputFile,$outputFile"
} else
{
# Delete obviously corrupt File!
Write-Host "Conversion Failded! - Deleting new converted file.." -ForegroundColor Red
Write-Host
Write-Host "------------------------------------------------------------------------------------------------"
Remove-Item -LiteralPath $outputFile
$failedVideos = $failedVideos + 1
$notConvertedVideos = $notConvertedVideos + 1
$Logfile = "$PSScriptRoot\logs\$logFolderName\error_during_conversion.log"
LogWrite "$inputFile,$StreamSize_new,$StreamSize_old,"
}
} }
} }
} }