changeset 215:2072a0dd7b19

factor out LIGHT9_SHOW
author drewp@bigasterisk.com
date Sun, 17 Apr 2005 02:24:29 +0000
parents 38c1ccfb6820
children 233ee9b1e561
files bin/curvecalc light9/Patch.py light9/Submaster.py light9/networking.py
diffstat 4 files changed, 14 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/bin/curvecalc	Mon Apr 11 02:21:26 2005 +0000
+++ b/bin/curvecalc	Sun Apr 17 02:24:29 2005 +0000
@@ -14,7 +14,7 @@
 from twisted.web.xmlrpc import Proxy
 
 import run_local
-from light9 import Submaster, dmxclient, networking
+from light9 import Submaster, dmxclient, networking, showconfig
 from light9.TLUtility import make_attributes_from_args
 from light9.zoomcontrol import Zoomcontrol
 from light9.curve import Curve, Curveview, Curveset, Curvesetview
@@ -241,18 +241,15 @@
 song = sys.argv[1]
 root.title("Curemaster 2000MX - %s" % song)
 
-musicfilename = os.path.join(os.getenv("LIGHT9_SHOW"),'music',
-                             "%s.wav" % song)
+musicfilename = showconfig.songFilename(song)
 maxtime = wavelength(musicfilename)
 dispatcher.send("max time",maxtime=maxtime)
 dispatcher.connect(lambda: maxtime, "get max time",weak=0)
-curveset.load(basename=os.path.join(os.getenv("LIGHT9_SHOW"),"curves",song))
+curveset.load(basename=os.path.join(showconfig.curvesDir(),song))
 
 subterms = []
 subterm_adder(root, curveset, subterms, root, ssv).pack(side='top',fill='x')
-for line in file(os.path.join(os.getenv("LIGHT9_SHOW"),
-                              "subterms",
-                              song)):
+for line in file(showconfig.subtermsForSong()):
     subname,expr = line.strip().split(" ",1)
 
     term = add_one_subterm(subname, curveset, subterms, root, ssv, expr)
@@ -264,8 +261,7 @@
 
 def savekey(*args):
     print "saving",song
-    savesubterms(os.path.join(os.getenv("LIGHT9_SHOW"),"subterms",song),
-                 subterms)
+    savesubterms(showconfig.subtermsForSong(song),subterms)
     curveset.save(basename="curves/"+song)
     print "saved"
 
--- a/light9/Patch.py	Mon Apr 11 02:21:26 2005 +0000
+++ b/light9/Patch.py	Sun Apr 17 02:24:29 2005 +0000
@@ -30,7 +30,7 @@
     global patch, reverse_patch
 
     loc = {}
-    execfile(os.path.join(os.getenv("LIGHT9_SHOW"),"patchdata.py"), loc)
+    execfile(showconfig.patchData(), loc)
     
     loadedpatch = loc['patch']
     patch = {}
--- a/light9/Submaster.py	Mon Apr 11 02:21:26 2005 +0000
+++ b/light9/Submaster.py	Sun Apr 17 02:24:29 2005 +0000
@@ -1,7 +1,7 @@
 from __future__ import division
 import os
 from light9.TLUtility import dict_scale, dict_max
-from light9 import Patch
+from light9 import Patch, showconfig
 
 class Submaster:
     "Contain a dictionary of levels, but you didn't need to know that"
@@ -18,8 +18,7 @@
             return
         try:
             self.levels.clear()
-            subfile = file(os.path.join(os.getenv("LIGHT9_SHOW"),
-                                        "subs",self.name))
+            subfile = file(showconfig.subFile(self.name))
             for line in subfile.readlines():
                 if not line.strip(): # if line is only whitespace
                     continue # "did i say newspace?"
@@ -38,8 +37,7 @@
             print "not saving temporary sub named",self.name
             return
 
-        subfile = file(os.path.join(os.getenv("LIGHT9_SHOW"),
-                                    "subs",self.name), 'w')
+        subfile = file(showconfig.subFile(self.name), 'w')
         names = self.levels.keys()
         names.sort()
         for name in names:
@@ -131,7 +129,7 @@
     def __init__(self):
         self.submasters = {}
 
-        files = os.listdir(os.path.join(os.getenv("LIGHT9_SHOW"),'subs'))
+        files = os.listdir(showconfig.subsDir())
 
         for filename in files:
             # we don't want these files
--- a/light9/networking.py	Mon Apr 11 02:21:26 2005 +0000
+++ b/light9/networking.py	Sun Apr 17 02:24:29 2005 +0000
@@ -10,4 +10,7 @@
     return 8030
     
 def musicUrl():
-    return "http://localhost:8040"
+    return "http://localhost:%s" % musicPort()
+
+def musicPort():
+    return 8040