handle optional extinf title properly
Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -40,11 +40,11 @@ m3uTag | ... | @@ -40,11 +40,11 @@ m3uTag |
40 | = tag:"#EXTM3U" { return {openTag: true}; } | 40 | = tag:"#EXTM3U" { return {openTag: true}; } |
41 | 41 | ||
42 | extinfTag | 42 | extinfTag |
43 | = tag:'#EXTINF' ":" duration:number "," _ title:text? _ byteRange:byteRangeTag? _ file:mediaFile { | 43 | = tag:'#EXTINF' ":" duration:number "," optional:extinfOptionalParts? _ file:mediaFile { |
44 | var fileObj = {}; | 44 | var fileObj = {}; |
45 | fileObj[tag + line] = { | 45 | fileObj[tag + line] = { |
46 | byteRange: byteRange, | 46 | byteRange: optional.byteRange, |
47 | title: title, | 47 | title: optional.title, |
48 | duration: duration, | 48 | duration: duration, |
49 | file: file | 49 | file: file |
50 | }; | 50 | }; |
... | @@ -111,6 +111,10 @@ versionTag | ... | @@ -111,6 +111,10 @@ versionTag |
111 | 111 | ||
112 | /***** Helpers *****/ | 112 | /***** Helpers *****/ |
113 | 113 | ||
114 | extinfOptionalParts | ||
115 | = _? byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; } | ||
116 | / _? title:nonbreakingText? _? byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} } | ||
117 | |||
114 | mediaFile | 118 | mediaFile |
115 | = & tag | 119 | = & tag |
116 | / ! tag file:[ -~]+ { return file.join(''); } | 120 | / ! tag file:[ -~]+ { return file.join(''); } |
... | @@ -264,6 +268,9 @@ quotedChar | ... | @@ -264,6 +268,9 @@ quotedChar |
264 | = [^\r\n"] | 268 | = [^\r\n"] |
265 | / char:char | 269 | / char:char |
266 | 270 | ||
271 | nonbreakingText | ||
272 | = text:quotedChar+ { return text.join(''); } | ||
273 | |||
267 | text "text" | 274 | text "text" |
268 | = text:char+ { return text.join(''); } | 275 | = text:char+ { return text.join(''); } |
269 | 276 | ... | ... |
-
Please register or sign in to post a comment