diff --git a/bin/wavecurve b/bin/wavecurve --- a/bin/wavecurve +++ b/bin/wavecurve @@ -3,7 +3,6 @@ import os, sys, optparse import run_local from light9.wavepoints import simp - def createCurve(inpath, outpath, t): print "reading %s, writing %s" % (inpath, outpath) points = simp(inpath.replace('.ogg', '.wav'), seconds_per_average=t) @@ -11,33 +10,31 @@ def createCurve(inpath, outpath, t): f = file(outpath, 'w') for time_val in points: print >>f, "%s %s" % time_val - - parser = optparse.OptionParser(usage="""%prog inputSong.wav outputCurve You probably just want -a """) -parser.add_option("-t",type="float",default=.01, +parser.add_option("-t", type="float", default=.01, help="seconds per sample (default .01, .07 is smooth)") -parser.add_option("-a", action="store_true", +parser.add_option("-a", "--all", action="store_true", help="make standard curves for all songs") options,args = parser.parse_args() - -if options.a: +if options.all: from light9 import showconfig from light9.namespaces import L9 from rdflib import RDF graph = showconfig.getGraph() - for song in graph.subjects(RDF.type, L9['Song']): - inpath = showconfig.songOnDisk(song) + + playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri()) + for inpath in playlist.allSongPaths(): for curveName, t in [('music', .01), ('smooth_music', .07)]: outpath = showconfig.curvesDir() + "/%s-%s" % ( showconfig.songFilenameFromURI(song), curveName) createCurve(inpath, outpath, t) else: - inpath,outpath = args + inpath, outpath = args createCurve(inpath, outpath, options.t)