12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 | <div class="body">
<div class="hgroup"><h1 class="title"><span class="title">Extension Howto</span></h1></div>
<div class="region">
<div class="contents">
<p class="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 class="p">The basic layout of every channel plugin is as follows:</p>
<p class="p"><span class="code">
from channels import *
class myplugin (ChannelPlugin):
title = "MyNewChannel"
module = "myplugin"
homepage = "http://www.mymusicstation.com/" |
|
<
| 12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 | <div class="body">
<div class="hgroup"><h1 class="title"><span class="title">Extension Howto</span></h1></div>
<div class="region">
<div class="contents">
<p class="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 class="p">The basic layout of every channel plugin is as follows:</p>
<div class="code"><pre class="contents ">
from channels import *
class myplugin (ChannelPlugin):
title = "MyNewChannel"
module = "myplugin"
homepage = "http://www.mymusicstation.com/" |
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 |
# ...
# get it from somewhere
# ...
return entries
</span></p>
<p class="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 class="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> |
|
| 40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 |
# ...
# get it from somewhere
# ...
return entries
</pre></div>
<p class="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 class="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> |