Replace ``curve`` with ``playlist`` in the above commands to navigate
around through the list of loaded playlists.
+Because the playlist name is usually saved in the playlist file
+itself, there is a ``name_playlist`` command that allows you to rename
+playlists on the fly.
+
+ hooke> name_playlist 'my old playlist'
+
Taking notes
------------
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.
"""