Changeset - 9071cd1bb29c
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 14 years ago 2011-06-15 05:31:33
drewp@bigasterisk.com
fix wavecurve
Ignore-this: 49aff50aa4bcbb6fe0aec412c46d7911
2 files changed with 10 insertions and 5 deletions:
0 comments (0 inline, 0 general)
bin/wavecurve
Show inline comments
 
@@ -17,24 +17,26 @@ You probably just want -a
 

	
 
""")
 
parser.add_option("-t", type="float", default=.01,
 
                  help="seconds per sample (default .01, .07 is smooth)")
 
parser.add_option("-a", "--all", action="store_true",
 
                  help="make standard curves for all songs")
 
options,args = parser.parse_args()
 

	
 
if options.all:
 
    from light9 import showconfig
 
    from light9.namespaces import L9
 
    from rdflib import RDF
 
    from light9.ascoltami.playlist import Playlist
 
    graph = showconfig.getGraph()
 

	
 
    playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri())
 
    for inpath in playlist.allSongPaths():
 
    for song in playlist.allSongs():
 
        inpath = playlist.songPath(song)
 
        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
 
    createCurve(inpath, outpath, options.t)
light9/ascoltami/playlist.py
Show inline comments
 
@@ -23,24 +23,27 @@ class Playlist(object):
 
        except IndexError:
 
            raise NoSuchSong("%r is the last item in the playlist." % \
 
                             currentSong)
 

	
 
        return nextSong
 
    def allSongs(self):
 
        """Returns a list of all song URIs in order."""
 
        return self.songs
 
    def allSongPaths(self):
 
        """Returns a list of the filesystem paths to all songs in order."""
 
        paths = []
 
        for song in self.songs:
 
            p = self.graph.value(song, L9['showPath'])
 
            assert p.startswith("file://"), p
 
            p = p[len("file://"):]
 
            paths.append(p)
 
            paths.append(self.songPath(song))
 
        return paths
 
    
 
    def songPath(self, uri):
 
        """filesystem path to a song"""
 
        p = self.graph.value(uri, L9['showPath'])
 
        assert p.startswith("file://"), p
 
        return p[len("file://"):]
 

	
 
    @classmethod
 
    def fromShow(playlistClass, graph, show):
 
        playlistUri = graph.value(show, L9['playList'])
 
        if not playlistUri:
 
            raise ValueError("%r has no l9:playList" % show)
 
        return playlistClass(graph, playlistUri)
0 comments (0 inline, 0 general)