Class e.p.d.d.DaapParser(object):

Part of elisa.plugins.daap.daap_parser View In Hierarchy

A DaapParser provides different ways to parse the response you get on daap request.
Line # Kind Name Docs
57 Method __init__ Undocumented
65 Method parse_chunk unpack one chunk of data and decode the value, if it is not a container.
89 Method simple_parse Parse the full data simple into a dictionary with key:value. This is
108 Method parse_mdcl parse *one* mdcl entry and return the three values (decoded)
125 Method parse_to_model Undocumented
130 Method _parse_to_model Parse the given chunk of data into the given model by using the
208 Method _decode Undocumented
def __init__(self):
Undocumented
def parse_chunk(self, data):
unpack one chunk of data and decode the value, if it is not a container.
Parametersdatathe data to read (type: str )
Returnsthe code_name, the (decoded) value and the rest of the data (type: tuple containing 3 strings )
RaisesNotEnoughDataif the size for value is longer than the rest of the data that is left
def simple_parse(self, data):
Parse the full data simple into a dictionary with key:value. This is usefull for simple answers (as the login or the server info).
Parametersdatathe full data to read (type: str )
Returnscode mapped to the value (type: dict )
def parse_mdcl(self, data):
parse *one* mdcl entry and return the three values (decoded)
Returnsmcna, mcnm, mcty (type: tuple )
def parse_to_model(self, data, model):
Undocumented
def _parse_to_model(self, data, model, dfr=None):
Parse the given chunk of data into the given model by using the models.mappings, model.container and model.container_items.

This is a very complex method you could use to parse any given chunk of data you get over a http request to the given model. It is also able to find listitems and parse the values. It then wraps the values into a new created model.container_items Model by calling the same method with the value and the model again. After wards it appends it to the list specified in model.container.

Parametersdatathe chunk of data to parse into the model (type: str )
modelThe Model to parse it into (type: elisa.plugins.daap.models.DaapModel )
Returnsthe tail of the data it was not able to parse in case it's missing some data to be able to unpack it. You should keep this data and reuse it for a new request, when you have more data. (type: str )
RaisesNotImplementedErrorwhen a container is found but the given model doesn't support containers.
def _decode(self, code, data):
Undocumented
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.