def test_createSpreaderNode(self):
     fileSinkFactory = self.test_createFileSinkFactory()
     sourceControl = captureManager.createSourceControl()
     XMLstring = sourceControl.getCollectionOfSources()
     selfSources = ElementTree.fromstring(XMLstring)
     sources = ElementPath.findall(selfSources, "Source")
     symboliclink = ''
     for source in sources:
         state = False
         for attributes in ElementPath.findall(source, "Source.Attributes"):
             for attribute in ElementPath.findall(attributes, "Attribute"):
                 if (attribute.get(
                         'Name'
                 ) == 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK'
                     ):
                     symboliclink = attribute.find('SingleValue').get(
                         'Value')
     outputMediaType = sourceControl.getSourceOutputMediaType(
         symboliclink, 0, 0)
     aArrayPtrCompressedMediaTypes = []
     aArrayPtrCompressedMediaTypes.append(outputMediaType)
     aArrayPtrCompressedMediaTypes.append(outputMediaType)
     outputNodes = fileSinkFactory.createOutputNodes(
         aArrayPtrCompressedMediaTypes, 'test.asf')
     spreaderNodeFactory = self.test_createSpreaderNodeFactory()
     spreadNode = spreaderNodeFactory.createSpreaderNode(outputNodes)
    def test_createSourceNodeFromExternalSourceWithDownStreamConnection(self):
        sourceControl = captureManager.createSourceControl()
        mediaSource = self.test_createSource()

        sinkControl = captureManager.createSinkControl()
        XMLstring = sinkControl.getCollectionOfSinks()
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        fileSinkFactoreGUID = ''
        asfContainerGUID = ''
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{D6E342E3-7DDD-4858-AB91-4253643864C2}'):
                fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}'
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    if (valuePart.get('GUID') ==
                            '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'):
                        asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'
        fileSinkFactory = SinkFactories.FileSinkFactory(
            sinkControl.createSinkFactory(asfContainerGUID,
                                          fileSinkFactoreGUID))

        indexOfStream = 0
        indexOfMediaType = 2

        outputMediaType = sourceControl.getSourceOutputMediaTypeFromMediaSource(
            mediaSource, indexOfStream, indexOfMediaType)
        aArrayPtrCompressedMediaTypes = []
        aArrayPtrCompressedMediaTypes.append(outputMediaType)
        outputNodes = fileSinkFactory.createOutputNodes(
            aArrayPtrCompressedMediaTypes, 'test.asf')

        sourceNode = sourceControl.createSourceNodeFromExternalSourceWithDownStreamConnection(
            mediaSource, indexOfStream, indexOfMediaType, outputNodes[0])
    def startCaptureSession(self):
        XMLstring = self.sinkControl.getCollectionOfSinks()
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        EVRSinkFactoreGUID = ''
        defaultContainerGUID = ''
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'):
                EVRSinkFactoreGUID = '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    if (valuePart.get('GUID') ==
                            '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'):
                        defaultContainerGUID = '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'

        EVRSinkFactory = SinkFactories.EVRSinkFactory(
            self.sinkControl.createSinkFactory(defaultContainerGUID,
                                               EVRSinkFactoreGUID))

        indexOfStream = 0
        indexOfMediaType = int(self.prevSelectedMediaTypeIndex)
        outputNode = EVRSinkFactory.createOutputNode(self.frame.winfo_id())

        sourceNode = self.sourceControl.createSourceNodeWithDownStreamConnection(
            self.symbolicLink, indexOfStream, indexOfMediaType, outputNode)

        sources = []
        sources.append(sourceNode)
        self.session = self.sessionControl.createSession(sources)

        self.session.startSession(0, '{00000000-0000-0000-0000-000000000000}')
        self.controlBtnbox.subwidget('start').config(state='disabled')
        self.controlBtnbox.subwidget('stop').config(state='normal')
        self.controlBtnbox.subwidget('options').config(state='normal')
示例#4
0
文件: jaspy.py 项目: simpoir/jaspy
def pull_folder(path, typ='folder'):
    response = soap('list', requestXml='''
<request operationName="list" locale="en">
<resourceDescriptor name="" wsType="%(typ)s" uriString="%(path)s" isNew="false">
<label>null</label>
</resourceDescriptor>
</request>'''%dict(typ=typ, path=path))
    response = ET.fromstring(response.data.encode('utf-8'))
    res_list = EP.findall(response, 'resourceDescriptor')

    git_tree = []
    for res in res_list:
        res_type = res.attrib['wsType']
        res_uri = res.attrib['uriString']
        res_name = res_uri.rpartition('/')[2]
        if res_type == 'folder':
            blob = pull_folder(res_uri)
            if blob:
                git_tree.append('040000 tree %s\t%s'%(blob, res_name))
        else: #res_type in ('jdbc', 'img', 'reportUnit', 'dataType', 'inputControl'):
            blob = pull_resource(res_uri, res_type)
            git_tree.append('040000 tree %s\t%s'%(blob, res_name))
            print res_uri


    if git_tree:
        git_tree = '\n'.join(git_tree)
        git = Popen(['git', 'mktree'], stdin=PIPE, stdout=PIPE)
        new_blob = git.communicate(git_tree)[0].strip()

        return new_blob
    return
    def selectSource(self, event):
        selectedSourceIndex = self.sourceComboBox.subwidget_list[
            'slistbox'].subwidget_list['listbox'].curselection()
        if (self.prevSelectedSourceIndex != selectedSourceIndex[0]):
            self.prevSelectedSourceIndex = selectedSourceIndex[0]
            source = self.sourcesList[int(selectedSourceIndex[0])]
            for attributes in ElementPath.findall(source, "Source.Attributes"):
                for attribute in ElementPath.findall(attributes, "Attribute"):
                    if (attribute.get(
                            'Name'
                    ) == 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK'
                        ):
                        self.symbolicLink = attribute.find('SingleValue').get(
                            'Value')

            self.populateMediaTypeComboBox(int(selectedSourceIndex[0]))
 def populateEncoderComboBox(self, selectedSourceIndex):
     if self.encoderComboBox.size() > 0:
         self.encoderComboBox.slistbox.listbox.delete(0, Tix.END)
     self.encoderCLSIDList = []
     self.encoderComboBox.config(state='normal')
     encodersXML = ElementTree.fromstring(
         self.encoderControl.getCollectionOfEncoders())
     groups = ElementPath.findall(encodersXML, "Group")
     for group in groups:
         if (group.get('GUID') == self.streamdescriptor.get('MajorTypeGUID')
             ):
             for encoderFactory in ElementPath.findall(
                     group, "EncoderFactory"):
                 self.encoderComboBox.insert(Tix.END,
                                             encoderFactory.get('Name'))
                 self.encoderCLSIDList.append(encoderFactory.get('CLSID'))
示例#7
0
文件: nexus.py 项目: yasn77/pupsus
 def search(self, **kwargs):
     k = (
          'groupId',
          'artifactId',
          'version',
          'extension',
          'sha1',
          'repositoryPath'
          )
     doc = dict()
     req_url = self.__buildURI(mountpoint='/service/local/artifact/maven/resolve', **kwargs)
     req = self.reqS.get(req_url)
     if req.status_code == 200:
         data = req.text
     else:
         return doc
     try:
         xml = ElementTree.XML(data)
         d = ElementPath.findall(xml, './/data')[0]
         for i in k:
             doc[i] = d.find(i).text
         doc['repository'] = kwargs['repository']
     except:
         pass
     return doc
    def test_createSourceNodeWithDownStreamConnection(self):
        sourceControl = captureManager.createSourceControl()
        XMLstring = sourceControl.getCollectionOfSources()
        selfSources = ElementTree.fromstring(XMLstring)
        sources = ElementPath.findall(selfSources, "Source")
        symboliclink = ''
        for source in sources:
            state = False
            for attributes in ElementPath.findall(source, "Source.Attributes"):
                for attribute in ElementPath.findall(attributes, "Attribute"):
                    if (attribute.get(
                            'Name'
                    ) == 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK'
                        ):
                        symboliclink = attribute.find('SingleValue').get(
                            'Value')
        sinkControl = captureManager.createSinkControl()
        XMLstring = sinkControl.getCollectionOfSinks()
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        fileSinkFactoreGUID = ''
        asfContainerGUID = ''
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{D6E342E3-7DDD-4858-AB91-4253643864C2}'):
                fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}'
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    if (valuePart.get('GUID') ==
                            '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'):
                        asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'
        fileSinkFactory = SinkFactories.FileSinkFactory(
            sinkControl.createSinkFactory(asfContainerGUID,
                                          fileSinkFactoreGUID))

        indexOfStream = 0
        indexOfMediaType = 2

        outputMediaType = sourceControl.getSourceOutputMediaType(
            symboliclink, indexOfStream, indexOfMediaType)
        aArrayPtrCompressedMediaTypes = []
        aArrayPtrCompressedMediaTypes.append(outputMediaType)
        outputNodes = fileSinkFactory.createOutputNodes(
            aArrayPtrCompressedMediaTypes, 'test.asf')

        sourceNode = sourceControl.createSourceNodeWithDownStreamConnection(
            symboliclink, indexOfStream, indexOfMediaType, outputNodes[0])
 def test_createSourceNode(self):
     sourceControl = captureManager.createSourceControl()
     XMLstring = sourceControl.getCollectionOfSources()
     selfSources = ElementTree.fromstring(XMLstring)
     sources = ElementPath.findall(selfSources, "Source")
     symboliclink = ''
     for source in sources:
         state = False
         for attributes in ElementPath.findall(source, "Source.Attributes"):
             for attribute in ElementPath.findall(attributes, "Attribute"):
                 if (attribute.get(
                         'Name'
                 ) == 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK'
                     ):
                     symboliclink = attribute.find('SingleValue').get(
                         'Value')
     sourceNode = sourceControl.createSourceNode(symboliclink, 0, 0)
示例#10
0
 def __iter__(self):
     try:
         # same hack as above
         for child in ElementPath.findall(self._parent.getchildren(),
                                          self.tag):
             yield child
     except AttributeError:
         # this is the root element
         yield self
示例#11
0
 def __iter__(self):
     try:
         # same hack as above
         for child in ElementPath.findall(self._parent.getchildren(),
                                          self.tag):
             yield child
     except AttributeError:
         # this is the root element
         yield self
示例#12
0
 def __init__(self, widget, webCamControl):
     self.widget = widget
     self.webCamControl = webCamControl
     self.mainFrame = Tix.Frame(widget, bd=1, relief=Tix.RAISED)
     widget.wm_minsize(600, 400)
     camParametrs = self.webCamControl.getCamParametrs()
     parametrs = ElementTree.fromstring(camParametrs)
     groups = ElementPath.findall(parametrs, "Group")
     for group in groups:
         self.fillGroup(group)
 def test_createFileSinkFactory(self):
     sinkControl = captureManager.createSinkControl()
     XMLstring = sinkControl.getCollectionOfSinks()
     root = ElementTree.fromstring(XMLstring)
     sinkFactories = ElementPath.findall(root, "SinkFactory")
     fileSinkFactoreGUID = ''
     asfContainerGUID = ''
     for sinkFactory in sinkFactories:
         if (sinkFactory.get('GUID') ==
                 '{D6E342E3-7DDD-4858-AB91-4253643864C2}'):
             fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}'
             for valuePart in ElementPath.findall(
                     sinkFactory, 'Value.ValueParts/ValuePart'):
                 if (valuePart.get('GUID') ==
                         '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'):
                     asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'
     fileSinkFactory = SinkFactories.FileSinkFactory(
         sinkControl.createSinkFactory(asfContainerGUID,
                                       fileSinkFactoreGUID))
     return fileSinkFactory
示例#14
0
    def fillGroup(self, group):
        title = group.get('Title')
        labelframe = Tkinter.LabelFrame(self.widget, text=title)
        labelframe.pack(fill="both", expand="yes")
        parametrs = ElementPath.findall(group, "Parametr")

        index = 0
        for parametr in parametrs:
            WebCamProperty(labelframe, parametr, self.webCamControl, index / 5,
                           index % 5)
            index = index + 1
    def test_createSampleGrabberCallSinkFactory(self):
        sinkControl = captureManager.createSinkControl()
        XMLstring = sinkControl.getCollectionOfSinks()
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        SampleGrabberCallSinkFactoryGUID = ''
        defaultContainerGUID = ''
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{759D24FF-C5D6-4B65-8DDF-8A2B2BECDE39}'):
                SampleGrabberCallSinkFactoryGUID = '{759D24FF-C5D6-4B65-8DDF-8A2B2BECDE39}'
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    if (valuePart.get('GUID') ==
                            '{C1864678-66C7-48EA-8ED4-48EF37054990}'):
                        defaultContainerGUID = '{C1864678-66C7-48EA-8ED4-48EF37054990}'

        SampleGrabberCallSinkFactory = SinkFactories.SampleGrabberCallSinkFactory(
            sinkControl.createSinkFactory(defaultContainerGUID,
                                          SampleGrabberCallSinkFactoryGUID))
        return SampleGrabberCallSinkFactory
    def populateOutputContainerTypeComboBox(self):
        if self.outputContainerTypeComboBox.size() > 0:
            self.outputContainerTypeComboBox.slistbox.listbox.delete(
                0, Tix.END)

        self.outputContainerTypeComboBox.config(state='normal')
        self.outputContainerTypeGUIDList = []
        self.outputContainerTypeList = []
        XMLstring = self.sinkControl.getCollectionOfSinks()
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{D6E342E3-7DDD-4858-AB91-4253643864C2}'):
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    self.outputContainerTypeComboBox.insert(
                        Tix.END, valuePart.get('Value'))
                    self.outputContainerTypeGUIDList.append(
                        valuePart.get('GUID'))
                    self.outputContainerTypeList.append(valuePart.get('Value'))
    def test_createEVRSinkFactory(self):
        sinkControl = captureManager.createSinkControl()
        XMLstring = sinkControl.getCollectionOfSinks()
        #print XMLstring
        root = ElementTree.fromstring(XMLstring)
        sinkFactories = ElementPath.findall(root, "SinkFactory")
        EVRSinkFactoreGUID = ''
        defaultContainerGUID = ''
        for sinkFactory in sinkFactories:
            if (sinkFactory.get('GUID') ==
                    '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'):
                EVRSinkFactoreGUID = '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'
                for valuePart in ElementPath.findall(
                        sinkFactory, 'Value.ValueParts/ValuePart'):
                    if (valuePart.get('GUID') ==
                            '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'):
                        defaultContainerGUID = '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'

        EVRSinkFactory = SinkFactories.EVRSinkFactory(
            sinkControl.createSinkFactory(defaultContainerGUID,
                                          EVRSinkFactoreGUID))
        return EVRSinkFactory
示例#18
0
    def downloadArtifact(self):
        url = self.get_artifact_url()
        data = urllib2.urlopen(url).read()
        doc = ElementTree.XML(data)
        elements = ElementPath.findall(doc, ".//artifact")
        artifacts = []
        
        #create a list of artifacts
        for x in elements:
            artifacts.append((x.find("resourceURI").text,
                              x.find("groupId").text, 
                              x.find("artifactId").text, 
                              x.find("version").text, 
                              x.find("packaging").text,
                              x.find("extension").text,
                              x.find("repoId").text, 
                              x.find("contextId").text, 
                              x.find("pomLink").text, 
                              x.find("artifactLink").text))
            

        #Filter on snapshots or releases
        artifacts = [artifact for artifact in artifacts if artifact[6].lower() == self.repository.lower()]
        #Filter on group
        artifacts = [artifact for artifact in artifacts if artifact[1].lower() == self.group.lower()]
        #Filter on artifact name
        artifacts = [artifact for artifact in artifacts if artifact[2].lower() == self.artifact.lower()]
        #print artifacts
        artifact_name=""
        if artifacts:
            #Get the last artifact in the list
            artifact = artifacts[-1]
            
            artifact_url = artifact[9]
            artifact_name = artifact[0].split('/')[-1]
            dlfile = self.download(artifact_url, artifact_name)
            if "Error Not Found 404" in dlfile:
                print("Downloading from: "+artifact[0])
                #Try the download again using the undirected link
                dlfile = self.download(artifact[0], artifact_name)

            print("Downloaded: "+dlfile)
            file_hashes = self.hashfile(dlfile)
            print("SHA1: "+file_hashes[0])
            print("MD5 : "+file_hashes[1])
            
                    
        print("-"*40)

        return artifact_name 
示例#19
0
文件: nexus.py 项目: yasn77/pupsus
 def getversions(self, **kwargs):
     versions = ()
     kwargs['version'] = 'any'
     req_url = self.__buildURI(mountpoint='/service/local/lucene/search', **kwargs)
     with requests_cache.disabled():
         req = self.reqS.get(req_url)
     if req.status_code == 200:
         data = req.text
     else:
         return versions
     try:
         xml = ElementTree.XML(data)
         for item in ElementPath.findall(xml, './/artifact'):
             if item.find('artifactId').text == kwargs['artifact_id']:
                 versions = versions + (item.find('version').text,)
     except:
         pass
     return versions
    def populateEncoderModeComboBox(self, encoderCLSID):
        if self.encoderModeComboBox.size() > 0:
            self.encoderModeComboBox.slistbox.listbox.delete(0, Tix.END)

        self.encoderModeComboBox.config(state='normal')
        self.encoderModelist = []
        self.encoderModeGUIDlist = []
        selectedMediaTypeIndex = self.mediaTypeComboBox.subwidget_list[
            'slistbox'].subwidget_list['listbox'].curselection()
        outputMediaType = self.sourceControl.getSourceOutputMediaType(
            self.symbolicLink, 0, int(selectedMediaTypeIndex[0]))

        encoderOutputMedaiTypesXml = ElementTree.fromstring(
            self.encoderControl.getMediaTypeCollectionOfEncoder(
                outputMediaType, encoderCLSID))
        groups = ElementPath.findall(encoderOutputMedaiTypesXml, "Group")
        for group in groups:
            self.encoderModeComboBox.insert(Tix.END, group.get('Title'))
            self.encoderModelist.append(group)
            self.encoderModeGUIDlist.append(group.get('GUID'))
    def __init__(self, widget, captureManager):
        self.captureManager = captureManager
        self.sourcesList = []
        self.prevSelectedSourceIndex = -1
        self.prevSelectedMediaTypeIndex = -1
        self.sourceComboBox = Tix.ComboBox(widget,
                                           label="Source: ",
                                           command=self.selectSource)
        self.sourceComboBox.pack(side=Tix.TOP, fill=Tix.X)
        self.sourceControl = self.captureManager.createSourceControl()
        self.sinkControl = self.captureManager.createSinkControl()
        self.sessionControl = self.captureManager.createSessionControl()
        self.session = -1
        xmlstring = self.sourceControl.getCollectionOfSources()
        selfSources = ElementTree.fromstring(xmlstring)
        self.sources = ElementPath.findall(selfSources, "Source")
        for source in self.sources:
            friendlyname = ''
            state = False
            for attributes in ElementPath.findall(source, "Source.Attributes"):
                for attribute in ElementPath.findall(attributes, "Attribute"):
                    if (attribute.get('Name') ==
                            'MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME'):
                        friendlyname = attribute.find('SingleValue').get(
                            'Value')
                    if (attribute.get('Name') ==
                            'MF_DEVSOURCE_ATTRIBUTE_MEDIA_TYPE'):
                        parts = attribute.find('Value.ValueParts').findall(
                            "ValuePart")
                        for part in parts:
                            if (part.get('Value') == 'MFMediaType_Video'):
                                state = True

            if (state):
                self.sourceComboBox.insert(Tix.END, friendlyname)
                self.sourcesList.append(source)
        self.mediaTypeComboBox = Tix.ComboBox(widget,
                                              label="MediaTypes: ",
                                              state='disabled',
                                              command=self.selectMediaType)
        self.mediaTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
        self.controlBtnbox = Tix.ButtonBox(widget, orientation=Tix.HORIZONTAL)
        self.startBtn = self.controlBtnbox.add(
            'start',
            text='Start',
            underline=0,
            width=6,
            state='disabled',
            command=lambda widget=widget: self.startCaptureSession())
        self.optionsBtn = self.controlBtnbox.add(
            'options',
            text='Options',
            underline=0,
            width=6,
            state='disabled',
            command=lambda widget=widget: self.options())
        self.stopBtn = self.controlBtnbox.add(
            'stop',
            text='Stop',
            underline=0,
            width=6,
            state='disabled',
            command=lambda widget=widget: self.stopCaptureSession())
        self.controlBtnbox.pack(side=Tix.TOP, fill=Tix.X)

        self.frame = Tkinter.Frame(widget, relief=RIDGE, borderwidth=2)
        self.frame.pack(fill=BOTH, expand=1)
 def __init__(self, widget, captureManager):
     self.captureManager = captureManager
     self.sourcesList = []
     self.prevSelectedSourceIndex = -1
     self.prevSelectedMediaTypeIndex = -1
     self.prevSelectedEncoderIndex = -1
     self.streamdescriptor = -1
     self.prevSelectedEncoderModeIndex = -1
     self.prevSelectedOutputContainerTypeIndex = -1
     self.sourceComboBox = Tix.ComboBox(widget,
                                        label="Source: ",
                                        command=self.selectSource)
     self.sourceComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.sourceControl = self.captureManager.createSourceControl()
     self.sinkControl = self.captureManager.createSinkControl()
     self.encoderControl = self.captureManager.createEncoderControl()
     self.sessionControl = self.captureManager.createSessionControl()
     self.session = None
     self.encoderCLSIDList = []
     self.selectedEncoderCLSID = -1
     selfSources = ElementTree.fromstring(
         self.sourceControl.getCollectionOfSources())
     self.sources = ElementPath.findall(selfSources, "Source")
     for source in self.sources:
         friendlyname = ''
         for attributes in ElementPath.findall(source, "Source.Attributes"):
             for attribute in ElementPath.findall(attributes, "Attribute"):
                 if (attribute.get('Name') ==
                         'MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME'):
                     friendlyname = attribute.find('SingleValue').get(
                         'Value')
         self.sourceComboBox.insert(Tix.END, friendlyname)
         self.sourcesList.append(source)
     self.mediaTypeComboBox = Tix.ComboBox(widget,
                                           label="MediaType: ",
                                           state='disabled',
                                           command=self.selectMediaType)
     self.mediaTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderComboBox = Tix.ComboBox(widget,
                                         label="Encoder: ",
                                         state='disabled',
                                         command=self.selectEncoder)
     self.encoderComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderModeComboBox = Tix.ComboBox(widget,
                                             label="EncoderMode: ",
                                             state='disabled',
                                             command=self.selectEncoderMode)
     self.encoderModeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderOutputMediaTypeComboBox = Tix.ComboBox(
         widget,
         label="EncoderOutputMediaType: ",
         state='disabled',
         command=self.selectEncoderOutputMediaType)
     self.encoderOutputMediaTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.outputSinkTypeComboBox = Tix.ComboBox(
         widget,
         label="OutputSinkType: ",
         state='disabled',
         command=self.selectOutputSinkType)
     self.outputSinkTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.outputContainerTypeComboBox = Tix.ComboBox(
         widget,
         label="OutputContainerType: ",
         state='disabled',
         command=self.selectOutputContainerType)
     self.outputContainerTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.optionsBtn = Tkinter.Button(widget,
                                      text='Options',
                                      state='disabled',
                                      command=self.showOptions)
     self.optionsBtn.pack(side=Tix.TOP, fill=Tix.X)
     self.sessionBtn = Tkinter.Button(widget,
                                      text='Session',
                                      state='disabled',
                                      command=self.initSession)
     self.sessionBtn.pack(side=Tix.TOP, fill=Tix.X)
    else:
        print 'Error status code: ', status
    return tree

try:  
    result = getXml("http://localhost:8080/PracticalCaseWS/WSCatalogRest/listAllCategories");
    exitall = 1
    while exitall>0:
        n=1  
        menu =[]      
        print("");
        print("          P E T S    S H O P");
        print("          Practical Case Study based on Rest Web Service and Python Client");
        print("          You can list all the pets or list them by category.");
        print("");
        for elem in ElementPath.findall(result, ".//category"):
            print "          ",n," - ",elem.find('name').text , " "
            menu.append(elem.find('name').text)
            n +=1
        print("           0 - Exit "); 
        c1 = raw_input("           Choose a number: ")                                            
        try: 
            c = int(c1)
            if c==0:
                exitall = 0
            else:
                if c>0 and c<n:
                    pet = []
                    if menu[c-1].rstrip() =="ALL PETS":
                        doc = getXml("http://localhost:8080/PracticalCaseWS/WSCatalogRest/listAllPets");                                                
                    else: