67bdb0e1 by Gary Katsevman

handle optional extinf title properly

1 parent e53563ee
......@@ -40,11 +40,11 @@ m3uTag
= tag:"#EXTM3U" { return {openTag: true}; }
extinfTag
= tag:'#EXTINF' ":" duration:number "," _ title:text? _ byteRange:byteRangeTag? _ file:mediaFile {
= tag:'#EXTINF' ":" duration:number "," optional:extinfOptionalParts? _ file:mediaFile {
var fileObj = {};
fileObj[tag + line] = {
byteRange: byteRange,
title: title,
byteRange: optional.byteRange,
title: optional.title,
duration: duration,
file: file
};
......@@ -111,6 +111,10 @@ versionTag
/***** Helpers *****/
extinfOptionalParts
= _? byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; }
/ _? title:nonbreakingText? _? byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} }
mediaFile
= & tag
/ ! tag file:[ -~]+ { return file.join(''); }
......@@ -264,6 +268,9 @@ quotedChar
= [^\r\n"]
/ char:char
nonbreakingText
= text:quotedChar+ { return text.join(''); }
text "text"
= text:char+ { return text.join(''); }
......