Ran update_copyright.py
[hooke.git] / hooke / plugin / playlist.py
index bcfb75635dfc1dc6bf1e64d6986f068d1280759b..82d0c83c4ddaf9975716fde060183f331919861d 100644 (file)
@@ -2,15 +2,15 @@
 #
 # This file is part of Hooke.
 #
-# Hooke is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-# Hooke is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+# Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with Hooke.  If not, see
@@ -21,8 +21,8 @@ several associated :class:`hooke.command.Command`\s for handling
 :mod:`hooke.playlist` classes.
 """
 
-import os.path
 import glob
+import os.path
 
 from ..command import Command, Argument, Failure
 from ..playlist import FilePlaylist
@@ -34,7 +34,7 @@ class PlaylistPlugin (Builtin):
         super(PlaylistPlugin, self).__init__(name='playlist')
         self._commands = [
             NextCommand(self), PreviousCommand(self), JumpCommand(self),
-            IndexCommand(self), CurveListCommand(self),
+            GetCommand(self), IndexCommand(self), CurveListCommand(self),
             SaveCommand(self), LoadCommand(self),
             AddCommand(self), AddGlobCommand(self),
             RemoveCommand(self), FilterCommand(self), NoteFilterCommand(self)]
@@ -135,19 +135,29 @@ class IndexCommand (Command):
     def _run(self, hooke, inqueue, outqueue, params):
        outqueue.put(params['playlist']._index)
 
+class GetCommand (Command):
+    """Return a :class:`hooke.playlist.Playlist`.
+    """
+    def __init__(self, plugin):
+        super(GetCommand, self).__init__(
+            name='get playlist',
+            arguments=[PlaylistArgument],
+            help=self.__doc__, plugin=plugin)
+
+    def _run(self, hooke, inqueue, outqueue, params):
+        outqueue.put(params['playlist'])
+
 class CurveListCommand (Command):
     """Get the curves in a playlist.
     """
     def __init__(self, plugin):
         super(CurveListCommand, self).__init__(
             name='playlist curves',
-            arguments=[
-                PlaylistArgument,
-                ],
+            arguments=[PlaylistArgument],
             help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
-       outqueue.put([c for c in params['playlist']])
+       outqueue.put(list(params['playlist']))
 
 class SaveCommand (Command):
     """Save a playlist.