sciencegey / python_artnet

Easy-to-use python receiver for artnet
MIT License
3 stars 0 forks source link

python_artnet

Easy-to-use and simple python receiver for Art-Net (that also implements device polling).

Installaton

All you need to do is clone the repository

$ git clone https://github.com/sciencegey/python_artnet.git
$ cd python_artnet
$ python3 samples/exampleReceiver.py

OR

Install using PIP

$ pip install python_artnet

Usage

All you need to do to start receiving data is import the module, start the listener, then check for received data whenever you want!

import python_artnet as Artnet

# By default it will listen on 0.0.0.0 (all interfaces)
artNet = Artnet.Artnet()

# Fetch the latest packet we received from universe 0.
artNetPacket = artNet.readBuffer()[0]
# And extract the DMX data from that packet.
dmxPacket = artNetPacket.data
# You'll also want to check that there *is* data in the packet;
# if there isn't then it returns None
# See the example for more information

# Close the listener nicely :)
artNet.close()

There are also plenty of arguments you can pass when you start the listener:

The following are used for purely management purposes: - **SYSIP** - What the IP address of your system is. Purely cosmetic and only used to identify the system to ArtNet controllers. *(Defaults to "10.10.10.1")* - **MAC** - What the MAC address of your system is. Same as above. *(Defaults to ["AA","BB","CC","DD","EE","FF"])* - **SWVER** - What version of Art-Net we're using. In this case, V1.4 *(Defaults to "14")* - **SHORTNAME** and **LONGNAME** - Used to see what devices are what on a controller. *(Shortname is truncated to 17 bytes long, longname is truncated to 63)* - **OEMCODE** - What the Art-Net OEM code your device has. Only needs to be set if you have one. *(In hex)* - **ESTACODE** - What the ESTA Manafacturer Code your device has. Only needs to be set if you have one. *(In hex)* - **PORTTYPE** - Used to tell the controller what type of physical ports your device has. *(Defaults to [0x80,0x00,0x00,0x00])* *See the Art-Net documentation for more information* - **REFRESH** - What the refresh rate (in Hz) of your device. *(Defaults to 44 (the max for DMX))* - **DEBUG** - Used to turn on debug output. *(Defaults to False)*

The artnet packet consists of the following:

The following functions are available to use:

Further information on how it all works can be found in the Art-Net documentation.\ Art-Net™ Designed by and Copyright Artistic Licence Engineering Ltd

License

This project is licensed under an MIT License (see the LICENSE file).