Modified from Jim's url-text.py
I am not a programmer, so use at your own risk. I hacked this together one day because I needed to get data from a Sportzcast Scorebot into OBS. This uses the XML file created by Sportzcast's LiveXML software and other sources and looks for text sources with names that match XML tags in the XML file.
E.g, To get <clock> data, create a new text source named %clock%
You can use this for other XML Data as well but it will need to be formatted like so:
You can use the "Search Whole XML File" added in version 0.3 to allow pulling data that is not formatted just like above. WARNING: This may break something if you have multiple elements with the same name or use a parent element name.
Code:
<?xml version="1.0" encoding="utf-8"?>
<info>
<parameter1>value1</parameter1>
<parameter2>value2</parameter2>
</info>
Example:
Code:
<?xml version="1.0" encoding="utf-8"?>
<info>
<Hscore>42</Hscore>
<Vscore>30</Vscore>
<possession>H</possession>
<Hpos>.</Hpos>
<Vpos>
</Vpos>
<Htimeouts>4</Htimeouts>
<Vtimeouts>3</Vtimeouts>
<HTOGraphic>- - - -</HTOGraphic>
<VTOGraphic>- - -</VTOGraphic>
<down>2</down>
<downtext>2nd</downtext>
</info>
Value Changes via CSV (added v0.5)
You can select a CSV file to change values outputted by the scoreboard to values you want to appear on screen.
The CSV must be formatted like so:
XMLTag,inputvalue,outputvalue
Example:
GLOBAL_DATA_DOWN,1,1st
GLOBAL_DATA_DOWN,2,2nd
GLOBAL_DATA_DOWN,3,3rd
GLOBAL_DATA_DOWN,4,4th
GLOBAL_DATA_GAME_PERIOD,1,1st
GLOBAL_DATA_GAME_PERIOD,2,2nd
GLOBAL_DATA_GAME_PERIOD,3,3rd
GLOBAL_DATA_GAME_PERIOD,4,4th
TIMEOUTS,1,-
TIMEOUTS,2,- -
TIMEOUTS,3,- - -
TIMEOUTS,4,- - - -
A good example use case for this is changing quarters or downs from cardinal numbers to ordinal numbers, i.e. changing 3 to 3rd, or changing from changing timeout numbers to symbols, i.e. 3 to - - -
In v0.4, if your XML file includes a namespace
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<SCOREBOARD_DATA xmlns="SomeNameSpaceText">
Known issue:
It seems to throw out a Python error when the script tries to pull data at the same time that the XML is writing to disk. Doesn't affect the functionality of the script, it's just annoying. If someone knows how to fix that, please let me know. I'm sure it's an easy fix.