1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<page xmlns="http://projectmallard.org/1.0/"
type="guide"
id="extending">
<info>
<link type="guide" xref="index#advanced"/>
<desc>Writing your own channel plugins.</desc>
</info>
<title>Extension Howto</title>
<p>Streamtuner2 is written in Python, a rather easy programming language. And it's also rather simple
to write a new channel plugin.</p>
<p>The basic layout of every channel plugin is as follows:</p>
<code type="text/python">
from channels import *
class myplugin (ChannelPlugin):
title = "MyNewChannel"
module = "myplugin"
homepage = "http://www.mymusicstation.com/"
categories = []
def update_categories(self):
self.categories = []
def update_streams(self, cat, force=0):
entries = []
# ...
# get it from somewhere
# ...
return entries
</code>
<p>There are some self-explanatory description fields, and two important methods. Sometimes you
don't need categories even. The update_streams() function often downloads a website, parses it
with regular expressions or PyQuery / DOM methods, and packs into into a result list.</p>
<p>Here entries is a list of dictionaries, with standardized entry names like "title" and "playing"
for the description, and "homepage" for a browsable link, and most importantly "url" for the
actual streaming link. Often you want to add a "genre" and "format" and "bitrate" info. But this depends
on your plugins data source, really.</p>
</page>
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|