# HG changeset patch # User drewp@bigasterisk.com # Date 2005-04-17 02:24:29 # Node ID 2072a0dd7b19ab9652f7c7d00d3cec8db6def7c2 # Parent 38c1ccfb68205d16a7b236ffaf6d3b2e7ae523db factor out LIGHT9_SHOW diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -14,7 +14,7 @@ import twisted 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 @@ ssv.pack(side='top', fill='x') 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 @@ out = Output(subterms) 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" diff --git a/light9/Patch.py b/light9/Patch.py --- a/light9/Patch.py +++ b/light9/Patch.py @@ -30,7 +30,7 @@ def reload_data(): global patch, reverse_patch loc = {} - execfile(os.path.join(os.getenv("LIGHT9_SHOW"),"patchdata.py"), loc) + execfile(showconfig.patchData(), loc) loadedpatch = loc['patch'] patch = {} diff --git a/light9/Submaster.py b/light9/Submaster.py --- a/light9/Submaster.py +++ b/light9/Submaster.py @@ -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 @@ class Submaster: 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 @@ class Submaster: 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 @@ class Submasters: 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 diff --git a/light9/networking.py b/light9/networking.py --- a/light9/networking.py +++ b/light9/networking.py @@ -10,4 +10,7 @@ def dmxServerPort(): return 8030 def musicUrl(): - return "http://localhost:8040" + return "http://localhost:%s" % musicPort() + +def musicPort(): + return 8040