Check-in [2116c28445]
Overview
Comment: | Extended generic JSON extractor, to understand a few common field aliases. Add fallbacks for mime_app lookup in case */* is absent. Simplified %rowfield injection, which is commonly unused anyway. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2116c28445ebb68ab3ccc133c6185029 |
User & Date: | mario on 2015-04-26 22:24:17 |
Other Links: | manifest | tags |
Context
2015-04-26
| ||
23:49 | Document changes, fixes, new features in 2.1.7 check-in: 3cc9821dbb user: mario tags: trunk, 2.1.7 | |
22:24 | Extended generic JSON extractor, to understand a few common field aliases. Add fallbacks for mime_app lookup in case */* is absent. Simplified %rowfield injection, which is commonly unused anyway. check-in: 2116c28445 user: mario tags: trunk | |
22:22 | Uneeded windows desktop shortcut. check-in: 90605cbddc user: mario tags: trunk | |
Changes
Modified action.py from [18fc32c37f] to [aa42f204ad].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + - + | # encoding: UTF-8 # api: streamtuner2 # type: functions |
︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + + - + - - - + + - + - + - + | return listfmt_t.get(t, t) # e.g. "pls" or still "text/x-unknown" # Convert MIME type into list of ["audio/xyz", "audio/*", "*/*"] # for comparison against configured record/play association. def mime_app(fmt, cmd_list): major = fmt[:fmt.find("/")] |
︙ | |||
347 348 349 350 351 352 353 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | - + | # Extract only URLs from given source type def rows(self, fmt=None): if not fmt: fmt = self.probe_fmt() log.DATA("input extractor/regex:", fmt, len(self.src)) # specific extractor implementations |
︙ | |||
452 453 454 455 456 457 458 | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | - - + + + + + | ), "jamj": dict( url = r" (?x) \"audio\" \s*:\s* \"(\w+:\\?/\\?/[^\"\s]+)\" ", title = r" (?x) \"name\" \s*:\s* \"([^\"]+)\" ", unesc = "json", ), "json": dict( |
︙ | |||
485 486 487 488 489 490 491 | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | - + | def pls(self): fieldmap = dict(file="url", title="title") rows = {} for field,num,value in re.findall("^\s* ([a-z_-]+) (\d+) \s*=\s* (.*) $", self.src, re.M|re.I|re.X): if not num in rows: rows[num] = {} field = fieldmap.get(field.lower()) |
︙ |