DYosua wrote:Regarding the time remaining in the current song, you should be able to calculate this by using the "position" and "duration" fields in the raw API xml (http://localhost:8088/API) and looking at the input which contains the song that is currently playing. Both numbers are in milliseconds, and contain the current position and the length of the file. You could then have a function which converts the remaining time (duration - position) from milliseconds to minutes/seconds.
Unfortunately I do not believe there is a way to retrieve other list items via the API - I submitted a Feature Request on this some time ago but I don't believe there was enough interest to get it implemented.
I found a way to do it in the forums...
using powershell
#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 = "NewsHD.xaml",
[string]$title_name = "Headline",
[string]$trans_no = "5"
)
[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: 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/iterations to hold the title", "Number", $trans_no)
$lasttitle = ""
$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=OverlayInput4In&Input=$input_no"
$transouturl = "http://localhost:8088/API/?Function=OverlayInput4Out&Input=$input_no"
$transcount = 0
while ($true) {
[xml]$data = (New-Object System.Net.WebClient).DownloadString($xmlurl)
$node = $data.SelectNodes("/vmix/inputs/input[@state='Running']")
$title = ($node | Select-Object -ExpandProperty title | Out-String)
$title = $title.split('.')[0]
if ($lasttitle -ne $title) {
write-host "Updating Vmix input $input_no - $title_name"
write-host "With: " $title
$apicallurl = $apicallurl1 + $title
write-host $apicallurl
(New-Object System.Net.WebClient).DownloadString("$apicallurl")
Start-Sleep -Seconds 2
write-host "Transitioning $input_no In"
(New-Object System.Net.WebClient).DownloadString("$transinurl")
$transcount = 1
}
write-host "------waiting-------"
Start-Sleep -Seconds 1
$lasttitle = $title
if ($transcount -eq $trans_no) {
write-host "Transitioning $input_no Out"
(New-Object System.Net.WebClient).DownloadString("$transouturl")
}
$transcount++
if ($Host.UI.RawUI.KeyAvailable -and ("q" -eq $Host.UI.RawUI.ReadKey("IncludeKeyUp,NoEcho").Character)) {
Write-Host "Exiting now..."
break;
}
}