Exemple #1
0
def getFilmography(dataF,
                   indexF,
                   keyF,
                   attrIF,
                   attrKF,
                   offset,
                   charNF=None,
                   doCast=0,
                   doWriters=0):
    """Gather information from the given files about the
    person entry found at offset; return a list of Movie objects,
    with the relevant attributes."""
    name, res = getRawData(dataF, offset, doCast, doWriters)
    resList = []
    for movie in res:
        title = getLabel(movie['movieID'], indexF, keyF)
        if not title: continue
        curRole = movie.get('currentRole', u'')
        roleID = None
        if curRole and charNF:
            curRole, roleID = getCharactersIDs(curRole, charNF)
        m = Movie(title=title,
                  movieID=movie['movieID'],
                  currentRole=curRole,
                  roleID=roleID,
                  accessSystem='local')
        if movie.has_key('attributeID'):
            attr = getLabel(movie['attributeID'], attrIF, attrKF)
            if attr: m.notes = attr
        resList.append(m)
    return resList
 def end_li(self):
     self._in_li = 0
     if self._in_episodes:
         et = self._cur_episode_title.strip()
         minfo = self._misc_info.strip()
         if et and self._episode_id:
             eps_data = analyze_title(et, canonical=1)
             eps_data['kind'] = u'episode'
             e = Movie(movieID=str(self._episode_id),
                       data=eps_data,
                       accessSystem=self._as,
                       modFunct=self._modFunct)
             e['episode of'] = self._cur_series
             if minfo.startswith('('):
                 pe = minfo.find(')')
                 if pe != -1:
                     date = minfo[1:pe]
                     if date != '????':
                         e['original air date'] = date
                         if eps_data.get('year', '????') == '????':
                             syear = date.split()[-1]
                             if syear.isdigit():
                                 e['year'] = syear
             rolei = minfo.find(' - ')
             if rolei != -1:
                 if not self._got_i_info:
                     role = u''
                     role = minfo[rolei + 3:].strip()
                     notei = role.rfind('(')
                     note = u''
                     if notei != -1 and role and role[-1] == ')':
                         note = role[notei:]
                         role = role[:notei].strip()
                     e.notes = note
                     e.currentRole = role
                 else:
                     randn = minfo[rolei + 3:].strip().split()
                     note = '[%s]' % randn[0]
                     note += ' '.join(randn[1:])
                     e.notes = note
             self._episodes.setdefault(self._cur_series, []).append(e)
         self._cur_episode_title = u''
         self._episode_id = None
     self._in_misc_info = 0
     self._misc_info = u''
 def end_li(self):
     self._in_li = 0
     if self._in_episodes:
         et = self._cur_episode_title.strip()
         minfo = self._misc_info.strip()
         if et and self._episode_id:
             eps_data = analyze_title(et, canonical=1)
             eps_data['kind'] = u'episode'
             e = Movie(movieID=str(self._episode_id), data=eps_data,
                         accessSystem=self._as, modFunct=self._modFunct)
             e['episode of'] = self._cur_series
             if minfo.startswith('('):
                 pe = minfo.find(')')
                 if pe != -1:
                     date = minfo[1:pe]
                     if date != '????':
                         e['original air date'] = date
                         if eps_data.get('year', '????') == '????':
                             syear = date.split()[-1]
                             if syear.isdigit():
                                 e['year'] = syear
             rolei = minfo.find(' - ')
             if rolei != -1:
                 if not self._got_i_info:
                     role = u''
                     role = minfo[rolei+3:].strip()
                     notei = role.rfind('(')
                     note = u''
                     if notei != -1 and role and role[-1] == ')':
                         note = role[notei:]
                         role = role[:notei].strip()
                     e.notes = note
                     e.currentRole = role
                 else:
                     randn = minfo[rolei+3:].strip().split()
                     note = '[%s]' % randn[0]
                     note += ' '.join(randn[1:])
                     e.notes = note
             self._episodes.setdefault(self._cur_series, []).append(e)
         self._cur_episode_title = u''
         self._episode_id = None
     self._in_misc_info = 0
     self._misc_info = u''
Exemple #4
0
def get_movie_data(movieID, kindDict, fromAka=0):
    """Return a dictionary containing data about the given movieID;
    if fromAka is true, the AkaTitle table is searched."""
    if not fromAka: Table = Title
    else: Table = AkaTitle
    m = Table.get(movieID)
    mdict = {
        'title': m.title,
        'kind': kindDict[m.kindID],
        'year': m.productionYear,
        'imdbIndex': m.imdbIndex,
        'season': m.seasonNr,
        'episode': m.episodeNr
    }
    if not fromAka:
        if m.seriesYears is not None:
            mdict['series years'] = unicode(m.seriesYears)
    if mdict['imdbIndex'] is None: del mdict['imdbIndex']
    if mdict['year'] is None: del mdict['year']
    else:
        try:
            mdict['year'] = int(mdict['year'])
        except (TypeError, ValueError):
            del mdict['year']
    if mdict['season'] is None: del mdict['season']
    else:
        try:
            mdict['season'] = int(mdict['season'])
        except:
            pass
    if mdict['episode'] is None: del mdict['episode']
    else:
        try:
            mdict['episode'] = int(mdict['episode'])
        except:
            pass
    episodeOfID = m.episodeOfID
    if episodeOfID is not None:
        ser_dict = get_movie_data(episodeOfID, kindDict, fromAka)
        mdict['episode of'] = Movie(data=ser_dict,
                                    movieID=episodeOfID,
                                    accessSystem='sql')
        if fromAka:
            ser_note = AkaTitle.get(episodeOfID).note
            if ser_note:
                mdict['episode of'].notes = ser_note
    return mdict
Exemple #5
0
def getFilmography(dataF, indexF, keyF, attrIF, attrKF, offset,
                    charNF=None, doCast=0, doWriters=0):
    """Gather information from the given files about the
    person entry found at offset; return a list of Movie objects,
    with the relevant attributes."""
    name, res = getRawData(dataF, offset, doCast, doWriters)
    resList = []
    for movie in res:
        title = getLabel(movie['movieID'], indexF, keyF)
        if not title: continue
        curRole =  movie.get('currentRole', u'')
        roleID = None
        if curRole and charNF:
            curRole, roleID = getCharactersIDs(curRole, charNF)
        m = Movie(title=title, movieID=movie['movieID'],
                    currentRole=curRole, roleID=roleID,
                    accessSystem='local')
        if movie.has_key('attributeID'):
            attr = getLabel(movie['attributeID'], attrIF, attrKF)
            if attr: m.notes = attr
        resList.append(m)
    return resList