Changeset - a7de122a7b18
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 9 years ago 2016-06-12 02:12:28
drewp@bigasterisk.com
clients were reading this file a LOT. Probably not a performance issue, but distracting in strace output
Ignore-this: 180916361bbcc3b0e3a4fe82bda0990a
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/showconfig.py
Show inline comments
 
@@ -19,27 +19,31 @@ def getGraph():
 
        for f in FilePath(root()).globChildren("*.n3") + FilePath(root()).globChildren("build/*.n3"):
 
            graph.parse(location=f.path, format='n3')
 
        _config = graph
 
    return _config
 

	
 
def root():
 
    r = getenv("LIGHT9_SHOW")
 
    if r is None:
 
        raise OSError(
 
            "LIGHT9_SHOW env variable has not been set to the show root")
 
    return r
 

	
 
_showUri = None
 
def showUri():
 
    """Return the show URI associated with $LIGHT9_SHOW."""
 
    return URIRef(file(path.join(root(), 'URI')).read().strip())
 
    global _showUri
 
    if _showUri is None:
 
        _showUri = URIRef(file(path.join(root(), 'URI')).read().strip())
 
    return _showUri
 

	
 
def songOnDisk(song):
 
    """given a song URI, where's the on-disk file that mpd would read?"""
 
    graph = getGraph()
 
    root = graph.value(showUri(), L9['musicRoot'])
 
    if not root:
 
        raise ValueError("%s has no :musicRoot" % showUri())
 

	
 
    name = graph.value(song, L9['songFilename'])
 
    if not name:
 
        raise ValueError("Song %r has no :songFilename" % song)
 

	
0 comments (0 inline, 0 general)