From: W. Trevor King Date: Wed, 29 Sep 2010 16:41:23 +0000 (-0400) Subject: Move some playlist-related expanduser() calls from hooke.plugin.* to hooke.playlist... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4d722e58aad809fd8eb5c824c7afbc9e23908ba2;p=hooke.git Move some playlist-related expanduser() calls from hooke.plugin.* to hooke.playlist and hooke.curve. --- diff --git a/hooke/curve.py b/hooke/curve.py index 030efcb..a4819cf 100644 --- a/hooke/curve.py +++ b/hooke/curve.py @@ -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) diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index 6dced28..616cfed 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -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): diff --git a/hooke/plugin/playlists.py b/hooke/plugin/playlists.py index d15740e..e047cb8 100644 --- a/hooke/plugin/playlists.py +++ b/hooke/plugin/playlists.py @@ -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)