Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [16fe14f094]:

To Artifact [8361dea5ee]:

  • File config.py — part of check-in [1beab0563e] at 2014-04-10 04:31:02 on branch py3 — * Fixed gtk_list_store_get_value: assertion `column < list_store->n_columns' by removing {width:20} reference from treeview datamap. * row.setdefault() for absent search_col/set and deleted state * More __print__/dbg colorization * Disabled pson.filter_data in favour of str casting in mygtk.columns() * Removed streamactions.popup PY2/PY3 workaround with named args * More .iteritems() removal (user: mario, size: 7060) [annotate] [blame] [check-ins using]

17
18
19
20
21
22
23


24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40







+
+





-


+







import os
import sys
import pson
import gzip
import platform




#-- create a single instance of config object
conf = object()



#-- global configuration data               ---------------------------------------------
class ConfigDict(dict):


        # start
        def __init__(self):
        
            # object==dict means conf.var is conf["var"]
            self.__dict__ = self  # let's pray this won't leak memory due to recursion issues
48
49
50
51
52
53
54

55
56
57
58
59
60
61
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64







+






            last = self.load("settings")
            if (last):
                self.update(last)
            # store defaults in file
            else:
                self.save("settings")
                self.firstrun = 1


        # some defaults
        def defaults(self):
            self.browser = "sensible-browser"
            self.play = {
               "audio/mp3": "audacious ",	# %u for url to .pls, %g for downloaded .m3u
               "audio/ogg": "audacious ",
85
86
87
88
89
90
91

92
93
94
95
96
97
98
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102







+






            self.auto_save_appstate = 1
            self.theme = "" #"MountainDew"
            self.debug = False
            self.channel_order = "shoutcast, xiph, internet_radio_org_uk, jamendo, myoggradio, .."
            self.reuse_m3u = 1
            self.google_homepage = 1
            self.windows = platform.system()=="Windows"
            self.debug = 1

            
        # each plugin has a .config dict list, we add defaults here
        def add_plugin_defaults(self, config, module=""):
        
            # options
            for opt in config:
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
181
182
183
184
185
186
187





188
189
190
191
192
193
194







-
-
-
-
-






             
        # check for existing filename in directory list
        def find_in_dirs(self, dirs, file):
            for d in dirs:
                if os.path.exists(d+"/"+file):
                    return d+"/"+file


   
#-- actually fill global conf instance
conf = ConfigDict()




# wrapper for all print statements
def __print__(*args):
    if conf.debug:
        print(" ".join([str(a) for a in args]))
203
204
205
206
207
208
209
210
211








202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219









+
+
+
+
+
+
+
+
+
    "CONF": "[CONF]", # brown  CONFIG DATA
    "UI":   "[UI]",   # blue   USER INTERFACE BEHAVIOUR
    "HTTP": "[HTTP]", # magenta HTTP REQUEST
    "DATA": "[DATA]", # cyan   DATA
    "INFO": "[INFO]", # gray   INFO
    "STAT": "[STATE]", # gray  CONFIG STATE
})


   
#-- actually fill global conf instance
conf = ConfigDict()
if conf:
    __print__(dbg.PROC, "ConfigDict() initialized")