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 030efcbab3601b6a0608dc908d0bbe1b6b2b6dec..a4819cf1ef28b03e064d508d244648904f30f667 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 6dced289e376d6642489d568dcca4963820809bd..616cfed6739c52ff73627cd0aff6ffc97cb19973 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 d15740eefe09780b342451efa2beb4e321041886..e047cb881e5ef1abe2feeba620838871f74c8a05 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)