Move some playlist-related expanduser() calls from hooke.plugin.* to hooke.playlist...
authorW. Trevor King <wking@drexel.edu>
Wed, 29 Sep 2010 16:41:23 +0000 (12:41 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 29 Sep 2010 16:41:23 +0000 (12:41 -0400)
hooke/curve.py
hooke/plugin/playlist.py
hooke/plugin/playlists.py

index 030efcb..a4819cf 100644 (file)
@@ -237,6 +237,8 @@ class Curve (object):
         return self.__str__()
 
     def set_path(self, path):
+        if path != None:
+            path = os.path.expanduser(path)
         self.path = path
         if self.name == None and path != None:
             self.name = os.path.basename(path)
index 6dced28..616cfed 100644 (file)
@@ -247,8 +247,7 @@ created from scratch with 'new playlist'), this option is required.
             help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
-       self._playlist(hooke, params).save(
-            os.path.expanduser(params['output']))
+       self._playlist(hooke, params).save(params['output'])
 
 
 class LoadCommand (PlaylistAddingCommand):
@@ -271,8 +270,7 @@ Drivers for loading curves.
             help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
-        p = load(os.path.expanduser(path=params['input']),
-                 drivers=params['drivers'], hooke=hooke)
+        p = load(path=params['input'], drivers=params['drivers'], hooke=hooke)
         self._set_playlist(hooke, params, p)
        outqueue.put(p)
 
@@ -297,7 +295,7 @@ Additional information for the input :class:`hooke.curve.Curve`.
 
     def _run(self, hooke, inqueue, outqueue, params):
         self._playlist(hooke, params).append_curve_by_path(
-            os.path.expanduser(params['input']), params['info'], hooke=hooke)
+            params['input'], params['info'], hooke=hooke)
 
 
 class AddGlobCommand (PlaylistCommand):
index d15740e..e047cb8 100644 (file)
@@ -21,8 +21,6 @@ several associated :class:`hooke.command.Command`\s for handling
 lists of :class:`hooke.playlist.Playlist` classes.
 """
 
-import os.path
-
 from ..command import Command, Argument, Failure
 from ..playlist import FilePlaylist
 from . import Builtin
@@ -119,7 +117,7 @@ Default filename for future saves.
     def _run(self, hooke, inqueue, outqueue, params):
         p = FilePlaylist(
             drivers=hooke.drivers,
-            path=os.path.expanduser(params['file']),
+            path=params['file'],
             )
         self._set_playlist(hooke, params, p)
         outqueue.put(p)