def browse(self, object_id, browse_flag, filter, starting_index,
               requested_count, sort_criteria="dc:title"):
        """ Browses media servers.

        @param object_id: object id
        @param browse_flag: BrowseDirectChildren or BrowseMetadata
        @param filter: a filter to indicate which metadata properties
                       are to be returned. Usually "*".
        @param starting_index: starting index to consider the requested count
        @param requested_count: requested number of entries
        @param sort_criteria: sorting criteria

        @type object_id: string
        @type browse_flag: string
        @type filter: string
        @type starting_index: int
        @type requested_count: int
        @type sort_criteria: string

        @return: a list of containers and items
        @rtype: list
        """
        service = self.get_cd_service()
        browse_response = service.Browse(ObjectID=str(object_id),
                                         BrowseFlag=browse_flag,
                                         Filter=filter,
                                         StartingIndex=starting_index,
                                         RequestedCount=requested_count,
                                         SortCriteria=sort_criteria)
        elt = Element.from_string(browse_response['Result'])
        browse_response['Result'] = elt.get_items()
        return browse_response
Exemple #2
0
    def browse(self,
               object_id,
               browse_flag,
               filter,
               starting_index,
               requested_count,
               sort_criteria="dc:title"):
        """ Browses media servers.

        @param object_id: object id
        @param browse_flag: BrowseDirectChildren or BrowseMetadata
        @param filter: a filter to indicate which metadata properties
                       are to be returned. Usually "*".
        @param starting_index: starting index to consider the requested count
        @param requested_count: requested number of entries
        @param sort_criteria: sorting criteria

        @type object_id: string
        @type browse_flag: string
        @type filter: string
        @type starting_index: int
        @type requested_count: int
        @type sort_criteria: string

        @return: a list of containers and items, or a fault
        @rtype: list
        """
        service = self.get_cd_service()
        browse_response = service.Browse(ObjectID=str(object_id),
                                         BrowseFlag=browse_flag,
                                         Filter=filter,
                                         StartingIndex=starting_index,
                                         RequestedCount=requested_count,
                                         SortCriteria=sort_criteria)

        if 'Result' in browse_response:
            elt = Element.from_string(browse_response['Result'])
            browse_response['Result'] = elt.get_items()
        return browse_response
    def search(self, container_id, search_criteria, filter, starting_index,
               requested_count, sort_criteria):
        """ Search items in Media Server.

        This method search items with search_criteria key in the container_id
        of current media server.

        @param container_id: unique identifier of the container in which
                             to begin searching.
        @param search_criteria: search criteria
        @param filter: a filter to indicate which metadata properties
                       are to be returned.
        @param starting_index: starting index to consider the requested
                               count
        @param requested_count: requested number of entries under the
                                object specified by container_id
        @param sort_criteria: sorting criteria

        @type container_id: string
        @type search_criteria: string
        @type filter: string
        @type starting_index: int
        @type requested_count: int
        @type sort_criteria: string

        @return: search result
        @rtype: dict
        """
        service = self.get_cd_service()
        search_response = service.Search(ContainerID=container_id,
                                         SearchCriteria=search_criteria,
                                         Filter=filter,
                                         StartingIndex=starting_index,
                                         RequestedCount=requested_count,
                                         SortCriteria=sort_criteria)
        elt = Element.from_string(search_response['Result'])
        return elt.get_items()
    def search(self, container_id, search_criteria, filter, starting_index,
               requested_count, sort_criteria):
        """ Search items in Media Server.

        This method search items with search_criteria key in the container_id
        of current media server.

        @param container_id: unique identifier of the container in which
                             to begin searching.
        @param search_criteria: search criteria
        @param filter: a filter to indicate which metadata properties
                       are to be returned.
        @param starting_index: starting index to consider the requested
                               count
        @param requested_count: requested number of entries under the
                                object specified by container_id
        @param sort_criteria: sorting criteria

        @type container_id: string
        @type search_criteria: string
        @type filter: string
        @type starting_index: int
        @type requested_count: int
        @type sort_criteria: string

        @return: search result
        @rtype: dict
        """
        service = self.get_cd_service()
        search_response = service.Search(ContainerID=container_id,
                                         SearchCriteria=search_criteria,
                                         Filter=filter,
                                         StartingIndex=starting_index,
                                         RequestedCount=requested_count,
                                         SortCriteria=sort_criteria)
        elt = Element.from_string(search_response['Result'])
        return elt.get_items()