Check-in [223368ebbf]
Overview
Comment: | Update comment on rewritten action module. Add alternative MIME types for m3u and asx, spport asf detection and extraction. Fix listformat→source arg. Move save() and filename handling out of save_playlist. Fix mediafmt_t lookup and print warning when there's an audio-response on playlist fetching (and it does happen). Change myoggradio plugin "format" population, and set listformat to "mixed(..)" for automatic probing. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | action-mapfmts |
Files: | files | file ages | folders |
SHA1: |
223368ebbfcb40f3816a69d2fc52a337 |
User & Date: | mario on 2015-04-10 10:45:21 |
Other Links: | branch diff | manifest | tags |
Context
2015-04-10
| ||
10:54 | Sync with trunk changes. check-in: 801ad7fd98 user: mario tags: action-mapfmts | |
10:45 | Update comment on rewritten action module. Add alternative MIME types for m3u and asx, spport asf detection and extraction. Fix listformat→source arg. Move save() and filename handling out of save_playlist. Fix mediafmt_t lookup and print warning when there's an audio-response on playlist fetching (and it does happen). Change myoggradio plugin "format" population, and set listformat to "mixed(..)" for automatic probing. check-in: 223368ebbf user: mario tags: action-mapfmts | |
02:36 | Fixed ASX and SMIL playlist exporting, allowed new placeholders %xspf, %jspf, %asx, %smil for application configuration. Documented in help/ pages. check-in: 1937c5766b user: mario tags: action-mapfmts | |
Changes
Modified action.py from [f7b4eccd84] to [666f98e53e].
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + + + + - - - + + + + - - + - + + + + + + + + |
|
︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | + + + | # Streamlink/listformat mapping listfmt_t = { "audio/x-scpls": "pls", "audio/x-mpegurl": "m3u", "audio/mpegurl": "m3u", "video/x-ms-asf": "asx", "application/xspf+xml": "xspf", "*/*": "href", # "href" for unknown responses "url/direct": "srv", "url/youtube": "href", "url/http": "href", "audio/x-pn-realaudio": "ram", "application/smil": "smil", "application/vnd.ms-wpl":"smil", "audio/x-ms-wax": "asx", "video/x-ms-asf": "asx", "x-urn/st2-script": "script", # unused "application/x-shockwave-flash": "href", # fallback } # Audio type MIME map mediafmt_t = { "audio/mpeg": "mp3", |
︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | + | ("m3u", r""" ^ \s* #(EXT)?M3U """), ("asx" , r""" <asx\b """), ("smil", r""" <smil[^>]*> .* <seq> """), ("html", r""" <(audio|video)\b[^>]+\bsrc\s*=\s*["']?https?:// """), ("wpl", r""" <\?wpl \s+ version="1\.0" \s* \?> """), ("b4s", r""" <WinampXML> """), # http://gonze.com/playlists/playlist-format-survey.html ("jspf", r""" ^ \s* \{ \s* "playlist": \s* \{ """), ("asf", r""" ^ \[Reference\] .*? ^Ref\d+= """), ("json", r""" "url": \s* "\w+:// """), ("href", r""" .* """), ] # Exec wrapper |
︙ | |||
112 113 114 115 116 117 118 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + - + | run("yelp /usr/share/doc/streamtuner2/help/") # Calls player for stream url and format # def play(url, audioformat="audio/mpeg", source="pls", row={}): cmd = mime_app(audioformat, conf.play) |
︙ | |||
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 | + + + | return "false" # Substitute .pls URL with local .m3u, or direct srv addresses, or leaves URL asis. # · Takes a single input `url`. # · But returns a list of [urls] after playlist extraction. # · If repackaging as .m3u/.pls/.xspf, returns the local [fn]. # # TODO: This still needs some rewrite to reuse the incoming row={}, # and keep station titles for converted playlists. # def convert_playlist(url, source, dest, local_file=True, title=""): urls = [] debug(dbg.PROC, "convert_playlist(", url, source, dest, ")") # Leave alone if format matches, or if "srv" URL class, or if not http (local path, mms:/rtsp:) if source == dest or source in ("srv", "href") or not re.match("(https?|spdy)://", url): |
︙ | |||
214 215 216 217 218 219 220 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - + - - + + - - + + + + | break # with `probe` set # Check ambiguity (except pseudo extension) if len(set([source, mime, probe])) > 1: debug(dbg.ERR, "Possible playlist format mismatch:", (source, mime, probe, ext)) # Extract URLs from content |
︙ | |||
254 255 256 257 258 259 260 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 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 | - - + + + - + - + - + + + - - + + + + + - + - - - + + | # Extract payload mime = r.headers.get("content-type", "href") # Map MIME to abbr type (pls, m3u, xspf) if listfmt_t.get(mime): mime = listfmt_t.get(mime) # Raw content (mp3, flv) |
︙ | |||
339 340 341 342 343 344 345 | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - - - - - - - + + + + + + + - - + | break rows = new_rows debug(dbg.DATA, "conversion to:", dest, " from:", self.source, "with rows=", rows) # call conversion schemes converter = getattr(self, dest) or self.pls |
︙ |
Modified channels/myoggradio.py from [172a61f6a0] to [b090a1507b].
︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | # open source radio sharing stie class myoggradio(ChannelPlugin): # settings title ="MOR" #module = "myoggradio" api = "http://www.myoggradio.org/" |
︙ | |||
99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | + | self.parent.status("Unknown category") pass # augment result list for i,e in enumerate(entries): entries[i]["homepage"] = self.api + "c_common_details.jsp?url=" + e["url"] entries[i]["genre"] = cat entries[i]["format"] = "audio/mpeg" # send back return entries # upload a single station entry to MyOggRadio def share(self, *w): |
︙ |