Setting License Info

This topic describes how to use an AVBlocks license file.

AVBlocks License File

The AVBlocks license file is sent to you via email when you purchase a license. The license file is an XML document that looks similar to this one:

<!-- 
This file contains PrimoSoftware license(s). 
Line breaks and indentation between elements can be edited, 
but any other reformatting may invalidate the license(s). 
-->
<primoSoftware>
  <license version='1.0'>
    <token>abcdefghijklmnlo</token>
    <revision>1</revision>
    <issueDate>2013-05-29</issueDate>
    <expireDate>2015-05-30</expireDate>
    <updateTime>2014-11-02 22:59:08</updateTime>
    <item id='avb-win'>
      <product>avb</product>
    </item>
    <item id='avb-mac'>
      <product>avb</product>
    </item>
    <item id='avb-linux'>
      <product>avb</product>
    </item>
    <item id='avb-linux-debian'>
      <product>avb</product>
    </item>
    <signature>very_very_long_signature_string_here</signature>
  </license>
</primoSoftware>

You have to pass the XML as a string to Library.set_license.

Example

In Python, it is convenient to use a triple-quoted string literal for the license XML:

from avblocks import Library, LicenseStatusFlags

# Primo Software License in XML format.
# You will have this after obtaining a commercial license
LICENSE_XML = """
<!--
This file contains PrimoSoftware license(s).
Line breaks and indentation between elements can be edited,
but any other reformatting may invalidate the license(s).
-->
<primoSoftware>
  <license version='1.0'>
    <token>abcdefghijklmnlo</token>
    <revision>1</revision>
    <issueDate>2013-05-29</issueDate>
    <expireDate>2015-05-30</expireDate>
    <updateTime>2014-11-02 22:59:08</updateTime>
    <item id='avb-win'>
      <product>avb</product>
    </item>
    <item id='avb-mac'>
      <product>avb</product>
    </item>
    <item id='avb-linux'>
      <product>avb</product>
    </item>
    <item id='avb-linux-debian'>
      <product>avb</product>
    </item>
    <signature>very_very_long_signature_string_here</signature>
  </license>
</primoSoftware>
"""


def main():
    Library.initialize()

    # Optionally enable TLS for license verification.
    # This must be done before calling Library.set_license
    Library.set_license_tls(True)

    # Pass the license XML as string to Library.set_license
    # NOTE: If the license expireDate is in the past,
    # this will trigger a license verification call
    # to Primo Software over the Internet.
    Library.set_license(LICENSE_XML)

    assert Library.license_status() == LicenseStatusFlags.Ready

    Library.shutdown()


if __name__ == '__main__':
    main()