X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fplugin%2Fplaylist.py;h=43978b5669f7eba4f58fbb43241fa2dbb6090309;hp=3b1d83754b16d9dc5d050ea8f1c5662fc8129e15;hb=e57e6aa9b86351398b3af9a24513169395a71522;hpb=f1b96b0334501099017e9665d60ff238c37a01fa diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index 3b1d837..43978b5 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -27,7 +27,7 @@ import os.path from ..command import Command, Argument, Failure from ..curve import NotRecognized -from ..playlist import FilePlaylist +from ..playlist import load from ..util.itertools import reverse_enumerate from . import Builtin @@ -38,7 +38,7 @@ class PlaylistPlugin (Builtin): self._commands = [ NextCommand(self), PreviousCommand(self), JumpCommand(self), GetCommand(self), IndexCommand(self), CurveListCommand(self), - SaveCommand(self), LoadCommand(self), + NameCommand(self), SaveCommand(self), LoadCommand(self), AddCommand(self), AddGlobCommand(self), RemoveCommand(self), ApplyCommand(self), FilterCommand(self), @@ -210,6 +210,26 @@ class CurveListCommand (PlaylistCommand): outqueue.put(list(self._playlist(hooke, params))) +class NameCommand (PlaylistCommand): + """(Re)name a playlist. + """ + def __init__(self, plugin): + super(NameCommand, self).__init__( + name='name playlist', + arguments=[ + Argument(name='name', type='string', optional=False, + help=""" +Name for the playlist. +""".strip()), + ], + help=self.__doc__, plugin=plugin) + + def _run(self, hooke, inqueue, outqueue, params): + p = self._playlist(hooke, params) + p.name = params['name'] + outqueue.put(p) + + class SaveCommand (PlaylistCommand): """Save a playlist. """ @@ -250,8 +270,7 @@ Drivers for loading curves. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - p = FilePlaylist(drivers=params['drivers'], path=params['input']) - p.load(hooke=hooke) + p = load(path=params['input'], drivers=params['drivers'], hooke=hooke) self._set_playlist(hooke, params, p) outqueue.put(p) @@ -366,7 +385,7 @@ Evaluate the applied command stack immediately. for command in params['commands']: curve.command_stack.append(command) curve.set_hooke(hooke) - curve.unload() + p.unload(curve) def __setup_params(self, hooke, params): if params['commands'] == None: