Author Topic: Script for setting the network on LSP sequences exported to LOR  (Read 2517 times)

Offline frankr

  • Sr. Member
  • ****
  • Posts: 347
    • Rocklin Lights
Hello all,

I wrote the attached script as a simple way to get the network value set in all the sequences I exported from LSTP to LOR for playback in xLights. 

If you go into the attached script you can modify the following things to achieve your goals:
    # This script works from the savedIndex xml property stored with each channel definition in an LOR file.
    #repeat this pattern for each network you want to define:
    # {'stIndex': x,'endIndex':y,'net':z},
    # you can list as many of those combinations between curly braces as you like
    # each curly brace set needs to be seperated by a comma and the whole thing
    # is within square brackets []

    networks = [{'stIndex':0,'endIndex':1, 'net':1},
                {'stIndex':2,'endIndex':3482, 'net':2},
                {'stIndex':3484,'endIndex':4798, 'net':3}]

To do this you will have to open the LOR version of the file and identify the savedIndex values on the channels you want to have the networks updated on.  You can then specify whatever combinations in the above format and those rules will be applied to your file.  If you specify more than on range that effects the same saved index the last occurrence in the above list will be what ends up in the output file.

How it works
This script simply parses the LOR XML and identifies each channel definition. it hen checks the rules listed above to see what network each channel should be assigned to.  It does this for each .lms sequence in the directory the script is executed from. When it is done it outputs the file to a new file with the word 'new' added to the front of the filename.

What you'll need to use this script
To use this script you will need to have python2.7 installed.  You can then execute the script in the directory in which you have stored your '.lms' files by issuing the command:

python setnet.py

you may have to give an absolute path for python (i.e. C:\python27\python )

This code is not fancy or special but just a quick and dirty solution to a problem anyone wanting to use xLights and LSP for their show has to solve.

Be aware that the process of parsing and updating large xml files can be very time consuming so be patient.

I hope someone finds this solution helpful.

I have not tested this on huge files yet (i.e. > 200MB) so if your sequences are that big you may run into memory errors as python is limited to 2GB of memory.

Frank


Offline sielbear

  • Sr. Member
  • ****
  • Posts: 214
I would like to add:

Frank = freaking MAN!

Thanks again for putting this together. I converted 8 sequences with it yesterday and it's quite painless!

Offline dmoore

  • Sr. Member
  • ****
  • Posts: 225
I am trying to use this script to input a network but I have a few questions:

* Should I be using "Single Network" or "Multi-Network" in xLights? 


A "clean" export of a four universe setup from LSP I get this in the LMS file:

----------------------------
      <channel name="Channel #1" color="255" centiseconds="113379" deviceType="LOR" unit="1" circuit="1" savedIndex="0">
         <effect type="intensity" startCentisecond="910" endCentisecond="9905" intensity="0" />
         <effect type="intensity" startCentisecond="9905" endCentisecond="113379" intensity="0" />
      </channel>
      <channel name="Channel #1" color="32768" centiseconds="113379" deviceType="LOR" unit="1" circuit="2" savedIndex="1">
         <effect type="intensity" startCentisecond="910" endCentisecond="9905" intensity="0" />
         <effect type="intensity" startCentisecond="9905" endCentisecond="113379" intensity="0" />
      </channel>
      <channel name="Channel #1" color="16711680" centiseconds="113379" deviceType="LOR" unit="1" circuit="3" savedIndex="2">
         <effect type="intensity" startCentisecond="910" endCentisecond="9905" intensity="0" />
         <effect type="intensity" startCentisecond="9905" endCentisecond="113379" intensity="0" />
      </channel>
---------------------------------

After I run it through "SetNet" it changes it to:

---------------------------------
   <channel centiseconds="113379" circuit="1" color="255" deviceType="LOR" name="Channel #1" savedIndex="0" unit="1">
      <effect endCentisecond="9905" intensity="0" startCentisecond="910" type="intensity" />
      <effect endCentisecond="113379" intensity="0" startCentisecond="9905" type="intensity" />
   </channel>
   <channel centiseconds="113379" circuit="2" color="32768" deviceType="LOR" name="Channel #1" network="1" savedIndex="1" unit="1">
      <effect endCentisecond="9905" intensity="0" startCentisecond="910" type="intensity" />
      <effect endCentisecond="113379" intensity="0" startCentisecond="9905" type="intensity" />
   </channel>
   <channel centiseconds="113379" circuit="3" color="16711680" deviceType="LOR" name="Channel #1" network="1" savedIndex="2" unit="1">                      <effect endCentisecond="9905" intensity="0" startCentisecond="910" type="intensity" />
      <effect endCentisecond="113379" intensity="0" startCentisecond="9905" type="intensity" />
   </channel>
--------------------------
      
My settings in SetNet are:

    networks = [{'stIndex':1,'endIndex':512, 'net':1},
                {'stIndex':513,'endIndex':1024, 'net':2},
                {'stIndex':1025,'endIndex':1536, 'net':3},
   {'stIndex':1537,'endIndex':2048, 'net':4}]

In LSP I have 4 E131 universes, each with 512 channels numbered sequentally:

Universe 1 - 1 -512
Universe 2 - 513-1024
Universe 3 - 1025-1536
Universe 4 - 1537-2049

While it works fine for output in LSP, I can't get it to output in xLights.  Any help you can provide would be appreciated!

David

Offline dmoore

  • Sr. Member
  • ****
  • Posts: 225
A big thanks goes out to Frank - he was able to help with some adjustments to the script and with a few additions to the script myself I was able to get it all working.  The upside is that now I know the interworkings of the LOR file format!

Onward with xLights!

Offline wbuehler

  • Administrator
  • Sr. Member
  • *****
  • Posts: 3579
  • Dont' that poster look dusty?
So if you want all channels to be on the same network then would something like the below be all that is needed?
I am using a pixelnet dongle with XLights, just trying some things out this morning.  I tried the below and after the conversion I can see that all channels are on the same network but the sequences play in a matter of seconds like they no longer have any length to them.

networks = [{'stIndex':0,'endIndex':2880, 'net':1}]

Thanks

Bill




Offline frankr

  • Sr. Member
  • ****
  • Posts: 347
    • Rocklin Lights
Hi Bill,

That should work.  Not sure about what you are seeing with the super short sequences after running the script.  Were the sequences workign properly before?

The only thing the script does is add the network="1" to each channel definition tag.  Everything else in the file should remain the same as it was prior to executing the script.

Frank

Offline wbuehler

  • Administrator
  • Sr. Member
  • *****
  • Posts: 3579
  • Dont' that poster look dusty?
Frank I have attached the LSP exported file and the file after the script ran.
In the original LMS file the sign will light up normally with X-Lights.  But when I try to run the "New" script the sequence starts and ends as soon as I click the button.
For giggle I went in to the Xlights converter and tried to convert the "New" script into a Vixen file and the coverter came back and said that the sequence is 0 in length.

Thanks

Bill

Offline frankr

  • Sr. Member
  • ****
  • Posts: 347
    • Rocklin Lights
Hi Bill,

It looks like you are only using one network.  Is that correct? If so you really do not need this script.  I think what is happening is you are marking each circuit as being on network 1 but since xlights is 0 based it is seeing that as being network "2" which you do not have configured.  Hence; it just stops because it does not think it has anything to do with that sequence.

This script was written to work for people that have a number of different networks that they need to setup.

Regards,

Frank

Offline wbuehler

  • Administrator
  • Sr. Member
  • *****
  • Posts: 3579
  • Dont' that poster look dusty?
Yes that was it, I changed the script to use network 0 and that fixed the problem.
I was trying the script to see if the modified script would fix any other issue I have been having with the playlists.

Thanks for looking into this.

Bill


Offline Mickpat

  • Beta Tester
  • Sr. Member
  • *****
  • Posts: 556
You are not allowed to view links. Register or Login
A big thanks goes out to Frank - he was able to help with some adjustments to the script and with a few additions to the script myself I was able to get it all working.  The upside is that now I know the interworkings of the LOR file format!

Onward with xLights!

Can you share your script file?  I want to try the same with 14 universes using E1.31.  Thanks.

Offline frankr

  • Sr. Member
  • ****
  • Posts: 347
    • Rocklin Lights
Hi Mick,

have you looked at the script posted in this thread? You should be able to use this for your e.131 setup.  You will have to determine the start and end saved index fro each of the 14 universes but the script can be easily modified to handle however many networks you need. 

See the syntax I posted in the OP.  It specifies 4 networks but it can be easily extended.  I would expect that for 14 e.131 universes that it would look something like:

networks = [{'stIndex':0,'endIndex':511, 'net':0},
                {'stIndex':512,'endIndex':1023, 'net':1},
                {'stIndex':1024,'endIndex':1535, 'net':2}
                 ...
                {'stIndex':6656,'endIndex':7167, 'net':13}]

(Note that this is assuming that your channels are in this order in your original LSP file so that they export this way.  You MUST verify how the lms export looks to make sure this will get you what you need.)

Best of luck!!!

Frank

Offline Mickpat

  • Beta Tester
  • Sr. Member
  • *****
  • Posts: 556
Thanks Frank. 

In LSP I have the following controllers.

PixelNet RGB = DMX channels 1 - 3960
LOR Controllers 1 - 5 in DMX mode = DMX channels 4097 - 4176
PixelNet Arches RGB = DMX channels 6000 - 6300

I exported to LOR, but not sure about the number or how to ensure the channels are in order.  See attch.  Since I have gaps, not sure the ordering will be right.  Will this work or would I need to do some manual editing or tweak the script?  Thanks. 
 

Offline Steve Gase

  • Sr. Member
  • ****
  • Posts: 2915
    • WinterLightShow in Georgetown, TX
You are not allowed to view links. Register or Login
networks = [{'stIndex':0,'endIndex':511, 'net':0},
                {'stIndex':512,'endIndex':1023, 'net':1},
                {'stIndex':1024,'endIndex':1535, 'net':2}
                 ...
                {'stIndex':6656,'endIndex':7167, 'net':13}]

Based on my experience, where my DMX or pixelnet channels are not contiguous, I think this definition will have problems.
The endIndex is based on the position of the channel definitions in the lms file.  So, if you have not defined all of the channels in LSP then the items on the second dongle would be assigned to the first dongle.

Maybe my notes in You are not allowed to view links. Register or Login will help.


A suggestion:  maybe the circuit number should be used instead as a hint.  Whenever a circuit number goes backward from the last, then increment the network number, but that is complicated too -- as evidenced by the example in my thread where my star in hub 1 appears after my 3 sections of tree on hubs 1-3.

Steve
You are not allowed to view links. Register or Login  |  110K channels, 50K lights  |  Nutcracker, Falcon, DLA, HolidayCoro

Offline frankr

  • Sr. Member
  • ****
  • Posts: 347
    • Rocklin Lights
Hi Steve,

yes it is complicated to say the least.  The cheat that I use is that all my channels are ordered in LSP by the network they are on so when the conversion is done is is in a nice sequential order.  the other thing to note is that the script does not care if you define the same network for multiple ranges of savedIndexes.  So if your star is on net2 and int the middle of a bunch of net 3 items you can have an entry in that list for assigning those savedIndexes to net2 and another range to assigne the other saved Indexes to net 2.

A couple of people have had sequences where they had linearly increasing circuit numbers so I have modified the script for them to use circuit numbers.

Frank