Changeset - 1627032629dc
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 12 years ago 2013-06-16 21:42:55
drewp@bigasterisk.com
add a note about the fix for song orders
Ignore-this: 8b88b1f9016a675fe9eb1d9a7d619e2f
2 files changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/ascoltami/playlist.py
Show inline comments
 
@@ -9,48 +9,50 @@ class NoSuchSong(ValueError):
 
class Playlist(object):
 
    def __init__(self, graph, playlistUri):
 
        self.graph = graph
 

	
 
        # this should be fixed to share with getSongsFromShow. See note in that one for why I had to stop using graph.items
 
        self.songs = [
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song1"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song2"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song3"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song4"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song5"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song6"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song7"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song8"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song9"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song10"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song11"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song12"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song13"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song14"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song15"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song16"),
 
            URIRef("http://light9.bigasterisk.com/show/dance2013/song17"),
 
        ]
 
        # probably fixed with the patch in https://github.com/RDFLib/rdflib/issues/305
 
        #self.songs = list(graph.items(playlistUri))
 
        
 
    def nextSong(self, currentSong):
 
        """Returns the next song in the playlist or raises NoSuchSong if 
 
        we are at the end of the playlist."""
 
        try:
 
            currentIndex = self.songs.index(currentSong)
 
        except IndexError:
 
            raise ValueError("%r is not in the current playlist (%r)." % \
 
                (currentSong, self.playlistUri))
 

	
 
        try:
 
            nextSong = self.songs[currentIndex + 1]
 
        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."""
light9/showconfig.py
Show inline comments
 
@@ -75,46 +75,48 @@ def getSongsFromShow(graph, show):
 
    if not playList:
 
        raise ValueError("%r has no l9:playList" % show)
 
    songs = [
 
        # this was graph.items(playlistUri) but i was getting other
 
        # items from a totally different list! seems like bnode
 
        # corruption.
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song1"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song2"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song3"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song4"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song5"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song6"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song7"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song8"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song9"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song10"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song11"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song12"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song13"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song14"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song15"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song16"),
 
        URIRef("http://light9.bigasterisk.com/show/dance2013/song17"),
 
    ]
 
    # probably fixed with the patch in https://github.com/RDFLib/rdflib/issues/305
 
    #songs = list(graph.items(playList))
 

	
 
    return songs
 

	
 
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'])]
0 comments (0 inline, 0 general)