Ejemplo n.º 1
0
 def __str__(self):
     subtitles = []
     for unit in self.units:
         subtitle = Subtitle()
         subtitle.main_text = unit.target or unit.source
         subtitle.start = unit._start
         subtitle.end = unit._end
         subtitles.append(subtitle)
     output = BytesIO()
     self._subtitlefile.write_to_file(subtitles, documents.MAIN, output)
     return output.getvalue().encode(self._subtitlefile.encoding)
Ejemplo n.º 2
0
 def __str__(self):
     subtitles = []
     for unit in self.units:
         subtitle = Subtitle()
         subtitle.main_text = unit.target or unit.source
         subtitle.start = unit._start
         subtitle.end = unit._end
         subtitles.append(subtitle)
     output = StringIO()
     self._subtitlefile.write_to_file(subtitles, documents.MAIN, output)
     return output.getvalue().encode(self._subtitlefile.encoding)
Ejemplo n.º 3
0
 def serialize(self, out):
     subtitles = []
     for unit in self.units:
         subtitle = Subtitle()
         subtitle.main_text = unit.target or unit.source
         subtitle.start = unit._start
         subtitle.end = unit._end
         subtitles.append(subtitle)
     # Using transient output might be dropped if/when we have more control
     # over the open mode of out files.
     output = StringIO()
     self._subtitlefile.write_to_file(subtitles, documents.MAIN, output)
     out.write(output.getvalue().encode(self._subtitlefile.encoding))
Ejemplo n.º 4
0
 def serialize(self, out):
     subtitles = []
     for unit in self.units:
         subtitle = Subtitle()
         subtitle.main_text = unit.target or unit.source
         subtitle.start = unit._start
         subtitle.end = unit._end
         subtitles.append(subtitle)
     # Using transient output might be dropped if/when we have more control
     # over the open mode of out files.
     output = StringIO()
     self._subtitlefile.write_to_file(subtitles, documents.MAIN, output)
     out.write(output.getvalue().encode(self._subtitlefile.encoding))