changeset 717:d8202a0a7fd5

fix up musicpad and wavecurve. ascoltami2 can now use relative paths in the config Ignore-this: eb95f50f54f14275f1f031ccb7fbb97f
author Drew Perttula <drewp@bigasterisk.com>
date Wed, 13 Jun 2012 04:27:48 +0000
parents 348b68723238
children bb2bd3346d2d
files bin/curvecalc bin/listsongs bin/musicPad bin/wavecurve light9/ascoltami/player.py light9/ascoltami/playlist.py light9/showconfig.py
diffstat 7 files changed, 14 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/bin/curvecalc	Tue Jun 12 09:46:04 2012 +0000
+++ b/bin/curvecalc	Wed Jun 13 04:27:48 2012 +0000
@@ -262,8 +262,8 @@
     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)
     
--- a/bin/listsongs	Tue Jun 12 09:46:04 2012 +0000
+++ b/bin/listsongs	Wed Jun 13 04:27:48 2012 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!bin/python
 
 """for completion, print the available song uris on stdout
 
--- a/bin/musicPad	Tue Jun 12 09:46:04 2012 +0000
+++ b/bin/musicPad	Wed Jun 13 04:27:48 2012 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!bin/python
 """
 rewrite all the songs with silence at the start and end
 """
@@ -14,9 +14,6 @@
 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')
--- a/bin/wavecurve	Tue Jun 12 09:46:04 2012 +0000
+++ b/bin/wavecurve	Wed Jun 13 04:27:48 2012 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!bin/python
 import optparse
 import run_local
 from light9.wavepoints import simp
@@ -31,7 +31,7 @@
 
     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" % (
--- a/light9/ascoltami/player.py	Tue Jun 12 09:46:04 2012 +0000
+++ b/light9/ascoltami/player.py	Wed Jun 13 04:27:48 2012 +0000
@@ -32,7 +32,7 @@
         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())
--- a/light9/ascoltami/playlist.py	Tue Jun 12 09:46:04 2012 +0000
+++ b/light9/ascoltami/playlist.py	Wed Jun 13 04:27:48 2012 +0000
@@ -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 @@
                              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):
--- a/light9/showconfig.py	Tue Jun 12 09:46:04 2012 +0000
+++ b/light9/showconfig.py	Wed Jun 13 04:27:48 2012 +0000
@@ -74,7 +74,7 @@
     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):
     """