10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 | <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>
<p><code type="text/python">
from channels import *
class myplugin (ChannelPlugin):
title = "MyNewChannel"
module = "myplugin" |
|
| 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 | <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" |
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 |
# ...
# get it from somewhere
# ...
return entries
</code></p>
<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> |
|
| 39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 |
# ...
# 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> |