| 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 | 
# api: streamtuner2# title: Bieber# description: Bieber music# url: http://www.justinbiebermusic.com/# version: 5.2# type: channel# category: example# config: #     { "name": "bieber_filter", "type": "text", "value": "BIEBERBLAST", "description": "So and so." }# priority: joke## This was an entertaining test plugin for development. (Compound function# went into the search feature, and the compound channel plugin obviously.)## It's however a very simple plugin, and hence a good basis for writing# your own extensions.from channels import *# Bieber music filter pluginclass bieber(ChannelPlugin):    # config data    config = [    ]        # category map    categories = ['the Biebs']    default = 'the Biebs'    current = 'the Biebs'    # static category list    def update_categories(self):        # nothing to do here        pass    # just runs over all channel plugins, and scans their streams{} for matching entries    def update_streams(self, cat, force=0):        # result list        entries = []                # kill our current list, so we won't find our own entries        self.streams = {}                # swamp through all plugins        for name,p in self.parent.channels.iteritems():            #print "bieberquest: channel", name            # subcategories in plugins                    for cat,stations in p.streams.iteritems():                #print "   bq cat", cat                            # station entries                for row in stations:                    # collect text fields, do some typecasting, lowercasing                    text = "|".join([str(e) for e in row.values()])                    text = text.lower()                    # compare                    if text.find("bieb") >= 0:                                            # add to result list                        row["genre"] = name + ": " + row.get("genre", "")                        entries.append(row)        # return final rows list        return entries         | 
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
 | 
 | 
 |