Coder Social home page Coder Social logo

Comments (1)

davemevans avatar davemevans commented on September 24, 2024

In case it helps anyone, I solved it as follows in the application code. Note this only considers the BinaryType child type ie urn:scte:scte35:2014:xml+bin for Signal, not SpliceInfoSectionType as we had no need for that.

def __init__(self):
    self.signals = None                                   # Signal
    self.message_data = None                              # xs:string
    self.presentation_time = None                         # xs:unsignedLong
    self.duration = None                                  # xs:unsignedLong
    self.id = None                                        # xs:unsignedInt

def parse(self, xmlnode):
    self.signals = parse_child_nodes(xmlnode, 'Signal', Signal)
    self.message_data = parse_attr_value(xmlnode, 'messageData', str)
    self.presentation_time = parse_attr_value(xmlnode, 'presentationTime', int)
    self.duration = parse_attr_value(xmlnode, 'duration', int)
    self.id = parse_attr_value(xmlnode, 'id', int)

def write(self, xmlnode):
    write_child_node(xmlnode, 'Signal', self.signals)
    write_attr_value(xmlnode, 'messageData', self.message_data)
    write_attr_value(xmlnode, 'presentationTime', self.presentation_time)
    write_attr_value(xmlnode, 'duration', self.duration)
    write_attr_value(xmlnode, 'id', self.id)

class Binary:
    def __init__(self):
        self.binary_value = None
        self.signal_type = None

    def parse(self, xmlnode):
        self.binary_value = parse_node_value(xmlnode, str)
        self.signal_type = parse_attr_value(xmlnode, "signalType", str)

    def write(self, xmlnode):
        write_node_value(xmlnode, self.binary_value)
        write_attr_value(xmlnode, 'signalType', self.signal_type)

class Signal:
    def __init__(self):
        self.xmlns = None
        self.binarys = None

    def parse(self, xmlnode):
        self.xmlns = parse_attr_value(xmlnode, 'xmlns', str)
        self.binarys = parse_child_nodes(xmlnode, 'Binary', XsStringElement)

    def write(self, xmlnode):
        write_attr_value(xmlnode, 'xmlns', self.xmlns)
        write_child_node(xmlnode, 'Binary', self.binarys)

Event.__init__ == __init__
Event.parse = parse
Event.write = write

from python-mpegdash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.