# HG changeset patch # User Drew Perttula # Date 1401175904 0 # Node ID 96faf94bc5f406cc3fe97677b5b72b1ed2660649 # Parent 531e097d3386875a60efba764ea019e22a7b5a86 dead code Ignore-this: 74dd742c8e670f1c26ad0cd55fc62b3b diff -r 531e097d3386 -r 96faf94bc5f4 light9/showconfig.py --- a/light9/showconfig.py Tue May 27 07:30:55 2014 +0000 +++ b/light9/showconfig.py Tue May 27 07:31:44 2014 +0000 @@ -1,4 +1,4 @@ -import time, logging, warnings +import logging, warnings from twisted.python.filepath import FilePath from os import path, getenv from rdflib import Graph @@ -13,8 +13,11 @@ global _config if _config is None: graph = Graph() + # note that logging is probably not configured the first time + # we're in here + print "reading n3 files around %r" % root() for f in FilePath(root()).globChildren("*.n3") + FilePath(root()).globChildren("build/*.n3"): - log.info("reading %s", f) + print "reading %s" % f graph.parse(location=f.path, format='n3') _config = graph return _config @@ -30,31 +33,13 @@ """Return the show URI associated with $LIGHT9_SHOW.""" return URIRef(file(path.join(root(), 'URI')).read().strip()) -def findMpdHome(): - """top of the music directory for the mpd on this system, - including trailing slash""" - - mpdHome = None - for mpdConfFilename in ["/my/dl/modified/mpd/src/mpdconf-testing", - "~/.mpdconf", "/etc/mpd.conf"]: - try: - mpdConfFile = open(path.expanduser(mpdConfFilename)) - except IOError: - continue - for line in mpdConfFile: - if line.startswith("music_directory"): - mpdHome = line.split()[1].strip('"') - return mpdHome.rstrip(path.sep) + path.sep - - raise ValueError("can't find music_directory in any mpd config file") - 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) @@ -104,19 +89,8 @@ def curvesDir(): return path.join(root(),"curves") -def songFilename(song): - return path.join(root(), "music", "%s.wav" % song) - -def subtermsForSong(song): - return path.join(root(),"subterms",song) - def subFile(subname): return path.join(root(),"subs",subname) def subsDir(): return path.join(root(),'subs') - -def prePostSong(): - graph = getGraph() - return [graph.value(MUS['preSong'], L9['showPath']), - graph.value(MUS['postSong'], L9['showPath'])]