Skip to content

Instantly share code, notes, and snippets.

@khaosx
Created August 6, 2020 14:29
Show Gist options
  • Save khaosx/bff5d7cd0f99224ad5ee15e4cd68b168 to your computer and use it in GitHub Desktop.
Save khaosx/bff5d7cd0f99224ad5ee15e4cd68b168 to your computer and use it in GitHub Desktop.
Runs from a scheduled task to process any cmd files for transcoding
# process-queue.ps1
#
# Copyright 2020 - K. Austin Newman
# Version: 1.0
# Runs from a scheduled task to process any cmd files for transcoding
## Define variables
$dirBaseVolName = "Data"
$dirWorkflowRoot = "Workflows"
$dirWorkflowName = "Transcoding"
### Find drive letters for Data
$volumes = @(Get-Volume | foreach {$_.FileSystemLabel})
if ( $volumes -contains "$dirBaseVolName" ) {
$drvData = get-volume -FileSystemLabel "$dirBaseVolName"
$strRootVol = $drvData.DriveLetter
}
else {
Write-warning "Volume $dirBaseVolName not found"
exit 1
}
$dirWorkFlow = "$strRootVol`:\$dirWorkflowRoot\$dirWorkflowName"
$dirQueue = "$dirWorkFlow\Queue"
if ( $Null -eq (get-process "ffmpeg" -ea SilentlyContinue )){
$strCallCMD = Get-ChildItem $dirQueue -Filter *.cmd -File -Name | Select-Object -First 1
Invoke-Item "$dirQueue\$strCallCMD"
}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment