コード例 #1
0
def make_director_list(table):
    # Generates a list of Director objects using data from table which should
    # be a list of lists in the following format:
    #   [[name, month_of_birth, day_of_birth, year_of_birth], ...]
    # name is a string but all other fields are integers.
    directors = []
    for row in table:
        directors.append(media.Director(row[0], row[1], row[2], row[3]))
    return directors
コード例 #2
0
ファイル: plexlibrary.py プロジェクト: Zero0Q/plex-for-kodi
    def init(self, data):
        self.items = []

        container = plexobjects.PlexContainer(data, self.key, self.server,
                                              self.key or '')

        if self.type == 'genre':
            self.items = [
                media.Genre(elem,
                            initpath='/hubs',
                            server=self.server,
                            container=container) for elem in data
            ]
        elif self.type == 'director':
            self.items = [
                media.Director(elem,
                               initpath='/hubs',
                               server=self.server,
                               container=container) for elem in data
            ]
        elif self.type == 'actor':
            self.items = [
                media.Role(elem,
                           initpath='/hubs',
                           server=self.server,
                           container=container) for elem in data
            ]
        else:
            for elem in data:
                try:
                    self.items.append(
                        plexobjects.buildItem(self.server,
                                              elem,
                                              '/hubs',
                                              container=container,
                                              tag_fallback=True))
                except exceptions.UnknownType:
                    util.DEBUG_LOG('Unkown hub item type({1}): {0}'.format(
                        elem, elem.attrib.get('type')))