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

⌈⌋ ⎇ branch:  streamtuner2


Update of "api-st2"

Overview

Artifact ID: 9e0c3390baca2bb38fe5d8bb88175b2e9869f894
Page Name:api-st2
Date: 2017-02-20 15:16:30
Original User: mario
Mimetype:text/html
Parent: 75312491e55daa471aa057c7621c7f5a35482e54 (diff)
Content

<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>st2</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="streamtuner2/st2.py"> streamtuner2/st2.py</a></font></td></tr></table>
    <p><tt>#&nbsp;encoding:&nbsp;UTF-8<br>
#&nbsp;api:&nbsp;python<br>
#&nbsp;type:&nbsp;application<br>
#&nbsp;title:&nbsp;streamtuner2<br>
#&nbsp;description:&nbsp;Directory&nbsp;browser&nbsp;for&nbsp;internet&nbsp;radio,&nbsp;audio&nbsp;and&nbsp;video&nbsp;streams<br>
#&nbsp;version:&nbsp;2.2.0<br>
#&nbsp;state:&nbsp;stable<br>
#&nbsp;author:&nbsp;Mario&nbsp;Salzer&nbsp;&lt;mario@include-once.org&gt;<br>
#&nbsp;license:&nbsp;Public&nbsp;Domain<br>
#&nbsp;url:&nbsp;<a href="http://freshcode.club/projects/streamtuner2">http://freshcode.club/projects/streamtuner2</a><br>
#&nbsp;config:&nbsp;&nbsp;<br>
#&nbsp;&nbsp;&nbsp;{&nbsp;type:&nbsp;env,&nbsp;name:&nbsp;HTTP_PROXY,&nbsp;description:&nbsp;proxy&nbsp;for&nbsp;HTTP&nbsp;access&nbsp;}<br>
#&nbsp;&nbsp;&nbsp;{&nbsp;type:&nbsp;env,&nbsp;name:&nbsp;XDG_CONFIG_HOME,&nbsp;description:&nbsp;relocates&nbsp;user&nbsp;.config&nbsp;subdirectory&nbsp;}<br>
#&nbsp;category:&nbsp;sound<br>
#&nbsp;depends:&nbsp;pygtk&nbsp;|&nbsp;gi,&nbsp;threading,&nbsp;requests,&nbsp;pyquery,&nbsp;lxml<br>
#&nbsp;alias:&nbsp;streamtuner2,&nbsp;main<br>
#&nbsp;id:&nbsp;st2<br>
#&nbsp;pack:&nbsp;*.py,&nbsp;gtk3.xml.gz,&nbsp;bin,&nbsp;channels/__init__.py,&nbsp;bundle/*.py,&nbsp;CREDITS,&nbsp;help/index.page,<br>
#&nbsp;&nbsp;&nbsp;streamtuner2.desktop,&nbsp;README,&nbsp;help/streamtuner2.1=/usr/share/man/man1/,<br>
#&nbsp;&nbsp;&nbsp;NEWS=/usr/share/doc/streamtuner2/,&nbsp;icon.png=/usr/share/pixmaps/streamtuner2.png<br>
#&nbsp;architecture:&nbsp;all<br>
#<br>
#&nbsp;Streamtuner2&nbsp;is&nbsp;a&nbsp;GUI&nbsp;for&nbsp;browsing&nbsp;internet&nbsp;radio&nbsp;directories,<br>
#&nbsp;music&nbsp;collections,&nbsp;and&nbsp;video&nbsp;services&nbsp;-&nbsp;grouped&nbsp;by&nbsp;genres&nbsp;or<br>
#&nbsp;categories.&nbsp;It&nbsp;runs&nbsp;your&nbsp;preferred&nbsp;audio&nbsp;player&nbsp;or&nbsp;streamripper<br>
#&nbsp;for&nbsp;recording.<br>
#<br>
#&nbsp;It's&nbsp;an&nbsp;independent&nbsp;rewrite&nbsp;of&nbsp;streamtuner1.&nbsp;Being&nbsp;written&nbsp;in<br>
#&nbsp;Python,&nbsp;can&nbsp;be&nbsp;more&nbsp;easily&nbsp;extended&nbsp;and&nbsp;fixed.&nbsp;The&nbsp;mix&nbsp;of<br>
#&nbsp;JSON&nbsp;APIs,&nbsp;regex&nbsp;or&nbsp;PyQuery&nbsp;extraction&nbsp;simplifies&nbsp;collecting<br>
#&nbsp;station&nbsp;lists.<br>
#<br>
#&nbsp;Primarily&nbsp;radio&nbsp;stations&nbsp;are&nbsp;displayed,&nbsp;some&nbsp;channels&nbsp;however<br>
#&nbsp;are&nbsp;music&nbsp;collections.&nbsp;Commercial&nbsp;and&nbsp;sign-up&nbsp;services&nbsp;are&nbsp;not<br>
#&nbsp;an&nbsp;objective.</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-action">action</a><br>
<a href="api-ahttp">ahttp</a><br>
<a href="api-channels">channels</a><br>
<a href="https://docs.python.org/3/library/cookielib.html">cookielib</a><br>
<a href="https://docs.python.org/3/library/gobject.html">gobject</a><br>
</td><td width="25%" valign=top><a href="https://docs.python.org/3/library/gtk.html">gtk</a><br>
<a href="https://docs.python.org/3/library/inspect.html">inspect</a><br>
<a href="api-logo">logo</a><br>
<a href="https://docs.python.org/3/library/os.html">os</a><br>
<a href="https://docs.python.org/3/library/pygtk.html">pygtk</a><br>
</td><td width="25%" valign=top><a href="re.html">re</a><br>
<a href="https://docs.python.org/3/library/sys.html">sys</a><br>
<a href="https://docs.python.org/3/library/time.html">time</a><br>
<a href="https://docs.python.org/3/library/traceback.html">traceback</a><br>
<a href="https://docs.python.org/3/library/urllib.html">urllib</a><br>
</td><td width="25%" valign=top><a href="https://docs.python.org/3/library/urllib2.html">urllib2</a><br>
<a href="https://docs.python.org/3/library/urlparse.html">urlparse</a><br>
</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="gtk.html#Builder">gtk.Builder</a>(<a href="gobject._gobject.html#GObject">gobject._gobject.GObject</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="#StreamTunerTwo">StreamTunerTwo</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="StreamTunerTwo">class <strong>StreamTunerTwo</strong></a>(<a href="gtk.html#Builder">gtk.Builder</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>#&nbsp;This&nbsp;represents&nbsp;the&nbsp;main&nbsp;window,&nbsp;dispatches&nbsp;Gtk&nbsp;events,<br>
#&nbsp;and&nbsp;shares&nbsp;most&nbsp;application&nbsp;behaviour&nbsp;with&nbsp;the&nbsp;channel&nbsp;modules.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="#StreamTunerTwo">StreamTunerTwo</a></dd>
<dd><a href="gtk.html#Builder">gtk.Builder</a></dd>
<dd><a href="gobject._gobject.html#GObject">gobject._gobject.GObject</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="StreamTunerTwo-__getattr__"><strong>__getattr__</strong></a>(self, name)</dt><dd><tt>#--&nbsp;Shortcut&nbsp;for&nbsp;glade.<a href="#StreamTunerTwo-get_widget">get_widget</a>()<br>
#&nbsp;Allows&nbsp;access&nbsp;to&nbsp;widgets&nbsp;as&nbsp;direct&nbsp;attributes&nbsp;instead&nbsp;of&nbsp;using&nbsp;.<a href="#StreamTunerTwo-get_widget">get_widget</a>()<br>
#&nbsp;Also&nbsp;looks&nbsp;in&nbsp;self.<strong>channels</strong>[]&nbsp;for&nbsp;the&nbsp;named&nbsp;channel&nbsp;plugins</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>#&nbsp;constructor</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-bookmark"><strong>bookmark</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Add&nbsp;current&nbsp;selection&nbsp;to&nbsp;bookmark&nbsp;store</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-channel"><strong>channel</strong></a>(self)</dt><dd><tt>#&nbsp;Returns&nbsp;the&nbsp;currently&nbsp;selected&nbsp;directory/channel&nbsp;object&nbsp;(remembered&nbsp;position)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-channel_switch"><strong>channel_switch</strong></a>(self, notebook, page, page_num<font color="#909090">=0</font>, *args)</dt><dd><tt>#&nbsp;Notebook&nbsp;tab&nbsp;has&nbsp;been&nbsp;clicked&nbsp;(receives&nbsp;numeric&nbsp;page_num),&nbsp;but&nbsp;*NOT*&nbsp;yet&nbsp;changed&nbsp;(visually).</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-channel_switch_by_name"><strong>channel_switch_by_name</strong></a>(self, name)</dt><dd><tt>#&nbsp;Invoked&nbsp;from&nbsp;the&nbsp;menu&nbsp;instead,&nbsp;uses&nbsp;module&nbsp;name&nbsp;instead&nbsp;of&nbsp;numeric&nbsp;tab&nbsp;id</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-current_channel_gtk"><strong>current_channel_gtk</strong></a>(self)</dt><dd><tt>#&nbsp;Returns&nbsp;the&nbsp;currently&nbsp;selected&nbsp;directory/channel&nbsp;object&nbsp;(from&nbsp;gtk)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-delete_entry"><strong>delete_entry</strong></a>(self, w)</dt><dd><tt>#&nbsp;Remove&nbsp;a&nbsp;stream&nbsp;entry</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-get_widget"><strong>get_widget</strong></a>(self, name)</dt><dd><tt>#&nbsp;Custom-named&nbsp;widgets&nbsp;are&nbsp;available&nbsp;from&nbsp;.widgets{}&nbsp;not&nbsp;via&nbsp;.<a href="#StreamTunerTwo-get_widget">get_widget</a>()</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-gtk_main_quit"><strong>gtk_main_quit</strong></a>(self, widget, *x)</dt><dd><tt>#&nbsp;end&nbsp;application&nbsp;and&nbsp;gtk+&nbsp;main&nbsp;loop</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-init_app_state"><strong>init_app_state</strong></a>(self)</dt><dd><tt>#&nbsp;load&nbsp;application&nbsp;state&nbsp;(widget&nbsp;sizes,&nbsp;selections,&nbsp;etc.)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-load_plugin_channels"><strong>load_plugin_channels</strong></a>(self)</dt><dd><tt>#&nbsp;load&nbsp;plugins&nbsp;from&nbsp;/usr/share/streamtuner2/channels/</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-logo_scale"><strong>logo_scale</strong></a>(self, r<font color="#909090">=1.0</font>, map<font color="#909090">=None</font>)</dt><dd><tt>#&nbsp;Redraw&nbsp;logo</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-menu_copy"><strong>menu_copy</strong></a>(self, w)</dt><dd><tt>#&nbsp;Save&nbsp;current&nbsp;stream&nbsp;URL&nbsp;into&nbsp;clipboard</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_category_clicked"><strong>on_category_clicked</strong></a>(self, widget, event, *more)</dt><dd><tt>#&nbsp;Click&nbsp;in&nbsp;category&nbsp;list</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_homepage_channel_clicked"><strong>on_homepage_channel_clicked</strong></a>(self, widget, event<font color="#909090">=2</font>)</dt><dd><tt>#&nbsp;Browse&nbsp;to&nbsp;channel&nbsp;homepage&nbsp;(@BROKEN:&nbsp;double&nbsp;click&nbsp;on&nbsp;notebook&nbsp;tab)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_homepage_stream_clicked"><strong>on_homepage_stream_clicked</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Open&nbsp;stream&nbsp;homepage&nbsp;in&nbsp;web&nbsp;browser</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_play_clicked"><strong>on_play_clicked</strong></a>(self, widget, event<font color="#909090">=None</font>, *args)</dt><dd><tt>#&nbsp;Play&nbsp;button</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_record_clicked"><strong>on_record_clicked</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Recording:&nbsp;invoke&nbsp;streamripper&nbsp;for&nbsp;current&nbsp;stream&nbsp;URL</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-on_reload_clicked"><strong>on_reload_clicked</strong></a>(self, widget<font color="#909090">=None</font>, reload<font color="#909090">=1</font>)</dt><dd><tt>#&nbsp;Reload&nbsp;stream&nbsp;list&nbsp;in&nbsp;current&nbsp;channel-category</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-row"><strong>row</strong></a>(self)</dt><dd><tt>#&nbsp;Channel:&nbsp;row{}&nbsp;dict&nbsp;for&nbsp;current&nbsp;station</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-save_app_state"><strong>save_app_state</strong></a>(self, widget)</dt><dd><tt>#&nbsp;store&nbsp;window/widget&nbsp;states&nbsp;(sizes,&nbsp;selections,&nbsp;etc.)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-save_as"><strong>save_as</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Save&nbsp;stream&nbsp;to&nbsp;file&nbsp;(.m3u)</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-selected"><strong>selected</strong></a>(self, name<font color="#909090">='url'</font>)</dt><dd><tt>#&nbsp;Channel:&nbsp;fetch&nbsp;single&nbsp;varname&nbsp;from&nbsp;station&nbsp;row{}&nbsp;dict</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-station_context_menu"><strong>station_context_menu</strong></a>(self, treeview, event)</dt><dd><tt>#&nbsp;Right&nbsp;clicking&nbsp;a&nbsp;stream/station&nbsp;in&nbsp;the&nbsp;treeview&nbsp;to&nbsp;make&nbsp;context&nbsp;menu&nbsp;pop&nbsp;out.</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-status"><strong>status</strong></a>(self, text<font color="#909090">=None</font>, timeout<font color="#909090">=3</font>, markup<font color="#909090">=False</font>, icon<font color="#909090">=None</font>, *k, **kw)</dt><dd><tt>#&nbsp;Shortcut&nbsp;to&nbsp;statusbar&nbsp;and&nbsp;progressbar&nbsp;(receives&nbsp;either&nbsp;a&nbsp;string,&nbsp;or&nbsp;a&nbsp;float).</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-status_clear"><strong>status_clear</strong></a>(self, anyway<font color="#909090">=False</font>)</dt><dd><tt>#&nbsp;Clean&nbsp;up&nbsp;after&nbsp;3&nbsp;seconds</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-switch_notebook_tabs_position"><strong>switch_notebook_tabs_position</strong></a>(self, w, pos)</dt><dd><tt>#&nbsp;Change&nbsp;notebook&nbsp;channel&nbsp;tabs&nbsp;between&nbsp;TOP&nbsp;and&nbsp;LEFT&nbsp;position</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-thread"><strong>thread</strong></a>(self, target, *args, **kwargs)</dt><dd><tt>#&nbsp;Run&nbsp;function&nbsp;in&nbsp;separate&nbsp;thread.<br>
#&nbsp;Often&nbsp;used&nbsp;in&nbsp;conjunction&nbsp;with&nbsp;uikit.do()&nbsp;for&nbsp;Gtk&nbsp;interactions.</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-update_categories"><strong>update_categories</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Reload&nbsp;category&nbsp;tree</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-update_favicons"><strong>update_favicons</strong></a>(self, widget)</dt><dd><tt>#&nbsp;Menu&nbsp;invocation:&nbsp;refresh&nbsp;favicons&nbsp;for&nbsp;all&nbsp;stations&nbsp;in&nbsp;current&nbsp;streams&nbsp;category</tt></dd></dl>

<dl><dt><a name="StreamTunerTwo-update_title"><strong>update_title</strong></a>(self, *x, **y)</dt><dd><tt>#&nbsp;Mirror&nbsp;selected&nbsp;channel&nbsp;tab&nbsp;into&nbsp;main&nbsp;window&nbsp;title</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>channel_names</strong></dt>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>channels</strong> = {}</dl>

<dl><dt><strong>current_channel</strong> = 'bookmarks'</dl>

<dl><dt><strong>features</strong> = {}</dl>

<dl><dt><strong>hooks</strong> = {'config_load': [], 'config_save': [], 'init': [], 'play': [], 'quit': [&lt;function cleanup_tmp_files&gt;], 'record': [], 'switch': []}</dl>

<dl><dt><strong>meta</strong> = {'alias': 'streamtuner2, main', 'api': 'python', 'architecture': 'all', 'author': 'Mario Salzer &lt;mario@include-once.org&gt;', 'category': 'sound', 'config': [{'description': 'proxy for HTTP access', 'name': 'HTTP_PROXY', 'type': 'env', 'value': None}, {'description': 'relocates user .config subdirectory', 'name': 'XDG_CONFIG_HOME', 'type': 'env', 'value': None}], 'depends': 'pygtk | gi, threading, requests, pyquery, lxml', 'description': 'Directory browser for internet radio, audio and video streams', 'doc': 'Streamtuner2 is a GUI for browsing internet radi...ercial and sign-up services are not<font color="#c040c0">\n</font>an objective.', 'encoding': 'UTF-8', ...}</dl>

<dl><dt><strong>widgets</strong> = {}</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="-main"><strong>main</strong></a>()</dt><dd><tt>#&nbsp;startup&nbsp;procedure</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>PY2</strong> = 1<br>
<strong>PY3</strong> = 0<br>
<strong>conf</strong> = {u'filter_walledgardens': True, u'radionomy_page...e/mario/.config/streamtuner2', u'history': u'20'}<br>
<strong>log</strong> = &lt;config.log_printer object&gt;<br>
<strong>ui_xml</strong> = u'&lt;?xml version="1.0" encoding="UTF-8"?&gt;<font color="#c040c0">\n</font>&lt;!-- Gene... &lt;/object&gt;<font color="#c040c0">\n</font>    &lt;/child&gt;<font color="#c040c0">\n</font>  &lt;/object&gt;<font color="#c040c0">\n</font>&lt;/interface&gt;<font color="#c040c0">\n</font>'</td></tr></table>