61f4ce12 by Gary Katsevman

have enumarted strings return proper objects

1 parent b98df9db
...@@ -97,7 +97,7 @@ mediaTag ...@@ -97,7 +97,7 @@ mediaTag
97 streamInfTag 97 streamInfTag
98 = tag:'#EXT-X-STREAM-INF' ":" attrs:streamInfAttrs _ url:mediaURL? { 98 = tag:'#EXT-X-STREAM-INF' ":" attrs:streamInfAttrs _ url:mediaURL? {
99 return {renditions: { 99 return {renditions: {
100 attributes: attrs, 100 attributes: JSON.stringify(attrs),
101 url: url 101 url: url
102 } 102 }
103 }; 103 };
...@@ -139,11 +139,11 @@ keyAttributes ...@@ -139,11 +139,11 @@ keyAttributes
139 / attrs:keyAttribute? 139 / attrs:keyAttribute?
140 140
141 keyAttribute 141 keyAttribute
142 = "METHOD" "=" method:keyMethod 142 = "METHOD" "=" method:keyMethod { return {keyMethod: method}; }
143 / "URI" "=" uri:quotedString 143 / "URI" "=" uri:quotedString { return {uri: uri}; }
144 / "IV" "=" iv:hexint 144 / "IV" "=" iv:hexint { return {IV: iv}; }
145 / "KEYFORMAT" "=" keyFormat:quotedString 145 / "KEYFORMAT" "=" keyFormat:quotedString { return {keyFormat: keyFormat}; }
146 / "KEYFORMATVERSIONS" "=" keyFormatVersions:quotedString 146 / "KEYFORMATVERSIONS" "=" keyFormatVersions:quotedString { return {keyFormatVersions: keyFormatVersions}; }
147 147
148 keyMethod 148 keyMethod
149 = "NONE" 149 = "NONE"
...@@ -155,17 +155,17 @@ mediaAttributes ...@@ -155,17 +155,17 @@ mediaAttributes
155 / attrs:mediaAttribute? 155 / attrs:mediaAttribute?
156 156
157 mediaAttribute 157 mediaAttribute
158 = "TYPE" "=" type:mediaTypes 158 = "TYPE" "=" type:mediaTypes { return {type: type}; }
159 / "URI" "=" uri:quotedString 159 / "URI" "=" uri:quotedString { return {uri: uri}; }
160 / "GROUP-ID" "=" groupId:quotedString 160 / "GROUP-ID" "=" groupId:quotedString { return {groupId: groupdId}; }
161 / "LANGUAGE" "=" langauge:quotedString 161 / "LANGUAGE" "=" langauge:quotedString { return {language: language}; }
162 / "ASSOC-LANGUAGE" "=" assocLanguage:quotedString 162 / "ASSOC-LANGUAGE" "=" assocLanguage:quotedString { return {assocLanguage: assocLanguage}; }
163 / "NAME" "=" name:quotedString 163 / "NAME" "=" name:quotedString { return {name: name}; }
164 / "DEFAULT" "=" default:answer 164 / "DEFAULT" "=" def:answer { return {defaultAnswer: def}; }
165 / "AUTOSELECT" "="autoselect:answer 165 / "AUTOSELECT" "=" autoselect:answer { return {autoselect: autoselect}; }
166 / "FORCE" "=" force:answer 166 / "FORCE" "=" force:answer { return {force: force}; }
167 / "INSTREAM-ID" "=" instreamId:quotedString 167 / "INSTREAM-ID" "=" instreamId:quotedString { return {instreamId: instreamId}; }
168 / "CHARACTERISTICS" "=" characteristics:quotedString 168 / "CHARACTERISTICS" "=" characteristics:quotedString { return {characteristics: characteristics}; }
169 169
170 streamInfAttrs 170 streamInfAttrs
171 = attrs:(streamInfAttr (attrSeparator streamInfAttr)*) 171 = attrs:(streamInfAttr (attrSeparator streamInfAttr)*)
...@@ -173,25 +173,25 @@ streamInfAttrs ...@@ -173,25 +173,25 @@ streamInfAttrs
173 173
174 streamInfAttr 174 streamInfAttr
175 = streamInfSharedAttr 175 = streamInfSharedAttr
176 / "AUDIO" "=" audio:quotedString 176 / "AUDIO" "=" audio:quotedString { return {audio: audio}; }
177 / "SUBTITLES" "=" subtitles:quotedString 177 / "SUBTITLES" "=" subtitles:quotedString { return {video: video}; }
178 / "CLOSED-CAPTION" "=" captions:"NONE" 178 / "CLOSED-CAPTIONS" "=" captions:"NONE" { return {closedCaptions: captions}; }
179 / "CLOSED-CAPTION" "=" captions:quotedString 179 / "CLOSED-CAPTIONS" "=" captions:quotedString { return {closedCaptions: captions}; }
180 180
181 streamInfSharedAttr 181 streamInfSharedAttr
182 = "PROGRAM-ID" "=" programId:int 182 = "PROGRAM-ID" "=" programId:int { return {programId: programId}; }
183 / "BANDWIDTH" "=" bandwidth:int 183 / "BANDWIDTH" "=" bandwidth:int { return {bandwidth: bandwidth}; }
184 / "CODECS" "=" codec:quotedString 184 / "CODECS" "=" codec:quotedString { return {codecs: codec}; }
185 / "RESOLUTION" "=" resolution:resolution 185 / "RESOLUTION" "=" resolution:resolution { return {resolution: resolution}; }
186 / "VIDEO" "=" video:quotedString 186 / "VIDEO" "=" video:quotedString { return {video: video}; }
187 187
188 mapAttributes 188 mapAttributes
189 = attrs:(mapAttribute (attrSeparator mapAttribute)*) 189 = attrs:(mapAttribute (attrSeparator mapAttribute)*)
190 / attrs:mapAttribute? 190 / attrs:mapAttribute?
191 191
192 mapAttribute 192 mapAttribute
193 = "URI" "=" uri:quotedString 193 = "URI" "=" uri:quotedString { return {uri: uri}; }
194 / "BYTERANGE" "=" byteRange:quotedString 194 / "BYTERANGE" "=" byteRange:quotedString { return {byterange: byterange}; }
195 195
196 iframeStreamAttrs 196 iframeStreamAttrs
197 = attrs:(iframeStreamAttr (attrSeparator iframeStreamAttr)*) 197 = attrs:(iframeStreamAttr (attrSeparator iframeStreamAttr)*)
...@@ -199,15 +199,15 @@ iframeStreamAttrs ...@@ -199,15 +199,15 @@ iframeStreamAttrs
199 199
200 iframeStreamAttr 200 iframeStreamAttr
201 = streamInfSharedAttr 201 = streamInfSharedAttr
202 / "URI" "=" uri:quotedString 202 / "URI" "=" uri:quotedString { return {uri: uri}; }
203 203
204 startAttributes 204 startAttributes
205 = attrs:(startAttribute (attrSeparator startAttribute)*) 205 = attrs:(startAttribute (attrSeparator startAttribute)*)
206 / attrs:startAttribute? 206 / attrs:startAttribute?
207 207
208 startAttribute 208 startAttribute
209 = "TIME-OFFSET" "=" timeOffset:number 209 = "TIME-OFFSET" "=" timeOffset:number { return {timeOffset: timeOffset}; }
210 / "PRECISE" "=" precise:answer 210 / "PRECISE" "=" precise:answer { return {precise: precise}; }
211 211
212 answer "answer" 212 answer "answer"
213 = "YES" 213 = "YES"
...@@ -256,7 +256,7 @@ number "number" ...@@ -256,7 +256,7 @@ number "number"
256 / parts:(int) _ { return parts; } 256 / parts:(int) _ { return parts; }
257 257
258 resolution 258 resolution
259 = int "x" int 259 = width:int "x" height:int { return {resolution: {width: width, height: height}}; }
260 260
261 int 261 int
262 = first:digit19 rest:digits { return parseInt(first + rest.join(''), 10); } 262 = first:digit19 rest:digits { return parseInt(first + rest.join(''), 10); }
......