changeset 1461:a7de122a7b18

clients were reading this file a LOT. Probably not a performance issue, but distracting in strace output Ignore-this: 180916361bbcc3b0e3a4fe82bda0990a
author drewp@bigasterisk.com
date Sun, 12 Jun 2016 02:12:28 +0000
parents bd1d03349b9a
children d8929e28b8bc
files light9/showconfig.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/light9/showconfig.py	Sun Jun 12 01:57:00 2016 +0000
+++ b/light9/showconfig.py	Sun Jun 12 02:12:28 2016 +0000
@@ -28,9 +28,13 @@
             "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?"""