Fix playlist filename preservation for 'load playlist' and 'new playlist'
authorW. Trevor King <wking@drexel.edu>
Mon, 16 Aug 2010 14:48:19 +0000 (10:48 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 16 Aug 2010 14:48:19 +0000 (10:48 -0400)
hooke/plugin/playlist.py
hooke/plugin/playlists.py

index 2b9caa8e29149c91b474282e7946c315d9cf6b79..1439ba63d7e0b6b4b46bca1591d68aa4069da820 100644 (file)
@@ -127,7 +127,9 @@ class PlaylistAddingCommand (Command):
     def _set_playlist(self, hooke, params, playlist):
         """Attach a new playlist.
         """
-        playlist.name = params['output playlist']
+        playlist_names = [p.name for p in hooke.playlists]
+        if playlist.name in playlist_names or playlist.name == None:
+            playlist.name = params['output playlist']  # HACK: override input name.  How to tell if it is callback-generated?
         hooke.playlists.append(playlist)
 
 
@@ -249,9 +251,6 @@ Drivers for loading curves.
     def _run(self, hooke, inqueue, outqueue, params):
         p = FilePlaylist(drivers=params['drivers'], path=params['input'])
         p.load(hooke=hooke)
-        playlist_names = [playlist.name for playlist in hooke.playlists]
-        if p.name in playlist_names or p.name == None:
-            p.name = params['output playlist']  # HACK: override input name.  How to tell if it is callback-generated?
         self._set_playlist(hooke, params, p)
        outqueue.put(p)
 
index ccd5020ab09b8698a194d4423aac851730e77525..df8099982b408cdd41990da85a94fc5a0e74d574 100644 (file)
@@ -119,7 +119,4 @@ Default filename for future saves.
             drivers=hooke.drivers,
             path=params['file'],
             )
-        playlist_names = [playlist.name for playlist in hooke.playlists]
-        if p.name in playlist_names or p.name == None:
-            p.name = params['output playlist']  # HACK: override input name.  How to tell if it is callback-generated?
-        hooke.playlists.append(p)
+        self._set_playlist(hooke, params, p)