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''