forked from davidyang013/HLS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecord.py
32 lines (27 loc) · 829 Bytes
/
record.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'''
Created on 2013-2-22
@author: xweiyan
'''
import hls
import os
import time
'''
this tool use to record the m3u8 file
'''
def record(path):
m3u8 = hls.load(path)
#create record file
while True:
for playlist in m3u8.playlists:
record=os.path.splitext(str(playlist))[0]+".txt"
print record
record_file = open(record, "a")
sub_m3u8 = hls.load(str(playlist).replace('\\','\\\\'))
print str(sub_m3u8.segments)
record_file.write(str(sub_m3u8.segments)+"\n")
record_file.flush()
time.sleep(60)
if __name__ == "__main__":
path = "C:\\development\\Apache Software Foundation\\Apache2.2\\uploads\\1\\index.m3u8"
path = r"C:\Users\xweiyan\Desktop\2\index.m3u8"
record(path)