示例#1
0
def getMovieCast(dataF, movieID, indexF, keyF, attrIF, attrKF, offsList=[],
                charNF=None, doCast=0, doWriters=0):
    """Read the specified files and return a list of Person objects,
    one for every people in offsList."""
    resList = []
    _globoff = []
    for offset in offsList:
        # One round for person is enough.
        if offset not in _globoff: _globoff.append(offset)
        else: continue
        personID, movies = getRawData(dataF, offset, doCast, doWriters)
        # Consider only the current movie.
        movielist = [x for x in movies if x.get('movieID') == movieID]
        # XXX: a person can be listed more than one time for a single movie:
        #      think about directors of TV series.
        # XXX: here, 'movie' is a dictionary as returned by the getRawData
        #      function, not a Movie class instance.
        for movie in movielist:
            name = getLabel(personID, indexF, keyF)
            if not name: continue
            curRole = movie.get('currentRole', u'')
            roleID = None
            if curRole and charNF:
                curRole, roleID = getCharactersIDs(curRole, charNF)
            p = Person(name=name, personID=personID,
                        currentRole=curRole, roleID=roleID,
                        accessSystem='local')
            if movie.has_key('attributeID'):
                attr = getLabel(movie['attributeID'], attrIF, attrKF)
                if attr: p.notes = attr
            # Used to sort cast.
            if movie.has_key('position'):
                p.billingPos = movie['position'] or None
            resList.append(p)
    return resList
示例#2
0
def getMovieCast(dataF, movieID, indexF, keyF, attrIF, attrKF, offsList=[],
                charNF=None, doCast=0, doWriters=0):
    """Read the specified files and return a list of Person objects,
    one for every people in offsList."""
    resList = []
    _globoff = []
    for offset in offsList:
        # One round for person is enough.
        if offset not in _globoff: _globoff.append(offset)
        else: continue
        personID, movies = getRawData(dataF, offset, doCast, doWriters)
        # Consider only the current movie.
        movielist = [x for x in movies if x.get('movieID') == movieID]
        # XXX: a person can be listed more than one time for a single movie:
        #      think about directors of TV series.
        # XXX: here, 'movie' is a dictionary as returned by the getRawData
        #      function, not a Movie class instance.
        for movie in movielist:
            name = getLabel(personID, indexF, keyF)
            if not name: continue
            curRole = movie.get('currentRole', u'')
            roleID = None
            if curRole and charNF:
                curRole, roleID = getCharactersIDs(curRole, charNF)
            p = Person(name=name, personID=personID,
                        currentRole=curRole, roleID=roleID,
                        accessSystem='local')
            if movie.has_key('attributeID'):
                attr = getLabel(movie['attributeID'], attrIF, attrKF)
                if attr: p.notes = attr
            # Used to sort cast.
            if movie.has_key('position'):
                p.billingPos = movie['position'] or None
            resList.append(p)
    return resList
示例#3
0
     duty = group[0][4]
     for pdata in group:
         curRole = pdata[1]
         curRoleID = None
         if curRole is not None:
             robj = CharName.get(curRole)
             curRole = robj.name
             curRoleID = robj.id
         p = Person(personID=pdata[0],
                    name=pdata[5],
                    currentRole=curRole or u'',
                    roleID=curRoleID,
                    notes=pdata[2] or u'',
                    accessSystem='sql')
         if pdata[6]: p['imdbIndex'] = pdata[6]
         p.billingPos = pdata[3]
         res.setdefault(duty, []).append(p)
     if duty == 'cast':
         res[duty] = merge_roles(res[duty])
     res[duty].sort()
 # Info about the movie.
 minfo = [(self._info[m.infoTypeID], m.info, m.note)
          for m in MovieInfo.select(MovieInfo.q.movieID == movieID)]
 minfo = _groupListBy(minfo, 0)
 for group in minfo:
     sect = group[0][0]
     for mdata in group:
         data = mdata[1]
         if mdata[2]: data += '::%s' % mdata[2]
         res.setdefault(sect, []).append(data)
 # Companies info about a movie.