diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -262,8 +262,8 @@ def main(): subtermPath = graphPathForSubterms(song) try: graph.parse(subtermPath, format='n3') - except urllib2.URLError, e: - if e.reason.errno != 2: + except IOError, e: + if e.errno != 2: raise log.info("%s not found, starting with empty graph" % subtermPath) diff --git a/bin/listsongs b/bin/listsongs --- a/bin/listsongs +++ b/bin/listsongs @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!bin/python """for completion, print the available song uris on stdout diff --git a/bin/musicPad b/bin/musicPad --- a/bin/musicPad +++ b/bin/musicPad @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!bin/python """ rewrite all the songs with silence at the start and end """ @@ -14,9 +14,6 @@ introPad = 4 postPad = 9 # 5 + autostop + 4 playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri()) -# instead of taking a show uri like it should, i just convert every -# path i find in the graph (hoping that you only loaded statements for -# the current show) for p in playlist.allSongPaths(): log.info("read %s", p) inputWave = wave.open(p, 'r') diff --git a/bin/wavecurve b/bin/wavecurve --- a/bin/wavecurve +++ b/bin/wavecurve @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!bin/python import optparse import run_local from light9.wavepoints import simp @@ -31,7 +31,7 @@ if options.all: playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri()) for song in playlist.allSongs(): - inpath = playlist.songPath(song) + inpath = showconfig.songOnDisk(song) for curveName, t in [('music', .01), ('smooth_music', .07)]: outpath = showconfig.curvesDir() + "/%s-%s" % ( diff --git a/light9/ascoltami/player.py b/light9/ascoltami/player.py --- a/light9/ascoltami/player.py +++ b/light9/ascoltami/player.py @@ -32,7 +32,7 @@ class Player(object): bus.add_signal_watch() def on_any(bus, msg): - print bus, msg, msg.type + #print bus, msg, msg.type if msg.type == gst.MESSAGE_EOS: if self.onEOS is not None: self.onEOS(self.getSong()) diff --git a/light9/ascoltami/playlist.py b/light9/ascoltami/playlist.py --- a/light9/ascoltami/playlist.py +++ b/light9/ascoltami/playlist.py @@ -1,4 +1,4 @@ -from light9.showconfig import getSongsFromShow +from light9.showconfig import getSongsFromShow, songOnDisk from light9.namespaces import L9 class NoSuchSong(ValueError): @@ -25,21 +25,22 @@ class Playlist(object): 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: - paths.append(self.songPath(song)) + paths.append(songOnDisk(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://"):] + raise NotImplementedError("see showconfig.songOnDisk") + # maybe that function should be moved to this method @classmethod def fromShow(playlistClass, graph, show): diff --git a/light9/showconfig.py b/light9/showconfig.py --- a/light9/showconfig.py +++ b/light9/showconfig.py @@ -74,7 +74,7 @@ def songOnDisk(song): if not name: raise ValueError("Song %r has no :songFilename" % song) - return path.join(root, name) + return path.abspath(path.join(root, name)) def songFilenameFromURI(uri): """