コード例 #1
0
ファイル: subtitles.py プロジェクト: mellterm/translate
 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
ファイル: subtitles.py プロジェクト: XLeonardo/translate-1
 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)