+ def _read_ytdl_file(self, ctx):
+ stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'r')
+ ctx['fragment_index'] = json.loads(stream.read())['download']['current_fragment_index']
+ stream.close()
+
+ def _write_ytdl_file(self, ctx):
+ frag_index_stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'w')
+ frag_index_stream.write(json.dumps({
+ 'download': {
+ 'current_fragment_index': ctx['fragment_index']
+ },
+ }))
+ frag_index_stream.close()
+