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
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),
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.
"""
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)
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: