Check-in [e136a78c73]
Overview
Comment: | Finalize allowed filename extensions for exporting. Normalize Python3 string decoding (errors='ignore' per default). Update XSPF and SMIL export. Use row={} template now, instead of just carrying over title= to rewritten playlists. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | action-mapfmts |
Files: | files | file ages | folders |
SHA1: |
e136a78c735bba10b060e52afa4fc67d |
User & Date: | mario on 2015-04-10 16:40:44 |
Other Links: | branch diff | manifest | tags |
Context
2015-04-10
| ||
17:34 | Fix str→bytes saving for Py3. Tmplement tmp_files[] cleanup. Leaf check-in: 36c234a70b user: mario tags: action-mapfmts | |
16:40 | Finalize allowed filename extensions for exporting. Normalize Python3 string decoding (errors='ignore' per default). Update XSPF and SMIL export. Use row={} template now, instead of just carrying over title= to rewritten playlists. check-in: e136a78c73 user: mario tags: action-mapfmts | |
13:50 | Implement filename update in SaveAs dialog on changing FileFilter (.m3u, .pls, .xspf) extension. check-in: 0a9cb60b3a user: mario tags: action-mapfmts | |
Changes
Modified action.py from [a1f8b1c311] to [42bec82228].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - - + + + | # Each channel plugin has a .listtype which defines the linked # audio playlist format. It's "pls", seldomly "m3u", or "xspf". # Some channels list raw "srv" addresses, while Youtube "href" # entries to Flash videos. # # As fallback the playlist URL is retrieved and its MIME type # checked, and its content regexped to guess the link format. |
︙ | |||
126 127 128 129 130 131 132 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + - + - + - + | # def help(*args): run("yelp /usr/share/doc/streamtuner2/help/") # Calls player for stream url and format # |
︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | 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 | + - + - + - - - - + - + | # · Also understands short aliases %l, %f, %d. # · And can embed %title or %genre placeholders. # · Replace .pls URL with local .m3u file depending on map. # def interpol(cmd, url, source="pls", row={}): # inject other meta fields row = copy.copy(row) if row: for field in row: cmd = cmd.replace("%"+field, "%r" % row.get(field)) # add default if cmd has no %url placeholder if cmd.find("%") < 0: cmd = cmd + " %pls" # "pls" as default requires no conversion for most channels, and seems broadly supported by players # standard placeholders for dest, rx in placeholder_map.items(): if re.search(rx, cmd, re.X): # from .pls to .m3u |
︙ | |||
243 244 245 246 247 248 249 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - - + | debug(dbg.DATA, "conversion from:", source, " with extractor:", fmt, "got URLs=", urls) # Return original, or asis for srv targets if not urls: return [url] elif dest in ("srv", "href"): return urls |
︙ | |||
281 282 283 284 285 286 287 | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | - + | mime = listfmt_t.get(mime) # Raw content (mp3, flv) elif mediafmt_t.get(mime): debug(dbg.ERR, "Got media MIME type for expected playlist", mime, " on url=", url) mime = mediafmt_t.get(mime) return (mime, url) # Rejoin body |
︙ | |||
316 317 318 319 320 321 322 | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - - + + - - - + + + + + + + | "asf": r" (?m) ^ \s*Ref\d+ = (\w+://[^\s]+) ", "raw": r" (?i) ( [\w+]+:// [^\s\"\'\>\#]+ ) ", } # Save rows in one of the export formats. # |
︙ | |||
398 399 400 401 402 403 404 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - - - + + + + | # JSON (native lists of streamtuner2) def json(self, rows): return json.dumps(rows, indent=4) # XSPF def xspf(self, rows): |
︙ | |||
429 430 431 432 433 434 435 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | - + | txt += """\t<entry>\n\t\t<title>%s</title>\n\t\t<ref href="%s"/>\n\t</entry>\n""" % (xmlentities(row["title"]), xmlentities(row["url"])) txt += """</asx>\n""" return txt # SMIL def smil(self, rows): |
︙ |
Modified channels/__init__.py from [b6c3442f9b] to [9cf8287e24].
︙ | |||
483 484 485 486 487 488 489 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + - + - + - + | #--------------------------- actions --------------------------------- # Invoke action.play() for current station. # Can be overridden to provide channel-specific "play" alternative def play(self): row = self.row() |
︙ |
Modified channels/exportcat.py from [1a24ff64fc] to [02ad2daff2].
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + + + + + + + + | def savewindow(self, *w): cn = self.parent.channel() source = cn.listformat streams = cn.streams[cn.current] fn = uikit.save_file("Export category", None, "%s.%s.%s" % (cn.module, cn.current, conf.export_format)) __print__(dbg.PROC, "Exporting category to", fn) if fn: |
Modified config.py from [39c7681328] to [cbe5c8fdc6].
︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + | # def get_data(fn, decode=False, gz=False, file_base="config"): try: bin = pkgutil.get_data(file_base, fn) if gz: bin = gzip_decode(bin) if decode: |
︙ | |||
394 395 396 397 398 399 400 | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | - + | intfn = add + "/" + intfn if len(fn) >= 3 and intfn and zipfile.is_zipfile(fn): src = zipfile.ZipFile(fn, "r").read(intfn.strip("/")) if not src: src = "" if type(src) is not str: |
︙ |
Modified gtk3.xml.gz from [636af55d84] to [7df44525d1].
cannot compute difference between binary files
Modified uikit.py from [6ca85da059] to [913007a2bb].
︙ | |||
395 396 397 398 399 400 401 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - + | # Callback for changed FileFilter, updates current filename extension @staticmethod def save_file_filterchange(c): fn, ext = c.get_filename(), c.get_filter().get_name() if fn and ext: fn = os.path.basename(fn) |
︙ |