15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#
import os
import sys
import pson
import gzip
#-- create a single instance of config object
conf = object()
|
>
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#
import os
import sys
import pson
import gzip
import platform
#-- create a single instance of config object
conf = object()
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
self.retain_deleted = 1
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
# each plugin has a .config dict list, we add defaults here
def add_plugin_defaults(self, config, module=""):
# options
for opt in config:
if ("name" in opt) and ("value" in opt) and (opt["name"] not in vars(self)):
self.__dict__[opt["name"]] = opt["value"]
# plugin state
if module and module not in conf.plugins:
conf.plugins[module] = 1
# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
def xdg(self):
home = os.environ.get("HOME", self.tmp)
config = os.environ.get("XDG_CONFIG_HOME", home+"/.config")
# storage dir
self.dir = config + "/" + "streamtuner2"
# create if necessary
if (not os.path.exists(self.dir)):
os.makedirs(self.dir)
# store some configuration list/dict into a file
|
>
|
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
self.retain_deleted = 1
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"
# each plugin has a .config dict list, we add defaults here
def add_plugin_defaults(self, config, module=""):
# options
for opt in config:
if ("name" in opt) and ("value" in opt) and (opt["name"] not in vars(self)):
self.__dict__[opt["name"]] = opt["value"]
# plugin state
if module and module not in conf.plugins:
conf.plugins[module] = 1
# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
def xdg(self):
home = os.environ.get("HOME", self.tmp)
config = os.environ.get("XDG_CONFIG_HOME", os.environ.get("APPDATA", home+"/.config"))
# storage dir
self.dir = config + "/streamtuner2"
# create if necessary
if (not os.path.exists(self.dir)):
os.makedirs(self.dir)
# store some configuration list/dict into a file
|