vMix Forums
»
General
»
General Discussion
»
Reading Title data from a file/website and refesh
Rank: Advanced Member
Groups: Registered
Joined: 8/3/2013(UTC) Posts: 405 Location: Gold Coast, Australia
Thanks: 27 times Was thanked: 76 time(s) in 58 post(s)
|
Hello,
I have an XML data source that can give me information that is updated constantly and quickly (it's a very small chunk of data). I would like to be able to display that data in a title.
Is there any way do to that? IE Read URL every 2 seconds (yes pretty frequent) and display <field1> <field2> etc as a title.
Happy to look at plugins if they exist. I could also write a powershell script to pull down the xml and convert it to CSV or some other format.
After about 4 text fields and they will update quickly.
Currently I screen capture our bidboard, which is essentially like a score board. Was just after a more flexible way, were I can configure the fonts, colours etc.. as per a vmix title and have the data "refresh" quickly.
Regards,
Speegs
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,223 Location: Belgium Thanks: 293 times Was thanked: 955 time(s) in 790 post(s)
|
Check this post to get an idea. I used the principle of this title to read xml files frequently for automatic updates. Guy
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/3/2013(UTC) Posts: 405 Location: Gold Coast, Australia
Thanks: 27 times Was thanked: 76 time(s) in 58 post(s)
|
doggy wrote:Check this post to get an idea. I used the principle of this title to read xml files frequently for automatic updates. Guy Found another way (proof of concept worked for me, figured I'd share it in case it helps someone else). It grabs data from a URL and sends it via VMix API into the NewsHD.xaml title in this example I make to do a test. Pauses 1 second before updating again. Pressing "q" in the powershell window will stop the loop. Using Powershell 2.0 or higher. Code:
while ($true) {
[xml]$data = (New-Object System.Net.WebClient).DownloadString("url-removed")
write-host "Headline: " $data.object.headline
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Headline&Value=" + $data.object.headline
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
write-host "Description: " $data.object.description
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Description&Value=" + $data.object.description
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
Start-Sleep -Seconds 1
if ($Host.UI.RawUI.KeyAvailable -and ("q" -eq $Host.UI.RawUI.ReadKey("IncludeKeyUp,NoEcho").Character)) {
Write-Host "Exiting now..."
break;
}
}
Anyway I hope that helps someone, I'm not a great programmer, this seemed like the easiest and most reliable/simple way of getting some data from XML on the web into Vmix. You just have to run the script in the background on the same machine (or a different one if you change the "localhost" to the IP of the Vmix machine). Anyone looking to use it, best google how to parse nodes in XML to get the data they want. There is no real error checking here use at your own risk of course, but shutting off vmix or the internet breaking just results in timeout errors until the URLs are reachable again. Enjoy :) The image would have worked too, but was more difficult I thought than it needed to be as I had to first create a PNG every 1 second.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,223 Location: Belgium Thanks: 293 times Was thanked: 955 time(s) in 790 post(s)
|
Quote:The image would have worked too, but was more difficult I thought than it needed to be as I had to first create a PNG every 1 second. you wouldn't have to create a png !! The idea behind is that there is a regular trigger to check and read an XML just like in your external script instead of checking for an image. Difference is the title text would be auto-updated from within the title script itself instead of externally by http by updating the textblocks. edit: combination of this dynamic image title and the WeatherApp Title parts
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/3/2013(UTC) Posts: 405 Location: Gold Coast, Australia
Thanks: 27 times Was thanked: 76 time(s) in 58 post(s)
|
doggy wrote:Quote:The image would have worked too, but was more difficult I thought than it needed to be as I had to first create a PNG every 1 second. you wouldn't have to create a png !! The idea behind is that there is a regular trigger to check and read an XML just like in your external script instead of checking for an image. Difference is the title text would be auto-updated from within the title script itself instead of externally by http by updating the textblocks. edit: combination of this dynamic image title and the WeatherApp Title parts Excellent, the idea of not running a script seems cool. I'll have a deeper look and see if I can figure it out. The example was reloading an image, I'm totally green on XAML and I don't have any tools for it. Sounds worth learning. I did try and find information, but looked more difficult than a shell scripting language to master.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 12/7/2014(UTC) Posts: 17 Location: USA Thanks: 2 times
|
Speegs wrote:doggy wrote:Check this post to get an idea. I used the principle of this title to read xml files frequently for automatic updates. Guy Found another way (proof of concept worked for me, figured I'd share it in case it helps someone else). It grabs data from a URL and sends it via VMix API into the NewsHD.xaml title in this example I make to do a test. Pauses 1 second before updating again. Pressing "q" in the powershell window will stop the loop. Using Powershell 2.0 or higher. Code:
while ($true) {
[xml]$data = (New-Object System.Net.WebClient).DownloadString("url-removed")
write-host "Headline: " $data.object.headline
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Headline&Value=" + $data.object.headline
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
write-host "Description: " $data.object.description
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Description&Value=" + $data.object.description
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
Start-Sleep -Seconds 1
if ($Host.UI.RawUI.KeyAvailable -and ("q" -eq $Host.UI.RawUI.ReadKey("IncludeKeyUp,NoEcho").Character)) {
Write-Host "Exiting now..."
break;
}
}
Anyway I hope that helps someone, I'm not a great programmer, this seemed like the easiest and most reliable/simple way of getting some data from XML on the web into Vmix. You just have to run the script in the background on the same machine (or a different one if you change the "localhost" to the IP of the Vmix machine). Anyone looking to use it, best google how to parse nodes in XML to get the data they want. There is no real error checking here use at your own risk of course, but shutting off vmix or the internet breaking just results in timeout errors until the URLs are reachable again. Enjoy :) The image would have worked too, but was more difficult I thought than it needed to be as I had to first create a PNG every 1 second. I tried this in Powershell and i got and error saying I cant get it to work. All i am trying to do is pull the live temperature and current conditions from a RSS feed or a XML weather file. Thanks
|
|
|
|
Rank: Member
Groups: Registered
Joined: 12/7/2014(UTC) Posts: 17 Location: USA Thanks: 2 times
|
dustink568 wrote:Speegs wrote:doggy wrote:Check this post to get an idea. I used the principle of this title to read xml files frequently for automatic updates. Guy Found another way (proof of concept worked for me, figured I'd share it in case it helps someone else). It grabs data from a URL and sends it via VMix API into the NewsHD.xaml title in this example I make to do a test. Pauses 1 second before updating again. Pressing "q" in the powershell window will stop the loop. Using Powershell 2.0 or higher. Code:
while ($true) {
[xml]$data = (New-Object System.Net.WebClient).DownloadString("url-removed")
write-host "Headline: " $data.object.headline
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Headline&Value=" + $data.object.headline
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
write-host "Description: " $data.object.description
$apicallurl= "http://localhost:8088/API/?Function=SetText&InputTitle=NewsHD.xaml&SelectedName=Description&Value=" + $data.object.description
(New-Object System.Net.WebClient).DownloadString("$apicallurl");
Start-Sleep -Seconds 1
if ($Host.UI.RawUI.KeyAvailable -and ("q" -eq $Host.UI.RawUI.ReadKey("IncludeKeyUp,NoEcho").Character)) {
Write-Host "Exiting now..."
break;
}
}
Anyway I hope that helps someone, I'm not a great programmer, this seemed like the easiest and most reliable/simple way of getting some data from XML on the web into Vmix. You just have to run the script in the background on the same machine (or a different one if you change the "localhost" to the IP of the Vmix machine). Anyone looking to use it, best google how to parse nodes in XML to get the data they want. There is no real error checking here use at your own risk of course, but shutting off vmix or the internet breaking just results in timeout errors until the URLs are reachable again. Enjoy :) The image would have worked too, but was more difficult I thought than it needed to be as I had to first create a PNG every 1 second. I tried this in Powershell and i got and error saying I cant get it to work. All i am trying to do is pull the live temperature and current conditions from a RSS feed or a XML weather file. Thanks
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/3/2013(UTC) Posts: 405 Location: Gold Coast, Australia
Thanks: 27 times Was thanked: 76 time(s) in 58 post(s)
|
Quote: I tried this in Powershell and i got and error saying I cant get it to work. All i am trying to do is pull the live temperature and current conditions from a RSS feed or a XML weather file. Thanks
Do you have more details on the error? This was a very CRUDE code snippet, but did work for me as a proof of concept. I imagine a few things could be at play, the RSS or XML could be a different format so could be a parsing problem. There appears to be a few ways to structure those files. I would get it reading the variables to the screen first of the script. Then I guess you most definitely wouldn't want to use NewsHD.xaml in vmix to display your output. I just used that to prove I could get something to operate. Sorry may not be a huge help, but the information you supplied had no detail. Doggy was pointing me in the direction of a better way, but I have not tried it yet.
|
1 user thanked Speegs for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 12/7/2014(UTC) Posts: 17 Location: USA Thanks: 2 times
|
Speegs wrote:Quote: I tried this in Powershell and i got and error saying I cant get it to work. All i am trying to do is pull the live temperature and current conditions from a RSS feed or a XML weather file. Thanks
Do you have more details on the error? This was a very CRUDE code snippet, but did work for me as a proof of concept. I imagine a few things could be at play, the RSS or XML could be a different format so could be a parsing problem. There appears to be a few ways to structure those files. I would get it reading the variables to the screen first of the script. Then I guess you most definitely wouldn't want to use NewsHD.xaml in vmix to display your output. I just used that to prove I could get something to operate. Sorry may not be a huge help, but the information you supplied had no detail. Doggy was pointing me in the direction of a better way, but I have not tried it yet. Do i need to change the URL in the example and put the URL i am trying to pull data from? Also I can do this easily in LIVESTREAM STUDIO... but I much rather use VMIX.....
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/3/2013(UTC) Posts: 405 Location: Gold Coast, Australia
Thanks: 27 times Was thanked: 76 time(s) in 58 post(s)
|
Quote: Do i need to change the URL in the example and put the URL i am trying to pull data from?
Also I can do this easily in LIVESTREAM STUDIO... but I much rather use VMIX.....
Yes "url-removed" is the source URL where you are retrieving the XML from. eg: that could be a weather service that is producing an XML file. Because the XML file will contain lots of stuff, you need to use this variable to locate the element of the xml file you want. $data.object.headline Now selecting the data from the XML is well something people do write books about. Here displays several ways https://www.simple-talk....ershell-data-basics-xml/ it says simple, but that depends on your definition of simple. Where does it talk to Vmix? That's what this does. http://localhost:8088/ It is the IP address and port of your VMix Web Server and you need to turn the Vmix Web interface on. This was not a refined script/application. It assumes quite a bit of powershell knowledge. If it's not top secret maybe post the URL of the weather file. I imagine you might want a Location and Temperature passed to Vmix. If you are looking for a "done" solution. This is not it, you are best looking into a fine weather plugin a developer in this forum was making.
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Reading Title data from a file/website and refesh
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.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close