+
+
+class NewCommand (PlaylistAddingCommand):
+ """Create a new playlist.
+ """
+ def __init__(self, plugin):
+ super(NewCommand, self).__init__(
+ name='new playlist',
+ arguments=[
+ Argument(name='file', type='file', optional=True,
+ help="""
+Default filename for future saves.
+""".strip()),
+ ],
+ help=self.__doc__, plugin=plugin)
+
+ def _run(self, hooke, inqueue, outqueue, params):
+ p = FilePlaylist(
+ drivers=hooke.drivers,
+ path=params['file'],
+ )
+ playlist_names = [playlist.name for playlist in hooke.playlists]
+ if p.name in playlist_names or p.name == None:
+ p.name = params['output playlist'] # HACK: override input name. How to tell if it is callback-generated?
+ hooke.playlists.append(p)