"""
import glob
+import logging
import os.path
from ..command import Command, Argument, Failure
from ..playlist import FilePlaylist
+from ..curve import NotRecognized
from . import Builtin
SaveCommand(self), LoadCommand(self),
AddCommand(self), AddGlobCommand(self),
RemoveCommand(self), ApplyCommandStack(self),
- FilterCommand(self), NoteFilterCommand(self),
+ FilterCommand(self),
]
def _run(self, hooke, inqueue, outqueue, params):
p = FilePlaylist(drivers=params['drivers'], path=params['input'])
p.load(hooke=hooke)
+ 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?
self._set_playlist(hooke, params, p)
outqueue.put(p)
help=self.__doc__, plugin=plugin)
def _run(self, hooke, inqueue, outqueue, params):
+ p = self._playlist(hooke, params)
for path in sorted(glob.glob(params['input'])):
- self._playlist(hooke, params).append_curve_by_path(
- path, params['info'], hooke=hooke)
-
+ try:
+ p.append_curve_by_path(path, params['info'], hooke=hooke)
+ except NotRecognized, e:
+ log = logging.getLogger('hooke')
+ log.warn(unicode(e))
+ continue
+ outqueue.put(p[-1])
class RemoveCommand (PlaylistCommand):
"""Remove a curve from a playlist.
p.set_path(os.path.join(os.path.dirname(p.path), p.name))
self._set_playlist(hooke, params, p)
outqueue.put(p)
-
-
-class NoteFilterCommand (FilterCommand):
- """Create a subset playlist of curves with `.info['note'] != None`.
- """
- def __init__(self, plugin):
- super(NoteFilterCommand, self).__init__(
- plugin, name='note filter playlist')
-
- def filter(self, curve, hooke, inqueue, outqueue, params):
- return 'note' in curve.info and curve.info['note'] != None