XML Help

Hi all,

im trying to see if i can use VVVV to display a countdown for a video clip playing in Vmix

you can query Vmix threw a Http based API,if you call http://192.168.0.7:8088/api/?

it returns the below XML - what want to do is extract the value of both position and duration and by subtracting one from the other i can get a countdown but how do i get at thoses values in VVVV? i have been playing with http get and xpath but i can only get it to return the clip name eg List - clive in cayman isles.avi

any help would be good thanks

<vmix>
<inputs>
<input key="b0433c0a-da70-4a5c-b1c9-9839ec6ba43f" number="1" type="VideoList" state="Paused" position="77232" duration="85520" muted="False" loop="False" selectedIndex="1">List - clive in cayman isles.avi</input>
<input key="c877db82-336c-4845-97f0-8b49661e0867" number="2" type="Blank" state="Paused" position="0" duration="0" muted="True" loop="False">Blank</input>
</inputs>
<overlays>
<overlay number="1"/>
<overlay number="2"/>
<overlay number="3"/>
<overlay number="4"/>
<overlay number="5"/>
<overlay number="6"/>
</overlays>
<preview>2</preview>
<active>1</active>
<fadeToBlack>False</fadeToBlack>
<transitions>
<transition number="1" effect="Fade" duration="500"/>
<transition number="2" effect="Wipe" duration="500"/>
<transition number="3" effect="Fly" duration="500"/>
<transition number="4" effect="Zoom" duration="1000"/>
</transitions>
<recording>False</recording>
<external>False</external>
<streaming>False</streaming>
<playList>False</playList>
<multiCorder>False</multiCorder>
</vmix>

Post your xpath expression or try to add at the end @position to address the attribute “position” something like that

/vmix/inputs/input[0](0)/@position

thanks but I now cant seem to get anything out of the xml

ive stuck a copy of the xml at http://niprltd.co.uk/api.xml

if someone could knock me up a example patch i would be great full

thanks

Ian

like this?

perhaps anyone can solve the GetElements-part?

xml.v4p (24.3 kB)

it comes down to xpath

//input[1](1)/@duration
//input[1](1)/@position

or conditional

//input[@state = "Running"](@state = "Running")/@duration
//input[@state = "Running"](@state = "Running")/@position

i left the other ways i probed into these nodes in the patch, so maybe it helps shed some light on the differences in their purpose.

while the _xpath_kind are made to quickly query into the context, the ones with _byname_simply do that: return the child elements with that name. using them you will need to traverse deeper into the context element by element.

i assume you could always make yourself a nice xpath search query, no matter the problem you throw at it

xml.v4p (33.7 kB)

just added some more possibilities

xml2.v4p (61.4 kB)

hehe, looks like we’re starting a nice little xml-competition here…

thanks for the excplanations.

we should add some helppatches…

the Prune looks good too, never used it before

just be careful, the node automatically prepends a self:: to the query and consequently blocks a few valid queries that work with the other xpath nodes. it makes usage a little bit inconsistent, adding a * in front of the query seems to help to restore the context.

//input[@state = "Running"](@state = "Running")

becomes

*//input[@state = "Running"](@state = "Running")

As far as I know this will be “fixed” for the upcoming release.

Hi

Thanks for the above help - very useful

I’m now using Http Get to get the XML from the server , this works but what is the best way to set it to refresh say 10 times a second

Thanks

Ian

any one???

Connect Change of LFO (Animation) to Refresh of HTTP (Network Get String). Set Period of LFO (Animation) to 10.