<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="streamtuner2/action.py">
    <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>

<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,

<tr><td
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a
href="api-ahttp">ahttp</a><br>
<a
<a
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a
<a
</td><td width="25%" valign=top><a href="re.html">re</a><br>
<a
<a
</td><td width="25%"
<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,

<tr><td
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>

<dl>
<dt><font face="helvetica, arial"><a href="action.html#extract_playlist">extract_playlist</a>
face="helvetica, arial"><a href="action.html#save_playlist">save_playlist</a>

</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

<tr bgcolor="#ffc8d8"><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>

<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a text<font color="#909090">=None</font>, fn<font

<dl><dt><a val,

<dl><dt><a name, rules,

<dl><dt><a

<dl><dt><a url)</dt><dd><tt>#&nbsp;Probe&nbsp;url&nbsp;"extensions"&nbsp;for&nbsp;common&nbsp;media&nbsp;types<br>


<dl><dt><a row, title<font

<dl><dt><a

<dl><dt><a

<dl><dt><a

<dl><dt><a fmt<font

<dl><dt><a

<dl><dt><a

<hr>
Data descriptors defined here:<br>


</dl>


</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>extr_urls</strong> = {'asf': {'unesc': 'xml', 'url': r' (?m) ^ = '}, 'asx': {'split': ' (?ix) &lt;entry[^&gt;]*&gt; ', 'title': ' (?ix) &lt;title&gt; ([^&lt;&gt;]+) ', 'unesc': 'xml', 'url': ' (?ix) &lt;ref <font href <font [<font (<font [<font '}, 'desktop': {'genre': '(?m) ^Categories=(.+)', 'playing': '(?m) ^Comment=(.+)', 'title': '(?m) ^Name=(.+)', 'url': r'(?m) 'jamj': {'unesc': 'json', 'url': r' (?x) '}, 'json': {'genre': r' (?x) ', 'homepage': r' (?x) ', 'playing': r' (?x) ', 'title': r' (?x) ', 'unesc': 'json', 'url': r' (?x) '}, 'jspf': {'split': r'(?s) &gt;', 'unesc': 'json', 'url': r'(?s) '}, 'm3u': {'split': r'(?m) (?=^\#)', 'title': r'(?m) ^ \#EXTINF [-:\d,]* (.+)', 'url': r'(?m) ^( [^#\n]+ )'}, 'pls': {'title': r'(?m) ^Title\d* 'url': r'(?m) ^File\d* '}, 'qtl': {'unesc': 'xml', 'url': ' &lt;embed<font 'raw': {'title': r'(?i)Title[\W]+(.+)', 'unesc': '*', 'url': ' (?i) ( [<font [^<font ) '}, ...}</dl>

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

<dl><dt><strong>src</strong> = ''</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="save_playlist">class

<tr bgcolor="#ffc8d8"><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>

<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a source<font color="#909090">='asis'</font>, multiply<font

<dl><dt><a

<dl><dt><a

<dl><dt><a urls<font color="#909090">=[]</font>, row<font color="#909090">={}</font>, dest<font color="#909090">='pls'</font>, title<font
#&nbsp;into&nbsp;a&nbsp;local&nbsp;.pls/.m3u&nbsp;collection&nbsp;again.&nbsp;Therefore&nbsp;injects&nbsp;the<br>


<dl><dt><a rows, dest,

<dl><dt><a

<dl><dt><a

<dl><dt><a

<dl><dt><a

<dl><dt><a

<dl><dt><a

<dl><dt><a rows<font color="#909090">=None</font>, dest<font

<dl><dt><a

<dl><dt><a

<dl><dt><a row,

<hr>
Data descriptors defined here:<br>


</dl>


</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>


<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,

<tr><td
<td width="100%"><dl><dt><a
 <dl><dt><a
 <dl><dt><a source, dest, local_file<font color="#909090">=True</font>, row<font
#&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>

 <dl><dt><a
 <dl><dt><a
 <dl><dt><a source<font color="#909090">='pls'</font>, row<font color="#909090">={}</font>, add_default<font
#&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>

 <dl><dt><a
 <dl><dt><a

 <dl><dt><a color="#909090">={}</font>, audioformat<font source<font
 <dl><dt><a
 <dl><dt><a color="#909090">={}</font>, audioformat<font source<font color="#909090">='href'</font>, append<font
 <dl><dt><a
#&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>

 <dl><dt><a
 <dl><dt><a color="#909090">={}</font>, audioformat<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
 <dl><dt><a ext<font

<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,

<tr><td
<td width="100%"><strong>conf</strong> = {u'filter_walledgardens': True, 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' '), ('xspf', r' &lt;\?xml .* &lt;playlist .* '), ('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 '), ('wpl', r' &lt;\?wpl \s+ version="1\.0" \s* \?&gt; '), ('b4s', ' &lt;WinampXML&gt; '), ('qtl', r' '), ('jspf', r' ^ \s* \{ \s* "playlist": \s* \{ '), ('asf', r' ^ .*? ^Ref\d+= '), ('url', r' ^ .*? ^URL= '), ('desktop', r' ^ \[Desktop Entry\] .*? ^Link= '), ('json', r' "url": \s* '), ('jamj', r' "audio": \s* '), ('gvp', r' '), ('href', ' .* ')]<br>
<strong>playlist_fmt_prio</strong> = ['pls', 'xspf', 'asx', 'smil', 'jamj', 'json', 'm3u', 'asf', 'raw']<br>
<strong>tmp_files</strong> =