c13eb88e by Gary Katsevman

Make output object more inline with current object

Rename mediaFile to mediaURL in segment and rendition
Rename byteRange into byterange and default it to -1 in segment
Rename duration to targetDuration in segment
1 parent a4c15328
...@@ -57,12 +57,12 @@ m3uTag ...@@ -57,12 +57,12 @@ m3uTag
57 = tag:"#EXTM3U" { return {openTag: true}; } 57 = tag:"#EXTM3U" { return {openTag: true}; }
58 58
59 extinfTag 59 extinfTag
60 = tag:'#EXTINF' ":" duration:number "," optional:extinfOptionalParts _ file:mediaFile { 60 = tag:'#EXTINF' ":" duration:number "," optional:extinfOptionalParts _ url:mediaURL {
61 return {segments: { 61 return {segments: {
62 byteRange: optional.byteRange, 62 byterange: optional.byteRange || -1,
63 title: optional.title, 63 title: optional.title,
64 duration: duration, 64 targetDuration: duration,
65 file: file 65 url: url
66 } 66 }
67 }; 67 };
68 } 68 }
...@@ -95,10 +95,10 @@ mediaTag ...@@ -95,10 +95,10 @@ mediaTag
95 = tag:'#EXT-MEDIA' ":" attrs:mediaAttributes { return {media: attrs}; } 95 = tag:'#EXT-MEDIA' ":" attrs:mediaAttributes { return {media: attrs}; }
96 96
97 streamInfTag 97 streamInfTag
98 = tag:'#EXT-X-STREAM-INF' ":" attrs:streamInfAttrs _ file:mediaFile? { 98 = tag:'#EXT-X-STREAM-INF' ":" attrs:streamInfAttrs _ url:mediaURL? {
99 return {renditions: { 99 return {renditions: {
100 attributes: attrs, 100 attributes: attrs,
101 file: file 101 url: url
102 } 102 }
103 }; 103 };
104 } 104 }
...@@ -130,7 +130,7 @@ extinfOptionalParts ...@@ -130,7 +130,7 @@ extinfOptionalParts
130 = nonbreakingWhitespace title:text _ byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} } 130 = nonbreakingWhitespace title:text _ byteRange:byteRangeTag? { return {title: title, byteRange: byteRange} }
131 / _ byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; } 131 / _ byteRange:byteRangeTag? { return {title: '', byteRange: byteRange}; }
132 132
133 mediaFile 133 mediaURL
134 = & tag 134 = & tag
135 / ! tag file:[ -~]+ { return file.join(''); } 135 / ! tag file:[ -~]+ { return file.join(''); }
136 136
......