Skip to content
This repository
Browse code

using a different section header in config

  • Loading branch information...
commit 1eec4da13be62d7bea3d5c6b019272ef1acc7313 1 parent 4bffe6a
Brian Taylor authored
2  server/common.py
@@ -4,7 +4,7 @@
4 4 import httplib, mimetypes
5 5
6 6 def server_base(config):
7   - return "http://%s:%s" % (config.get("DEFAULT", "server_ip"), config.get("DEFAULT", "server_port"))
  7 + return "http://%s:%s" % (config.get("config", "server_ip"), config.get("config", "server_port"))
8 8
9 9 def parse_config(cfile):
10 10 c = ConfigParser.ConfigParser({})
8 server/rss_server.py
@@ -161,14 +161,14 @@ def GET(self):
161 161 "retrieve a specific feed"
162 162
163 163 config = common.parse_config(config_file)
164   - collapse_collections = config.get("DEFAULT", "collapse_collections").lower() == "true"
  164 + collapse_collections = config.get("config", "collapse_collections").lower() == "true"
165 165
166 166 web.header("Content-Type", "application/rss+xml")
167 167 feed = web.input(dir = None)
168 168 if feed.dir:
169 169 return getdoc(feed.dir, config, collapse_collections).to_xml()
170 170 else:
171   - return getdoc(config.get("DEFAULT", 'music_dir'), config).to_xml()
  171 + return getdoc(config.get("config", 'music_dir'), config).to_xml()
172 172
173 173 class M3UHandler:
174 174 def GET(self):
@@ -181,7 +181,7 @@ def GET(self):
181 181 if feed.dir:
182 182 return doc2m3u(getdoc(feed.dir, config, True))
183 183 else:
184   - return doc2m3u(getdoc(config.get("DEFAULT", 'music_dir'), config, True))
  184 + return doc2m3u(getdoc(config.get("config", 'music_dir'), config, True))
185 185
186 186 urls = (
187 187 '/feed', 'RssHandler',
@@ -196,5 +196,5 @@ def GET(self):
196 196
197 197 config = common.parse_config(config_file)
198 198
199   - sys.argv.append(config.get("DEFAULT","server_port"))
  199 + sys.argv.append(config.get("config","server_port"))
200 200 app.run()
14 server/springboard.py
@@ -19,12 +19,12 @@
19 19 if os.path.exists(config_file):
20 20 config.read(config_file)
21 21 else:
22   - config.add_section("DEFAULT")
  22 + config.add_section("config")
23 23
24 24 # ensure that everything we expect is at least get'able
25 25 def ensure(varname, default):
26   - if not config.has_option("DEFAULT", varname):
27   - config.set("DEFAULT", varname, default)
  26 + if not config.has_option("config", varname):
  27 + config.set("config", varname, default)
28 28
29 29 ensure("roku_ip", "ROKU IP ADDRESS")
30 30 ensure("server_ip", "SERVER IP ADDRESS")
@@ -42,7 +42,7 @@ def upload_client_zip(config, the_zip):
42 42 files = [
43 43 ('archive', the_zip, open(the_zip, 'rb').read())]
44 44
45   - roku_ip = "%s:80" % config.get("DEFAULT", "roku_ip")
  45 + roku_ip = "%s:80" % config.get("config", "roku_ip")
46 46
47 47 print "uploading %s to http://%s/plugin_install" % (the_zip, roku_ip)
48 48 post_multipart(roku_ip, "/plugin_install", fields, files)
@@ -103,7 +103,7 @@ def __init__(self, root):
103 103 w.grid(row=0, columnspan=2, sticky=NSEW)
104 104 self.row_num = 1
105 105
106   - for item in config.items("DEFAULT"):
  106 + for item in config.items("config"):
107 107 self._make_entry(self.frame, item[0], item[1])
108 108
109 109 self.launch_server = Button(self.frame, \
@@ -134,7 +134,7 @@ def _make_entry(self, parent, name, value):
134 134 def ensure_config(self):
135 135 print "writing configuration"
136 136 for name, w in self.configvars.items():
137   - config.set("DEFAULT", name, w.get())
  137 + config.set("config", name, w.get())
138 138 write_config(config_file, config)
139 139
140 140 def launch_server(self):
@@ -157,7 +157,7 @@ def install_client(self):
157 157
158 158 def spawn_server(self):
159 159 import subprocess
160   - cmd = "%s rss_server.py" % config.get("DEFAULT", "python_path")
  160 + cmd = "%s rss_server.py" % config.get("config", "python_path")
161 161 return subprocess.Popen([cmd], shell=True)
162 162
163 163
BIN  zips/client.zip
Binary file not shown
0  zips/token
No changes.

0 comments on commit 1eec4da

Please sign in to comment.
Something went wrong with that request. Please try again.