Update of "api-action"
Artifact ID: | 2bd8d79419c353d7eafa845972268ad0c01ca492 |
---|---|
Page Name: | api-action |
Date: | 2017-02-20 15:14:17 |
Original User: | mario |
Parent: | 1cd9434ef4c2ec9343ab976c57a0e32db713fe84 (diff) |
Next | 8befbb868435c7899957d5e96ea0b358a7ba7e32 |
| index streamtuner2/action.py |
# encoding: UTF-8
# api: streamtuner2
# type: functions
# category: io
# title: play/record actions
# description: Starts audio applications, guesses MIME types for URLs
# version: 1.2.1
# priority: core
#
# Multimedia interface for starting audio players, recording app,
# or web browser (listed as "url/http" association in players).
# It maps audio MIME types, and extracts/converts playlist types
# (PLS, M3U, XSPF, SMIL, JSPF, ASX, raw urls).
#
# 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 point to Flash videos.
#
# As fallback the playlist URL is retrieved and its MIME type
# checked, then its content regexped to guess the list format.
# Lastly a playlist format suitable for audio players recreated.
# Which is somewhat of a security feature; playlists get cleaned
# up this way. The conversion is not strictly necessary, because
# baseline PLS/M3U is understood by most players.
#
# And finally this module is also used by exporting and playlist
# importing features (e.g. by the drag'n'drop module).
#
# Still needs some rewrites to transition off the url lists,
# and work with full rows primarily. (And perhaps it should be
# renamed to "playlist" module now).
Modules | ||||||
|
|
Classes | ||||||||||||||||||
|
|
Functions | ||
|
|
Data | ||
| conf = {u'filter_walledgardens': True, u'radionomy_page...e/mario/.config/streamtuner2', u'history': u'20'} handler = {} listfmt_t = {'*/*': 'href', 'application/json': 'json', 'application/smil': 'smil', 'application/vnd.apple.mpegurl': 'm3u', 'application/vnd.ms-wpl': 'smil', 'application/x-shockwave-flash': 'href', 'application/xspf+xml': 'xspf', 'audio/mpegurl': 'm3u', 'audio/x-mpegurl': 'm3u', 'audio/x-ms-wax': 'asx', ...} log = <config.log_printer object> main = None mediafmt_t = {'audio/aac': 'aac', 'audio/aacp': 'aac', 'audio/it+zip': 'mod', 'audio/midi': 'midi', 'audio/mod': 'mod', 'audio/mpeg': 'mp3', 'audio/ogg': 'ogg', 'audio/s3+zip': 'mod', 'audio/xm+zip': 'mod'} placeholder_map = {'asx': '(%asx)', 'jspf': '(%jspf | %j)', 'm3u': '(%m3u | %f | %g | %m)', 'pls': '(%url | %pls | %u | %l | %r)', 'smil': '(%smil)', 'srv': '(%srv | %d | %s)', 'xspf': '(%xspf | %xpsf | %x)'} playlist_content_map = ('pls', r' (?i)\[playlist\.*NumberOfEntries '), ('xspf', r' <\?xml .* <playlist .* ((?i)http://xspf\.org)/ns/0/ '), ('m3u', r' ^ \s* \#(EXT)?M3U '), ('asx', r' (?i) <asx\b '), ('smil', ' <smil^>*> .* <seq> '), ('html', ' (?i)<(audio|video)\\b^>+\\bsrc\\s*=\\s*"\'?https?:// '), ('wpl', r' <\?wpl \s+ version="1\.0" \s* \?> '), ('b4s', ' <WinampXML> '), ('qtl', r' <?quicktime\d+type="application/x-quicktime-media-link"\d*?> '), ('jspf', r' ^ \s* \{ \s* "playlist": \s* \{ '), ('asf', r' ^ \Reference\ .*? ^Ref\d+= '), ('url', r' ^ \InternetShortcut\ .*? ^URL= '), ('desktop', r' ^ \Desktop Entry\ .*? ^Link= '), ('json', r' "url": \s* "\w+:\\?/\\?/ '), ('jamj', r' "audio": \s* "\w+:\\?/\\?/ '), ('gvp', r' ^gvp_version:1\.\d+$ '), ('href', ' .* ')] playlist_fmt_prio = 'pls', 'xspf', 'asx', 'smil', 'jamj', 'json', 'm3u', 'asf', 'raw' tmp_files = [] |