Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Artifact [ada8ea7ce2]

Artifact ada8ea7ce243e93cc9e16c4186a30ea5cd4ce410:

Wiki page [api-action] by mario on 2017-02-20 15:12:47.
D 2017-02-20T15:12:47.055
L api-action
N text/html
P bb498d2167d02841db55fa73f46951df8972abe6
U mario
W 24543

<html><head><title>Python: module action</title>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>action</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="streamtuner2/action.py">/home/mario/projects/streamtuner2/action.py</a></font></td></tr></table>
    <p><tt>#&nbsp;encoding:&nbsp;UTF-8<br>
#&nbsp;api:&nbsp;streamtuner2<br>
#&nbsp;type:&nbsp;functions<br>
#&nbsp;category:&nbsp;io<br>
#&nbsp;title:&nbsp;play/record&nbsp;actions<br>
#&nbsp;description:&nbsp;Starts&nbsp;audio&nbsp;applications,&nbsp;guesses&nbsp;MIME&nbsp;types&nbsp;for&nbsp;URLs<br>
#&nbsp;version:&nbsp;1.2.1<br>
#&nbsp;priority:&nbsp;core<br>
#<br>
#&nbsp;Multimedia&nbsp;interface&nbsp;for&nbsp;starting&nbsp;audio&nbsp;players,&nbsp;recording&nbsp;app,<br>
#&nbsp;or&nbsp;web&nbsp;browser&nbsp;(listed&nbsp;as&nbsp;"url/http"&nbsp;association&nbsp;in&nbsp;players).<br>
#&nbsp;It&nbsp;maps&nbsp;audio&nbsp;MIME&nbsp;types,&nbsp;and&nbsp;extracts/converts&nbsp;playlist&nbsp;types<br>
#&nbsp;(PLS,&nbsp;M3U,&nbsp;XSPF,&nbsp;SMIL,&nbsp;JSPF,&nbsp;ASX,&nbsp;raw&nbsp;urls).<br>
#<br>
#&nbsp;Each&nbsp;channel&nbsp;plugin&nbsp;has&nbsp;a&nbsp;.listtype&nbsp;which&nbsp;defines&nbsp;the&nbsp;linked<br>
#&nbsp;audio&nbsp;playlist&nbsp;format.&nbsp;It's&nbsp;"pls",&nbsp;seldomly&nbsp;"m3u",&nbsp;or&nbsp;"xspf".<br>
#&nbsp;Some&nbsp;channels&nbsp;list&nbsp;raw&nbsp;"srv"&nbsp;addresses,&nbsp;while&nbsp;Youtube&nbsp;"href"<br>
#&nbsp;entries&nbsp;point&nbsp;to&nbsp;Flash&nbsp;videos.<br>
#<br>
#&nbsp;As&nbsp;fallback&nbsp;the&nbsp;playlist&nbsp;URL&nbsp;is&nbsp;retrieved&nbsp;and&nbsp;its&nbsp;MIME&nbsp;type<br>
#&nbsp;checked,&nbsp;then&nbsp;its&nbsp;content&nbsp;regexped&nbsp;to&nbsp;guess&nbsp;the&nbsp;list&nbsp;format.<br>
#&nbsp;Lastly&nbsp;a&nbsp;playlist&nbsp;format&nbsp;suitable&nbsp;for&nbsp;audio&nbsp;players&nbsp;recreated.<br>
#&nbsp;Which&nbsp;is&nbsp;somewhat&nbsp;of&nbsp;a&nbsp;security&nbsp;feature;&nbsp;playlists&nbsp;get&nbsp;cleaned<br>
#&nbsp;up&nbsp;this&nbsp;way.&nbsp;The&nbsp;conversion&nbsp;is&nbsp;not&nbsp;strictly&nbsp;necessary,&nbsp;because<br>
#&nbsp;baseline&nbsp;PLS/M3U&nbsp;is&nbsp;understood&nbsp;by&nbsp;most&nbsp;players.<br>
#<br>
#&nbsp;And&nbsp;finally&nbsp;this&nbsp;module&nbsp;is&nbsp;also&nbsp;used&nbsp;by&nbsp;exporting&nbsp;and&nbsp;playlist<br>
#&nbsp;importing&nbsp;features&nbsp;(e.g.&nbsp;by&nbsp;the&nbsp;drag'n'drop&nbsp;module).<br>
#<br>
#&nbsp;Still&nbsp;needs&nbsp;some&nbsp;rewrites&nbsp;to&nbsp;transition&nbsp;off&nbsp;the&nbsp;[url]&nbsp;lists,<br>
#&nbsp;and&nbsp;work&nbsp;with&nbsp;full&nbsp;[rows]&nbsp;primarily.&nbsp;(And&nbsp;perhaps&nbsp;it&nbsp;should&nbsp;be<br>
#&nbsp;renamed&nbsp;to&nbsp;"playlist"&nbsp;module&nbsp;now).</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a
href="api-ahttp">ahttp</a><br>
<a href="https://docs.python.org/3/library/copy.html">copy</a><br>
<a href="https://docs.python.org/3/library/json.html">json</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="https://docs.python.org/3/library/pipes.html">pipes</a><br>
<a href="https://docs.python.org/3/library/platform.html">platform</a><br>
</td><td width="25%" valign=top><a href="re.html">re</a><br>
<a href="https://docs.python.org/3/library/subprocess.html">subprocess</a><br>
<a href="https://docs.python.org/3/library/sys.html">sys</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="action.html#extract_playlist">extract_playlist</a>
</font></dt><dt><font face="helvetica, arial"><a href="action.html#save_playlist">save_playlist</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="extract_playlist">class <strong>extract_playlist</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>#&nbsp;Extract&nbsp;URLs&nbsp;and&nbsp;meta&nbsp;infos&nbsp;(titles)&nbsp;from&nbsp;playlist&nbsp;formats<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;It's&nbsp;mostly&nbsp;regex-based&nbsp;at&nbsp;the&nbsp;moment,&nbsp;because&nbsp;that's&nbsp;more<br>
#&nbsp;resilient&nbsp;against&nbsp;mailformed&nbsp;XSPF&nbsp;or&nbsp;JSON.&nbsp;But&nbsp;specialized<br>
#&nbsp;import&nbsp;helpers&nbsp;can&nbsp;be&nbsp;added&nbsp;as&nbsp;needed.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="extract_playlist-__init__"><strong>__init__</strong></a>(self, text<font color="#909090">=None</font>, fn<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="extract_playlist-decode"><strong>decode</strong></a>(self, val, unesc)</dt><dd><tt>#&nbsp;String&nbsp;decoding</tt></dd></dl>

<dl><dt><a name="extract_playlist-field"><strong>field</strong></a>(self, name, rules, src_part)</dt><dd><tt>#&nbsp;Single&nbsp;field</tt></dd></dl>

<dl><dt><a name="extract_playlist-jamj"><strong>jamj</strong></a>(self)</dt><dd><tt>#&nbsp;Jamendo&nbsp;JAMJAMJSON&nbsp;playlists</tt></dd></dl>

<dl><dt><a name="extract_playlist-mime_guess"><strong>mime_guess</strong></a>(self, url)</dt><dd><tt>#&nbsp;Probe&nbsp;url&nbsp;"extensions"&nbsp;for&nbsp;common&nbsp;media&nbsp;types<br>
#&nbsp;(only&nbsp;care&nbsp;about&nbsp;the&nbsp;common&nbsp;audio&nbsp;formats,&nbsp;don't&nbsp;need&nbsp;an&nbsp;exact&nbsp;match&nbsp;or&nbsp;pre-probing&nbsp;in&nbsp;practice)</tt></dd></dl>

<dl><dt><a name="extract_playlist-mkrow"><strong>mkrow</strong></a>(self, row, title<font color="#909090">=None</font>)</dt><dd><tt>#&nbsp;Add&nbsp;placeholder&nbsp;fields&nbsp;to&nbsp;extracted&nbsp;row</tt></dd></dl>

<dl><dt><a name="extract_playlist-pls"><strong>pls</strong></a>(self)</dt><dd><tt>#&nbsp;More&nbsp;exact&nbsp;PLS&nbsp;extraction&nbsp;(for&nbsp;the&nbsp;unlikely&nbsp;case&nbsp;entries&nbsp;were&nbsp;misordered)</tt></dd></dl>

<dl><dt><a name="extract_playlist-probe_ext"><strong>probe_ext</strong></a>(self, url)</dt><dd><tt>#&nbsp;Test&nbsp;URL/path&nbsp;"extension"&nbsp;for&nbsp;".pls"&nbsp;/&nbsp;".m3u"&nbsp;etc.</tt></dd></dl>

<dl><dt><a name="extract_playlist-probe_fmt"><strong>probe_fmt</strong></a>(self)</dt><dd><tt>#&nbsp;Probe&nbsp;MIME&nbsp;type&nbsp;and&nbsp;content&nbsp;per&nbsp;regex</tt></dd></dl>

<dl><dt><a name="extract_playlist-rows"><strong>rows</strong></a>(self, fmt<font color="#909090">=None</font>)</dt><dd><tt>#&nbsp;Extract&nbsp;only&nbsp;URLs&nbsp;from&nbsp;given&nbsp;source&nbsp;type</tt></dd></dl>

<dl><dt><a name="extract_playlist-uniq"><strong>uniq</strong></a>(self, rows)</dt><dd><tt>#&nbsp;Filter&nbsp;out&nbsp;duplicate&nbsp;urls</tt></dd></dl>

<dl><dt><a name="extract_playlist-urls"><strong>urls</strong></a>(self, fmt)</dt><dd><tt>#&nbsp;Return&nbsp;just&nbsp;URL&nbsp;list&nbsp;from&nbsp;extracted&nbsp;playlist</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>extr_urls</strong> = {'asf': {'unesc': 'xml', 'url': r' (?m) ^ \s*Ref\d+ = (\w+://[^\s]+) '}, 'asx': {'split': ' (?ix) &lt;entry[^&gt;]*&gt; ', 'title': ' (?ix) &lt;title&gt; ([^&lt;&gt;]+) ', 'unesc': 'xml', 'url': ' (?ix) &lt;ref <font color="#c040c0">\\</font>b[^&gt;]+<font color="#c040c0">\\</font>b href <font color="#c040c0">\\</font>s*=<font color="#c040c0">\\</font>s* [<font color="#c040c0">\\\'\\</font>"] (<font color="#c040c0">\\</font>w+://[^<font color="#c040c0">\\</font>s<font color="#c040c0">\\</font>"<font color="#c040c0">\\\'</font>]+) [<font color="#c040c0">\\\'\\</font>"] '}, 'desktop': {'genre': '(?m) ^Categories=(.+)', 'playing': '(?m) ^Comment=(.+)', 'title': '(?m) ^Name=(.+)', 'url': r'(?m) ^URL=(\w+://.+)'}, 'jamj': {'unesc': 'json', 'url': r' (?x) \"audio\" \s*:\s* \"(\w+:\\?/\\?/[^\"\s]+)\" '}, 'json': {'genre': r' (?x) \"(?:genre|keywords|category)\" \s*:\s* \"([^\"]+)\" ', 'homepage': r' (?x) \"(?:homepage|website|info)\" \s*:\s* \"([^\"]+)\" ', 'playing': r' (?x) \"(?:playing|current|description)\" \s*:\s* \"([^\"]+)\" ', 'title': r' (?x) \"(?:title|name|station)\" \s*:\s* \"([^\"]+)\" ', 'unesc': 'json', 'url': r' (?x) \"(?:url|audio|stream)\" \s*:\s* \"(\w+:\\?/\\?/[^\"\s]+)\" '}, 'jspf': {'split': r'(?s) \"track\":\s*\{ &gt;', 'unesc': 'json', 'url': r'(?s) \"location\" \s*:\s* \"(\w+://[^\"\s]+)\" '}, 'm3u': {'split': r'(?m) (?=^\#)', 'title': r'(?m) ^ \#EXTINF [-:\d,]* (.+)', 'url': r'(?m) ^( \w+:// [^#\n]+ )'}, 'pls': {'title': r'(?m) ^Title\d* \s*=\s*(.+)', 'url': r'(?m) ^File\d* \s*=\s* (\w+://[^\s]+) '}, 'qtl': {'unesc': 'xml', 'url': ' &lt;embed<font color="#c040c0">\\</font>s+src=[<font color="#c040c0">\\</font>"<font color="#c040c0">\\\'</font>]([^<font color="#c040c0">\\</font>"<font color="#c040c0">\\\'</font>]+)[<font color="#c040c0">\\</font>"<font color="#c040c0">\\\'</font>]<font color="#c040c0">\\</font>s*/&gt;'}, 'raw': {'title': r'(?i)Title[\W]+(.+)', 'unesc': '*', 'url': ' (?i) ( [<font color="#c040c0">\\</font>w+]+:// [^<font color="#c040c0">\\</font>s<font color="#c040c0">\\</font>"<font color="#c040c0">\\\'\\</font>&gt;<font color="#c040c0">\\</font>#]+ ) '}, ...}</dl>

<dl><dt><strong>fn</strong> = ''</dl>

<dl><dt><strong>src</strong> = ''</dl>

</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="save_playlist">class <strong>save_playlist</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>#&nbsp;Save&nbsp;rows[]&nbsp;in&nbsp;one&nbsp;of&nbsp;the&nbsp;export&nbsp;formats<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;→&nbsp;The&nbsp;<a href="#save_playlist-export">export</a>()&nbsp;version&nbsp;uses&nbsp;urls[]&nbsp;and&nbsp;a&nbsp;template&nbsp;row{}&nbsp;as&nbsp;input,<br>
#&nbsp;converts&nbsp;it&nbsp;into&nbsp;a&nbsp;list&nbsp;of&nbsp;complete&nbsp;rows{}&nbsp;beforehand.&nbsp;It's&nbsp;mostly<br>
#&nbsp;utilized&nbsp;to&nbsp;expand&nbsp;a&nbsp;source&nbsp;playlist,&nbsp;merge&nbsp;in&nbsp;alternative&nbsp;streaming<br>
#&nbsp;server&nbsp;addresses.<br>
#<br>
#&nbsp;&nbsp;→&nbsp;With&nbsp;<a href="#save_playlist-store">store</a>()&nbsp;a&nbsp;full&nbsp;set&nbsp;of&nbsp;rows[]&nbsp;is&nbsp;required&nbsp;to&nbsp;begin&nbsp;with,&nbsp;as<br>
#&nbsp;it&nbsp;performs&nbsp;a&nbsp;complete&nbsp;serialization.&nbsp;&nbsp;Can&nbsp;save&nbsp;directly&nbsp;to&nbsp;a&nbsp;file.<br>
#&nbsp;Which&nbsp;is&nbsp;often&nbsp;used&nbsp;directly&nbsp;by&nbsp;export&nbsp;functions,&nbsp;when&nbsp;no&nbsp;internal<br>
#&nbsp;.pls/.m3u&nbsp;urls&nbsp;should&nbsp;be&nbsp;expanded&nbsp;or&nbsp;converted.<br>
#<br>
#&nbsp;Note&nbsp;that&nbsp;this&nbsp;can&nbsp;chain&nbsp;to&nbsp;<a href="#-convert_playlist">convert_playlist</a>()&nbsp;itself.&nbsp;So&nbsp;there's<br>
#&nbsp;some&nbsp;danger&nbsp;for&nbsp;neverending&nbsp;loops&nbsp;in&nbsp;here.&nbsp;Never&nbsp;happened,&nbsp;but&nbsp;some<br>
#&nbsp;careful&nbsp;source=&nbsp;and&nbsp;dest=&nbsp;parameter&nbsp;use&nbsp;is&nbsp;advised.&nbsp;Use&nbsp;source="asis"<br>
#&nbsp;or&nbsp;"srv"&nbsp;to&nbsp;leave&nbsp;addresses&nbsp;alone,&nbsp;or&nbsp;"href"&nbsp;for&nbsp;input&nbsp;probing.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="save_playlist-__init__"><strong>__init__</strong></a>(self, source<font color="#909090">='asis'</font>, multiply<font color="#909090">=False</font>)</dt><dd><tt>#&nbsp;constructor</tt></dd></dl>

<dl><dt><a name="save_playlist-asx"><strong>asx</strong></a>(self, rows)</dt><dd><tt>#&nbsp;ASX</tt></dd></dl>

<dl><dt><a name="save_playlist-desktop"><strong>desktop</strong></a>(self, rows)</dt><dd><tt>#&nbsp;.DESKTOP&nbsp;links</tt></dd></dl>

<dl><dt><a name="save_playlist-export"><strong>export</strong></a>(self, urls<font color="#909090">=[]</font>, row<font color="#909090">={}</font>, dest<font color="#909090">='pls'</font>, title<font color="#909090">=None</font>)</dt><dd><tt>#&nbsp;Used&nbsp;by&nbsp;playlist_convert(),&nbsp;to&nbsp;transform&nbsp;a&nbsp;list&nbsp;of&nbsp;extracted&nbsp;URLs<br>
#&nbsp;into&nbsp;a&nbsp;local&nbsp;.pls/.m3u&nbsp;collection&nbsp;again.&nbsp;Therefore&nbsp;injects&nbsp;the<br>
#&nbsp;`title`&nbsp;back&nbsp;into&nbsp;each&nbsp;of&nbsp;the&nbsp;URL&nbsp;rows&nbsp;/&nbsp;or&nbsp;uses&nbsp;row{}&nbsp;template.</tt></dd></dl>

<dl><dt><a name="save_playlist-file"><strong>file</strong></a>(self, rows, dest, fn)</dt><dd><tt>#&nbsp;save&nbsp;directly</tt></dd></dl>

<dl><dt><a name="save_playlist-json"><strong>json</strong></a>(self, rows)</dt><dd><tt>#&nbsp;JSON&nbsp;(native&nbsp;lists&nbsp;of&nbsp;streamtuner2)</tt></dd></dl>

<dl><dt><a name="save_playlist-jspf"><strong>jspf</strong></a>(self, rows)</dt><dd><tt>#&nbsp;JSPF</tt></dd></dl>

<dl><dt><a name="save_playlist-m3u"><strong>m3u</strong></a>(self, rows)</dt><dd><tt>#&nbsp;M3U</tt></dd></dl>

<dl><dt><a name="save_playlist-pls"><strong>pls</strong></a>(self, rows)</dt><dd><tt>#&nbsp;PLS</tt></dd></dl>

<dl><dt><a name="save_playlist-qtl"><strong>qtl</strong></a>(self, rows)</dt><dd><tt>#&nbsp;QTL</tt></dd></dl>

<dl><dt><a name="save_playlist-smil"><strong>smil</strong></a>(self, rows)</dt><dd><tt>#&nbsp;SMIL</tt></dd></dl>

<dl><dt><a name="save_playlist-store"><strong>store</strong></a>(self, rows<font color="#909090">=None</font>, dest<font color="#909090">='pls'</font>)</dt><dd><tt>#&nbsp;Export&nbsp;a&nbsp;playlist&nbsp;from&nbsp;rows{}</tt></dd></dl>

<dl><dt><a name="save_playlist-url"><strong>url</strong></a>(self, rows)</dt><dd><tt>#&nbsp;.URL&nbsp;shortcuts</tt></dd></dl>

<dl><dt><a name="save_playlist-xspf"><strong>xspf</strong></a>(self, rows)</dt><dd><tt>#&nbsp;XSPF</tt></dd></dl>

<dl><dt><a name="save_playlist-xspf_row"><strong>xspf_row</strong></a>(self, row, map)</dt><dd><tt>#&nbsp;individual&nbsp;tracks</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>multiply</strong> = True</dl>

<dl><dt><strong>source</strong> = 'pls'</dl>

<dl><dt><strong>xspf_map</strong> = {'description': 'info', 'homepage': 'info', 'playing': 'annotation', 'title': 'title', 'url': 'location'}</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-browser"><strong>browser</strong></a>(url)</dt><dd><tt>#&nbsp;Start&nbsp;web&nbsp;browser</tt></dd></dl>
 <dl><dt><a name="-cleanup_tmp_files"><strong>cleanup_tmp_files</strong></a>()</dt><dd><tt>#&nbsp;Callback&nbsp;from&nbsp;main&nbsp;/&nbsp;after&nbsp;gtk_main_quit</tt></dd></dl>
 <dl><dt><a name="-convert_playlist"><strong>convert_playlist</strong></a>(url, source, dest, local_file<font color="#909090">=True</font>, row<font color="#909090">={}</font>)</dt><dd><tt>#&nbsp;Substitute&nbsp;streaming&nbsp;address&nbsp;with&nbsp;desired&nbsp;playlist&nbsp;format<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;Converts&nbsp;input&nbsp;rows/urls,&nbsp;probes&nbsp;for&nbsp;playlist&nbsp;format,&nbsp;fetches&nbsp;them<br>
#&nbsp;and&nbsp;possibly&nbsp;converts&nbsp;remote&nbsp;.pls&nbsp;to&nbsp;local&nbsp;.m3u/.xpsf&nbsp;filename&nbsp;or<br>
#&nbsp;just&nbsp;returns&nbsp;direct&nbsp;"srv"&nbsp;urls.<br>
#<br>
#&nbsp;&nbsp;·&nbsp;Takes&nbsp;a&nbsp;single&nbsp;input&nbsp;`url`&nbsp;(and&nbsp;original&nbsp;row{}&nbsp;as&nbsp;template).<br>
#&nbsp;&nbsp;·&nbsp;But&nbsp;returns&nbsp;a&nbsp;list&nbsp;of&nbsp;[urls]&nbsp;after&nbsp;playlist&nbsp;extraction.<br>
#&nbsp;&nbsp;·&nbsp;If&nbsp;repackaging&nbsp;as&nbsp;.m3u/.pls/.xspf,&nbsp;returns&nbsp;the&nbsp;local&nbsp;[fn].</tt></dd></dl>
 <dl><dt><a name="-help"><strong>help</strong></a>(*args)</dt><dd><tt>#&nbsp;Open&nbsp;help&nbsp;browser,&nbsp;chm,&nbsp;or&nbsp;streamtuner2&nbsp;pages</tt></dd></dl>
 <dl><dt><a name="-http_probe_get"><strong>http_probe_get</strong></a>(url)</dt><dd><tt>#&nbsp;Tries&nbsp;to&nbsp;fetch&nbsp;a&nbsp;resource,&nbsp;aborts&nbsp;on&nbsp;ICY&nbsp;responses.</tt></dd></dl>
 <dl><dt><a name="-interpol"><strong>interpol</strong></a>(cmd, source<font color="#909090">='pls'</font>, row<font color="#909090">={}</font>, add_default<font color="#909090">=True</font>)</dt><dd><tt>#&nbsp;Replaces&nbsp;instances&nbsp;of&nbsp;%m3u,&nbsp;%pls,&nbsp;%srv&nbsp;in&nbsp;a&nbsp;command&nbsp;string<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;·&nbsp;Also&nbsp;understands&nbsp;short&nbsp;aliases&nbsp;%l,&nbsp;%f,&nbsp;%d.<br>
#&nbsp;&nbsp;·&nbsp;And&nbsp;can&nbsp;embed&nbsp;%title&nbsp;or&nbsp;$genre&nbsp;placeholders&nbsp;(may&nbsp;use&nbsp;either&nbsp;%&nbsp;or&nbsp;$).<br>
#&nbsp;&nbsp;·&nbsp;Replace&nbsp;.pls&nbsp;URL&nbsp;with&nbsp;local&nbsp;.m3u&nbsp;file&nbsp;depending&nbsp;on&nbsp;map.</tt></dd></dl>
 <dl><dt><a name="-listfmt"><strong>listfmt</strong></a>(t<font color="#909090">='pls'</font>)</dt><dd><tt>#&nbsp;Convert&nbsp;e.g.&nbsp;"text/x-scpls"&nbsp;MIME&nbsp;types&nbsp;to&nbsp;just&nbsp;"pls"&nbsp;monikers</tt></dd></dl>
 <dl><dt><a name="-mime_app"><strong>mime_app</strong></a>(fmt, cmd_list)</dt><dd><tt>#&nbsp;Convert&nbsp;MIME&nbsp;type&nbsp;into&nbsp;list&nbsp;of&nbsp;["audio/xyz",&nbsp;"audio/*",&nbsp;"*/*"]<br>
#&nbsp;for&nbsp;comparison&nbsp;against&nbsp;configured&nbsp;record/play&nbsp;association.</tt></dd></dl>
 <dl><dt><a name="-play"><strong>play</strong></a>(row<font color="#909090">={}</font>, audioformat<font color="#909090">='audio/mpeg'</font>, source<font color="#909090">='pls'</font>)</dt><dd><tt>#&nbsp;Calls&nbsp;player&nbsp;for&nbsp;stream&nbsp;url&nbsp;and&nbsp;format</tt></dd></dl>
 <dl><dt><a name="-quote"><strong>quote</strong></a>(ins)</dt><dd><tt>#&nbsp;OS&nbsp;shell&nbsp;command&nbsp;escaping</tt></dd></dl>
 <dl><dt><a name="-record"><strong>record</strong></a>(row<font color="#909090">={}</font>, audioformat<font color="#909090">='audio/mpeg'</font>, source<font color="#909090">='href'</font>, append<font color="#909090">=None</font>)</dt><dd><tt>#&nbsp;Call&nbsp;streamripper&nbsp;/&nbsp;youtube-dl&nbsp;/&nbsp;wget</tt></dd></dl>
 <dl><dt><a name="-resolve_urn"><strong>resolve_urn</strong></a>(row)</dt><dd><tt>#&nbsp;Is&nbsp;called&nbsp;upon&nbsp;rows&nbsp;containing&nbsp;an&nbsp;url&nbsp;starting&nbsp;with&nbsp;"urn:service:#id",<br>
#&nbsp;calls&nbsp;the&nbsp;handler&nbsp;from&nbsp;the&nbsp;channel&nbsp;plugin&nbsp;to&nbsp;look&nbsp;up&nbsp;the&nbsp;page&nbsp;and&nbsp;find<br>
#&nbsp;the&nbsp;actual&nbsp;streaming&nbsp;url</tt></dd></dl>
 <dl><dt><a name="-run"><strong>run</strong></a>(cmd)</dt><dd><tt>#&nbsp;Exec&nbsp;wrapper</tt></dd></dl>
 <dl><dt><a name="-run_fmt_url"><strong>run_fmt_url</strong></a>(row<font color="#909090">={}</font>, audioformat<font color="#909090">='audio/mpeg'</font>, source<font color="#909090">='pls'</font>, assoc<font color="#909090">={}</font>, append<font color="#909090">=None</font>, cmd<font color="#909090">=None</font>, add_default<font color="#909090">=True</font>)</dt><dd><tt>#&nbsp;Invokes&nbsp;player/recorder&nbsp;for&nbsp;stream&nbsp;url&nbsp;and&nbsp;format</tt></dd></dl>
 <dl><dt><a name="-tmp_fn"><strong>tmp_fn</strong></a>(row, ext<font color="#909090">='pls'</font>)</dt><dd><tt>#&nbsp;Generate&nbsp;filename&nbsp;for&nbsp;temporary&nbsp;.pls/m3u,&nbsp;with&nbsp;unique&nbsp;id</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>conf</strong> = {u'filter_walledgardens': True, u'radionomy_page...e/mario/.config/streamtuner2', u'history': u'20'}<br>
<strong>handler</strong> = {}<br>
<strong>listfmt_t</strong> = {'*/*': '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', ...}<br>
<strong>log</strong> = &lt;config.log_printer object&gt;<br>
<strong>main</strong> = None<br>
<strong>mediafmt_t</strong> = {'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'}<br>
<strong>placeholder_map</strong> = {'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)'}<br>
<strong>playlist_content_map</strong> = [('pls', r' (?i)\[playlist\].*NumberOfEntries '), ('xspf', r' &lt;\?xml .* &lt;playlist .* ((?i)http://xspf\.org)/ns/0/ '), ('m3u', r' ^ \s* \#(EXT)?M3U '), ('asx', r' (?i) &lt;asx\b '), ('smil', ' &lt;smil[^&gt;]*&gt; .* &lt;seq&gt; '), ('html', ' (?i)&lt;(audio|video)<font color="#c040c0">\\</font>b[^&gt;]+<font color="#c040c0">\\</font>bsrc<font color="#c040c0">\\</font>s*=<font color="#c040c0">\\</font>s*["<font color="#c040c0">\'</font>]?https?:// '), ('wpl', r' &lt;\?wpl \s+ version="1\.0" \s* \?&gt; '), ('b4s', ' &lt;WinampXML&gt; '), ('qtl', r' &lt;?quicktime\d+type="application/x-quicktime-media-link"\d*?&gt; '), ('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', ' .* ')]<br>
<strong>playlist_fmt_prio</strong> = ['pls', 'xspf', 'asx', 'smil', 'jamj', 'json', 'm3u', 'asf', 'raw']<br>
<strong>tmp_files</strong> = []</td></tr></table>

Z 1417ca1a97f21ff15cc5eda04e1ed5b4