logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
mitchstein443  
#1 Posted : Sunday, November 20, 2016 3:06:57 PM(UTC)
mitchstein443

Rank: Advanced Member

Groups: Registered
Joined: 4/11/2015(UTC)
Posts: 64
Man
United States
Location: Home

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
I have a playlist of files, what I want to be able to do is make a title that contains the name of the current file playing and if possible the next file that it will play and how long until it will play it.

I figured out how to use the adi to load the playlist, create the title and display the title. what I can't figure out is how to pull the name of the file being played by input#2 and the time left of that file and then get the name of the next title..

If I could figure that out I know how to update the title..

I've searched the help file and forums but do not see anyone else doing it that way.
DYosua  
#2 Posted : Sunday, November 20, 2016 10:49:52 PM(UTC)
DYosua

Rank: Advanced Member

Groups: Registered
Joined: 2/24/2014(UTC)
Posts: 45
Man
United States
Location: Maine, USA

Thanks: 26 times
Was thanked: 14 time(s) in 12 post(s)
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.
mitchstein443  
#3 Posted : Monday, November 21, 2016 5:49:08 AM(UTC)
mitchstein443

Rank: Advanced Member

Groups: Registered
Joined: 4/11/2015(UTC)
Posts: 64
Man
United States
Location: Home

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
hmm, well that is a start... can you show me where this is in the documentation or point me to an example ofh ow to this? And does it work with mp4 files?
mitchstein443  
#4 Posted : Monday, November 21, 2016 6:26:04 AM(UTC)
mitchstein443

Rank: Advanced Member

Groups: Registered
Joined: 4/11/2015(UTC)
Posts: 64
Man
United States
Location: Home

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
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;
}
}

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.