Handle optional extinf desc properly
Showing
1 changed file
with
7 additions
and
7 deletions
... | @@ -40,7 +40,7 @@ m3uTag | ... | @@ -40,7 +40,7 @@ m3uTag |
40 | = tag:"#EXTM3U" { return {openTag: true}; } | 40 | = tag:"#EXTM3U" { return {openTag: true}; } |
41 | 41 | ||
42 | extinfTag | 42 | extinfTag |
43 | = tag:'#EXTINF' ":" duration:number "," optional:extinfOptionalParts? _ 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: optional.byteRange, | 46 | byteRange: optional.byteRange, |
... | @@ -52,7 +52,7 @@ extinfTag | ... | @@ -52,7 +52,7 @@ extinfTag |
52 | } | 52 | } |
53 | 53 | ||
54 | byteRangeTag | 54 | byteRangeTag |
55 | = tag:"EXT-X-BYTERANGE" ":" length:int ("@" offset:int)? { return {length: length, offset: offset}; } | 55 | = tag:"#EXT-X-BYTERANGE" ":" length:int ("@" offset:int)? { return {length: length, offset: offset}; } |
56 | 56 | ||
57 | targetDurationTag | 57 | targetDurationTag |
58 | = tag:"#EXT-X-TARGETDURATION" ":" seconds:int { return {targetDuration: seconds}; } | 58 | = tag:"#EXT-X-TARGETDURATION" ":" seconds:int { return {targetDuration: seconds}; } |
... | @@ -112,8 +112,8 @@ versionTag | ... | @@ -112,8 +112,8 @@ versionTag |
112 | /***** Helpers *****/ | 112 | /***** Helpers *****/ |
113 | 113 | ||
114 | extinfOptionalParts | 114 | extinfOptionalParts |
115 | = _? byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; } | 115 | = nonbreakingWhitespace title:text _ byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} } |
116 | / _? title:nonbreakingText? _? byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} } | 116 | / _ byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; } |
117 | 117 | ||
118 | mediaFile | 118 | mediaFile |
119 | = & tag | 119 | = & tag |
... | @@ -268,9 +268,6 @@ quotedChar | ... | @@ -268,9 +268,6 @@ quotedChar |
268 | = [^\r\n"] | 268 | = [^\r\n"] |
269 | / char:char | 269 | / char:char |
270 | 270 | ||
271 | nonbreakingText | ||
272 | = text:quotedChar+ { return text.join(''); } | ||
273 | |||
274 | text "text" | 271 | text "text" |
275 | = text:char+ { return text.join(''); } | 272 | = text:char+ { return text.join(''); } |
276 | 273 | ||
... | @@ -282,3 +279,6 @@ _ "whitespace" | ... | @@ -282,3 +279,6 @@ _ "whitespace" |
282 | 279 | ||
283 | whitespace | 280 | whitespace |
284 | = [ \t\n\r] | 281 | = [ \t\n\r] |
282 | |||
283 | nonbreakingWhitespace | ||
284 | = [ \t]* | ... | ... |
-
Please register or sign in to post a comment