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
|
import action
import favicon
import os.path
import xml.sax.saxutils
import re
import copy
import inspect
import pkgutil
# Only export plugin classes
__all__ = [
"GenericChannel", "ChannelPlugin", "module_list"
]
# Search through ./channels/ and get module basenames.
# Also order them by conf.channel_order
#
def module_list():
# Should list plugins within zips as well as local paths
ls = pkgutil.iter_modules([conf.share+"/channels", "channels"])
ls = [name for loader,name,ispkg in ls]
# resort with tab order
order = [module.strip() for module in conf.channel_order.lower().replace(".","_").replace("-","_").split(",")]
ls = [module for module in (order) if (module in ls)] + [module for module in (ls) if (module not in order)]
return ls
# generic channel module ---------------------------------------
class GenericChannel(object):
# desc
|
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import action
import favicon
import os.path
import xml.sax.saxutils
import re
import copy
import inspect
# Only export plugin classes
__all__ = [
"GenericChannel", "ChannelPlugin"
]
# generic channel module ---------------------------------------
class GenericChannel(object):
# desc
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# constructor
def __init__(self, parent=None):
#self.streams = {}
self.gtk_list = None
self.gtk_cat = None
self.module = self.__class__.__name__
self.meta = plugin_meta(None, inspect.getcomments(inspect.getmodule(self)))
self.config = self.meta.get("config", [])
self.title = self.meta.get("title", self.module)
# add default options values to config.conf.* dict
conf.add_plugin_defaults(self.meta["config"], self.module)
# only if streamtuner2 is run in graphical mode
|
|
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# constructor
def __init__(self, parent=None):
#self.streams = {}
self.gtk_list = None
self.gtk_cat = None
self.module = self.__class__.__name__
self.meta = plugin_meta(src = inspect.getcomments(inspect.getmodule(self)))
self.config = self.meta.get("config", [])
self.title = self.meta.get("title", self.module)
# add default options values to config.conf.* dict
conf.add_plugin_defaults(self.meta["config"], self.module)
# only if streamtuner2 is run in graphical mode
|
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
|
vbox.pack2(sw2, resize=True, shrink=True)
# prepare label
pixbuf = None
if "png" in self.meta:
pixbuf = uikit.pixbuf(self.meta["png"])
else:
png = pkgutil.get_data("config", "channels/" + self.module + ".png")
pixbuf = uikit.pixbuf(png)
if pixbuf:
icon = gtk.image_new_from_pixbuf(pixbuf)
else:
icon = gtk.image_new_from_stock(gtk.STOCK_DIRECTORY, size=1)
label = gtk.HBox()
label.pack_start(icon, expand=False, fill=True)
|
|
|
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
|
vbox.pack2(sw2, resize=True, shrink=True)
# prepare label
pixbuf = None
if "png" in self.meta:
pixbuf = uikit.pixbuf(self.meta["png"])
else:
png = get_data("channels/" + self.module + ".png")
pixbuf = uikit.pixbuf(png)
if pixbuf:
icon = gtk.image_new_from_pixbuf(pixbuf)
else:
icon = gtk.image_new_from_stock(gtk.STOCK_DIRECTORY, size=1)
label = gtk.HBox()
label.pack_start(icon, expand=False, fill=True)
|