Spanicin commited on
Commit
ffa0ee3
·
verified ·
1 Parent(s): cfd1f34

Update stream_server.py

Browse files
Files changed (1) hide show
  1. stream_server.py +3 -2
stream_server.py CHANGED
@@ -125,9 +125,10 @@ async def add_video(video_name, output_path, audio_duration):
125
  if remaining_segment_path not in existing_segments:
126
  m3u8_file.write(f"#EXTINF:{remaining_duration:.3f},\n")
127
  m3u8_file.write(f"{remaining_segment_path}\n")
 
128
 
129
- # Add #EXT-X-ENDLIST only if there are no more videos to add
130
- if remaining_duration > 0 or len(video_names) == segment_counter:
131
  with open(output_path, 'a') as m3u8_file:
132
  m3u8_file.write("#EXT-X-ENDLIST\n")
133
 
 
125
  if remaining_segment_path not in existing_segments:
126
  m3u8_file.write(f"#EXTINF:{remaining_duration:.3f},\n")
127
  m3u8_file.write(f"{remaining_segment_path}\n")
128
+ remaining_duration = 0
129
 
130
+ # Add #EXT-X-ENDLIST only once after all segments have been added
131
+ if remaining_duration == 0:
132
  with open(output_path, 'a') as m3u8_file:
133
  m3u8_file.write("#EXT-X-ENDLIST\n")
134