Esempio n. 1
0
def PlayerVocabularyFactory(context):
    players=[]
    if IKalturaVideo.providedBy(context):
        players = kGetVideoPlayers()
    elif IKalturaPlaylist.providedBy(context):
        players = kGetPlaylistPlayers()
        
    items = []
    for player in players:
        #simpleVocabulary doesn't like unicode!
        name = player.getName()
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        items.append( (name, str(player.getId())) )
        
    return SimpleVocabulary.fromItems(items)
Esempio n. 2
0
def PlayerVocabularyFactory(context):
    players = []
    if IKalturaVideo.providedBy(context):
        players = kGetVideoPlayers()
    elif IKalturaPlaylist.providedBy(context):
        players = kGetPlaylistPlayers()

    items = []
    for player in players:
        #simpleVocabulary doesn't like unicode!
        name = player.getName()
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        items.append((name, str(player.getId())))

    return SimpleVocabulary.fromItems(items)
Esempio n. 3
0
    def video(self):
        """return a single kalturaVideo as a Video within the cp_container body slot"""
        #Videos are embedded via the Layout Tab, so we must journey into cp_container to find it.
        cp = getattr(self.obj, 'cp_container', None)
        if cp is None:
            return None

        if self._video is not None:
            return self._video

        slot = cp.filled_slots['body']
        for elem in slot.values():
            obj = elem.getTarget()
            if IKalturaVideo.providedBy(obj): #XXX use IVideo when it appears - IKalturaVideo should inherit from it.
                #be lazy.  The first Video you find is all you get!
                self._video = Video(obj)
                return self._video

        return self._video
Esempio n. 4
0
    def video(self):
        """return a single kalturaVideo as a Video within the cp_container body slot"""
        #Videos are embedded via the Layout Tab, so we must journey into cp_container to find it.
        cp = getattr(self.obj, 'cp_container', None)
        if cp is None:
            return None

        if self._video is not None:
            return self._video

        slot = cp.filled_slots['body']
        for elem in slot.values():
            obj = elem.getTarget()
            if IKalturaVideo.providedBy(
                    obj
            ):  #XXX use IVideo when it appears - IKalturaVideo should inherit from it.
                #be lazy.  The first Video you find is all you get!
                self._video = Video(obj)
                return self._video

        return self._video