Rank: Advanced Member
Groups: Registered
Joined: 9/1/2015(UTC) Posts: 126 Location: Ecuador Thanks: 2 times Was thanked: 16 time(s) in 12 post(s)
|
Thanks for the code @Speegs, it has been very helpful, for new opportunities of use in vmix. I am not a programmer and have never heard of powershell, however law, law, law and law information and try to understand how the code works. Now here I leave the modification made to the @Speeg code, it is at my convenience to use it in Latin Spanish language. Info: - Launches the title of the entry that you select, only if it is active - Launch the overlay 2 times 1) 10 seconds after the video starts and, 2) 20 seconds before the video ends - Modifies special characters, to place accents and eñes (for those who use Latin Spanish) - Removes the "List" text from the entry - Delete the extension of the Ex file: ".mp4", other extensions can be added if necessary. - The display shows the duration of the video, the elapsed time and the time remaining, the state whether it is running or paused. P.D. There is a small detail that I have not been able to solve; Again the overlay is thrown when it marks an approximate time of 1.40 minutes, the truth I am not expert and I do not understand because it gives that situation, if they can fix that small detail would be wonderful, or if it is that they do not care that the title Appear in the middle of the video, enjoy it. Code:#Finds the First Playlist and Grabs the currently playing filename. Removes extension and sends it to the user defined title. Designed to run minimized every second. Hitting "q" in the console will close it.
param (
[string]$input_no = "4",
[string]$title_name = "Headline",
[string]$trans_no = "6",
[string]$in_num = "10"
)
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
#The input number for the Vmix Title to Change
$input_no = [Microsoft.VisualBasic.Interaction]::InputBox("PLEASE ENTER VMIX TITLE INPUT NUMBER OR TITLE NAME EG: Input 2/NewsHD.xaml )", "Number/Title", $input_no)
#The name of the title field to modify, on NewsHD.xaml would either be Headline or Description
$title_name = [Microsoft.VisualBasic.Interaction]::InputBox("PLEASE ENTER VMIX TITLE TEXT FIELD TO MODIFY (EG: HEADLINE OR DESCRIPTION)", "Item to Modify", $title_name)
#The number of sleeps before transitioning out
$trans_no = [Microsoft.VisualBasic.Interaction]::InputBox("PLEASE ENTER THE NUMBER OF SECONDS/INTERATIONS TO HOLD THE TITLE","Number", $trans_no)
#The number of input to use
$in_num = [Microsoft.VisualBasic.Interaction]::InputBox("PLEASE ENTER THE NUMBER OF INPUT WITH VIDEOCLIPS", "Number", $in_num)
$lasttitle = ""
#Intervale time to wait for overlay IN on star clip, in milisecons
$state1 = "10000"
$state2 = "10700"
#Intervale time to wait for overlay IN on end clip, in milisecons
$state3 = "20000"
$state4 = "19000"
while ($true) {
$xmlurl = "http://localhost:8088/API/"
$apicallurl1 = "http://localhost:8088/API/?Function=SetText&Input=$input_no&SelectedName=$title_name&Value="
$transinurl = "http://localhost:8088/API/?Function=OverlayInput3In&Input=$input_no"
$transouturl = "http://localhost:8088/API/?Function=OverlayInput3Out&Input=$input_no"
[xml]$data = (New-Object System.Net.WebClient).DownloadString($xmlurl)
$node = $data.SelectNodes("/vmix/inputs/input[@number='$in_num']")
$title = ($node | Select-Object -ExpandProperty title | Out-String)
$playnow = ($node | Select-Object -ExpandProperty state | Out-String)
$position = ($node | Select-Object -ExpandProperty position | Out-String)
$duration = ($node | Select-Object -ExpandProperty duration | Out-String)
$title = $title.Replace("List - ","")
$title = $title.Replace("á","á")
$title = $title.Replace("é","é")
$title = $title.Replace("ó","ó")
$title = $title.Replace("ú","ú")
$title = $title.Replace("Ñ","Ñ")
$title = $title.Replace("ñ","ñ")
#Add the extension of the video if it is not in the list, to remove the extension in the titled
$title = $title.Replace(".mp4","")
$title = $title.Replace(".mov","")
$title = $title.Replace(".wmv","")
$title = $title.Replace(".mkv","")
$title = $title.Replace(".m4v","")
$title = $title.Replace(".m2ts","")
#Especial character
$title = $title.Replace("Ã","í")
$apicallurl = $apicallurl1 + $title
$tremain = $duration - $position
#Time in seconds
$position1 = $position/60000
$tremain1 = $tremain/60000
$ttotal = $duration/60000
(New-Object System.Net.WebClient).DownloadString("$apicallurl")
if (($position -gt $state1) -and ($position -lt $state2)) {
#OVERLAY IN
write-host "---------------------------"
write-host "___________________________"
write-host "NOW OVERLAY INPUT $input_no ON-AIR"
write-host "---------------------------"
(New-Object System.Net.WebClient).DownloadString("$transinurl")
write-host "------ON AIR-------"
write-host "------ON AIR-------"
write-host "------ON AIR-------"
Start-Sleep -Seconds $trans_no
#OVERLAY OUT
write-host "___________________________"
write-host "NOW OVERLAY INPUT $input_no OUT-AIR"
write-host "---------------------------"
(New-Object System.Net.WebClient).DownloadString("$transouturl")
}
Elseif (($tremain -lt $state3) -and ($tremain -gt $state4)) {
#OVERLAY IN
write-host "---------------------------"
write-host "___________________________"
write-host "NOW OVERLAY INPUT $input_no ON-AIR"
write-host "---------------------------"
(New-Object System.Net.WebClient).DownloadString("$transinurl")
write-host "------ON AIR-------"
write-host "------ON AIR-------"
write-host "------ON AIR-------"
Start-Sleep -Seconds $trans_no
#OVERLAY OUT
write-host "___________________________"
write-host "NOW OVERLAY INPUT $input_no OUT-AIR"
write-host "---------------------------"
(New-Object System.Net.WebClient).DownloadString("$transouturl")
}
write-host "------------------------"
write-host "------DATE OF CLIP------"
Start-Sleep -Seconds 1
write-host "CLIP ON AIR: $title"
write-host "STATE: $playnow"
write-host "TIME TOTAL: $ttotal"
write-host "TIME ELAPSED: $position1"
write-host "TIME REMAIN: $tremain1"
#end
}
|
2 users thanked JAIRODJ for this useful post.
|
|