Check-in [7149d92fe1]
Overview
Comment: | Updated Jamendo plugin audioformat and listformat descriptors. Attempted to use v3.0 API for playlist tracks. Still no playlist API endpoint. So using a separate track requests now. Implemented a new action/playlist_convert URL extractor, which shall henceforth be known as "jamj" (JamJibberish). Fixed XML url extraction in regex mode, trivial backslash deescaping for JSON formats; and fixed multiply URL bug by copying row{} dict during conversion. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7149d92fe1ad67fa50c497d964fe5b07 |
User & Date: | mario on 2015-04-18 17:19:38 |
Other Links: | manifest | tags |
Context
2015-04-18
| ||
20:37 | Guard appstate_init channels.current setting for absent plugins. check-in: 24fb9b895e user: mario tags: trunk | |
17:19 | Updated Jamendo plugin audioformat and listformat descriptors. Attempted to use v3.0 API for playlist tracks. Still no playlist API endpoint. So using a separate track requests now. Implemented a new action/playlist_convert URL extractor, which shall henceforth be known as "jamj" (JamJibberish). Fixed XML url extraction in regex mode, trivial backslash deescaping for JSON formats; and fixed multiply URL bug by copying row{} dict during conversion. check-in: 7149d92fe1 user: mario tags: trunk | |
17:16 | Removed dnd code snippets. check-in: 1e268b6422 user: mario tags: trunk | |
Changes
Modified Makefile from [9e648740b2] to [75cd4eda77].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | - + | # Requires # ยท http://fossil.include-once.org/versionnum/ # ยท http://fossil.include-once.org/xpm/ SHELL := /bin/bash #(for brace expansion) NAME := streamtuner2 VERSION := $(shell version get:plugin st2.py || echo 2.1dev) DEST := /usr/share/streamtuner2 INST := install -m 644 |
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | tar: $(PACK) $(OPTS) $(DEPS) -t $@ -p "$(NAME)-VERSION.bin.txz" st2.py exe: $(PACK) $(OPTS) $(DEPS) -t $@ -p "$(NAME)-VERSION.exe" st2.py pyz: #@BUG: relative package references leave a /tmp/doc/ folder $(PACK) -u packfile -s src -t zip --zip-shebang "/usr/bin/env python" \ |
︙ |
Modified action.py from [f8a0134421] to [fc5074bffb].
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + | import os from ahttp import fix_url as http_fix_url, session from config import conf, __print__ as debug, dbg import platform import copy import json from datetime import datetime from xml.sax.saxutils import escape as xmlentities, unescape as xmlunescape # Coupling to main window # main = None |
︙ | |||
96 97 98 99 100 101 102 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - + + | ("asx" , r""" <asx\b """), ("smil", r""" <smil[^>]*> .* <seq> """), ("html", r""" (?i)<(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+= """), |
︙ | |||
231 232 233 234 235 236 237 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - + | 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 |
︙ | |||
295 296 297 298 299 300 301 | 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 | + - + + + + + + + + + | src = "" def __init__(self, text): self.src = text # Extract only URLs from given source type def format(self, fmt): debug(dbg.DATA, "input regex:", fmt, len(self.src)) # regex |
︙ | |||
356 357 358 359 360 361 362 363 364 365 366 367 368 369 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | + | # Expand contained stream urls if not self.source in ("srv", "raw", "asis"): new_rows = [] for i,row in enumerate(rows): # Preferrably convert to direct server addresses for url in convert_playlist(row["url"], self.source, "srv", local_file=False): row = dict(row.items()) row["url"] = url new_rows.append(row) # Or just allow one stream per station in a playlist entry if not self.multiply: break rows = new_rows |
︙ | |||
439 440 441 442 443 444 445 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | - - - - - - - | for row in rows: if row.get("url"): txt += """\t\t<audio src="%s"/>\n""" % row["url"] txt += """\t</seq>\n</body>\n</smil>\n""" return txt |
︙ |
Modified channels/jamendo.py from [55defe1856] to [13bc7ee950].
︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | + | # Seem to resolve to OGG Vorbis each. # class jamendo (ChannelPlugin): # control flags has_search = True base = "http://www.jamendo.com/en/" audioformat = "ogg" listformat = "srv" api_base = "http://api.jamendo.com/v3.0/" cid = "49daa4f5" categories = [] titles = dict( title="Title", playing="Album/Artist/User", bitrate=False, listeners=False ) |
︙ | |||
256 257 258 259 260 261 262 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 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 | - + - + - + - - - + + + + + + + + + + - + + | # retrieve category or search def update_streams(self, cat, search=None): entries = [] fmt = self.stream_mime(conf.jamendo_stream_format) |
︙ | |||
321 322 323 324 325 326 327 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + + | "extra": ", ".join(e["musicinfo"]["tags"]["vartags"]), "title": e["name"], "playing": e["album_name"] + " / " + e["artist_name"], "img": e["album_image"], "homepage": e["shareurl"], #"url": e["audio"], "url": "http://storage-new.newjamendo.com/?trackid=%s&format=ogg2&u=0&from=app-%s" % (e["id"], self.cid), |
︙ | |||
361 362 363 364 365 366 367 | 371 372 373 374 375 376 377 378 379 | - - + - - | # audio/* def stream_mime(self, name): map = { "ogg": "audio/ogg", "ogg2": "audio/ogg", "mp3": "audio/mpeg", "mp31": "audio/mpeg", "mp32": "audio/mpeg", "flac": "audio/flac" } |