Skip to content

Commit 89aa7ff

Browse files
committed
Version 2.1.10
Duration from #EXTINF directive
1 parent 3c463da commit 89aa7ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Contents/Code/m3u_parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def LoadM3UFile(m3u_file, groups = {}, streams = {}, cust_m3u_name = None):
7575
video_resolution = GetAttribute(line_1, 'video_resolution').lower()
7676
container = GetAttribute(line_1, 'container').lower()
7777
duration = GetAttribute(line_1, 'duration').lower()
78+
if not duration:
79+
duration = line_1[8:line_1.find(' ', 8) if line_1.find(' ', 8) > 0 and line_1.find(',', 8) > line_1.find(' ', 8) else line_1.find(',', 8)].strip()
80+
if duration.isdigit():
81+
duration = duration if int(duration) > 0 else None
82+
else:
83+
duration = None
7884
width = GetAttribute(line_1, 'width').lower()
7985
height = GetAttribute(line_1, 'height').lower()
8086
protocol = GetAttribute(line_1, 'protocol').lower()

0 commit comments

Comments
 (0)