示例#1
0
 def _parse(self):
     self._encoding = detect(self.filename)
     if self._encoding == 'ascii':
         self._encoding = 'utf_8'
     self._format = determine(self.filename, self._encoding)
     self._subtitlefile = new(self._format, self.filename, self._encoding)
     for subtitle in self._subtitlefile.read():
         newunit = self.addsourceunit(subtitle.main_text)
         newunit._start = subtitle.start
         newunit._end = subtitle.end
         newunit._duration = subtitle.duration_seconds
示例#2
0
 def _parse(self):
     try:
         self.encoding = detect(self.filename)
         self._format = determine(self.filename, self.encoding)
         self._subtitlefile = new(self._format, self.filename, self.encoding)
         for subtitle in self._subtitlefile.read():
             newunit = self.addsourceunit(subtitle.main_text)
             newunit._start = subtitle.start
             newunit._end = subtitle.end
             newunit._duration = subtitle.duration_seconds
     except Exception as e:
         raise base.ParseError(e)
示例#3
0
 def _parse(self):
     try:
         self.encoding = detect(self.filename)
         self._format = determine(self.filename, self.encoding)
         self._subtitlefile = new(self._format, self.filename, self.encoding)
         for subtitle in self._subtitlefile.read():
             newunit = self.addsourceunit(subtitle.main_text)
             newunit._start = subtitle.start
             newunit._end = subtitle.end
             newunit._duration = subtitle.duration_seconds
     except Exception as e:
         raise base.ParseError(e)