streamtuner2: api-st2
Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


api-st2

 
 
st2

index
streamtuner2/st2.py

# encoding: UTF-8
# api: python
# type: application
# title: streamtuner2
# description: Directory browser for internet radio, audio and video streams
# version: 2.2.0
# state: stable
# author: Mario Salzer <mario@include-once.org>
# license: Public Domain
# url: http://freshcode.club/projects/streamtuner2
# config:  
#   { type: env, name: HTTP_PROXY, description: proxy for HTTP access }
#   { type: env, name: XDG_CONFIG_HOME, description: relocates user .config subdirectory }
# category: sound
# depends: pygtk | gi, threading, requests, pyquery, lxml
# alias: streamtuner2, main
# id: st2
# pack: *.py, gtk3.xml.gz, bin, channels/__init__.py, bundle/*.py, CREDITS, help/index.page,
#   streamtuner2.desktop, README, help/streamtuner2.1=/usr/share/man/man1/,
#   NEWS=/usr/share/doc/streamtuner2/, icon.png=/usr/share/pixmaps/streamtuner2.png
# architecture: all
#
# Streamtuner2 is a GUI for browsing internet radio directories,
# music collections, and video services - grouped by genres or
# categories. It runs your preferred audio player or streamripper
# for recording.
#
# It's an independent rewrite of streamtuner1. Being written in
# Python, can be more easily extended and fixed. The mix of
# JSON APIs, regex or PyQuery extraction simplifies collecting
# station lists.
#
# Primarily radio stations are displayed, some channels however
# are music collections. Commercial and sign-up services are not
# an objective.

 
Modules

      

 
action
ahttp
channels
cookielib
gobject
gtk
inspect
logo
os
pygtk
re
sys
time
traceback
urllib
urllib2
urlparse

 
Classes

      

 
gtk.Builder(gobject._gobject.GObject)
StreamTunerTwo

 
class StreamTunerTwo(gtk.Builder)

   

# This represents the main window, dispatches Gtk events,
# and shares most application behaviour with the channel modules.
 
 
Method resolution order:
StreamTunerTwo
gtk.Builder
gobject._gobject.GObject
__builtin__.object

Methods defined here:
__getattr__(self, name)
#-- Shortcut for glade.get_widget()
# Allows access to widgets as direct attributes instead of using .get_widget()
# Also looks in self.channels[] for the named channel plugins
__init__(self)
# constructor
bookmark(self, widget)
# Add current selection to bookmark store
channel(self)
# Returns the currently selected directory/channel object (remembered position)
channel_switch(self, notebook, page, page_num=0, *args)
# Notebook tab has been clicked (receives numeric page_num), but *NOT* yet changed (visually).
channel_switch_by_name(self, name)
# Invoked from the menu instead, uses module name instead of numeric tab id
current_channel_gtk(self)
# Returns the currently selected directory/channel object (from gtk)
delete_entry(self, w)
# Remove a stream entry
get_widget(self, name)
# Custom-named widgets are available from .widgets{} not via .get_widget()
gtk_main_quit(self, widget, *x)
# end application and gtk+ main loop
init_app_state(self)
# load application state (widget sizes, selections, etc.)
load_plugin_channels(self)
# load plugins from /usr/share/streamtuner2/channels/
logo_scale(self, r=1.0, map=None)
# Redraw logo
menu_copy(self, w)
# Save current stream URL into clipboard
on_category_clicked(self, widget, event, *more)
# Click in category list
on_homepage_channel_clicked(self, widget, event=2)
# Browse to channel homepage (@BROKEN: double click on notebook tab)
on_homepage_stream_clicked(self, widget)
# Open stream homepage in web browser
on_play_clicked(self, widget, event=None, *args)
# Play button
on_record_clicked(self, widget)
# Recording: invoke streamripper for current stream URL
on_reload_clicked(self, widget=None, reload=1)
# Reload stream list in current channel-category
row(self)
# Channel: row{} dict for current station
save_app_state(self, widget)
# store window/widget states (sizes, selections, etc.)
save_as(self, widget)
# Save stream to file (.m3u)
selected(self, name='url')
# Channel: fetch single varname from station row{} dict
station_context_menu(self, treeview, event)
# Right clicking a stream/station in the treeview to make context menu pop out.
status(self, text=None, timeout=3, markup=False, icon=None, *k, **kw)
# Shortcut to statusbar and progressbar (receives either a string, or a float).
status_clear(self, anyway=False)
# Clean up after 3 seconds
switch_notebook_tabs_position(self, w, pos)
# Change notebook channel tabs between TOP and LEFT position
thread(self, target, *args, **kwargs)
# Run function in separate thread.
# Often used in conjunction with uikit.do() for Gtk interactions.
update_categories(self, widget)
# Reload category tree
update_favicons(self, widget)
# Menu invocation: refresh favicons for all stations in current streams category
update_title(self, *x, **y)
# Mirror selected channel tab into main window title

Data descriptors defined here:

channel_names

Data and other attributes defined here:
channels = {}
current_channel = 'bookmarks'
features = {}
hooks = {'config_load': [], 'config_save': [], 'init': [], 'play': [], 'quit': <function cleanup_tmp_files>, 'record': [], 'switch': []}
meta = {'alias': 'streamtuner2, main', 'api': 'python', 'architecture': 'all', 'author': 'Mario Salzer <mario@include-once.org>', '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}]{'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\nan objective.', 'encoding': 'UTF-8', ...}
widgets = {}

 
Functions

      

 
main()
# startup procedure

 
Data

      

  PY2 = 1
PY3 = 0
conf = {u'filter_walledgardens': True, u'radionomy_page...e/mario/.config/streamtuner2', u'history': u'20'}
log = <config.log_printer object>
ui_xml = u'<?xml version="1.0" encoding="UTF-8"?>\n<!-- Gene... </object>\n </child>\n </object>\n</interface>\n'