os.remove(curve.path)
def _on_set_selected_playlist(self, _class, method, playlist):
- """TODO: playlists plugin with `jump to playlist`.
+ """Call the `jump to playlist` command.
"""
- pass
+ results = self.execute_command(
+ command=self._command_by_name('playlists'))
+ if not isinstance(results[-1], Success):
+ return
+ assert len(results) == 2, results
+ playlists = results[0]
+ matching = [p for p in playlists if p.name == playlist.name]
+ assert len(matching) == 1, matching
+ index = playlists.index(matching[0])
+ results = self.execute_command(
+ command=self._command_by_name('jump to playlist'),
+ args={'index':index})
def _on_set_selected_curve(self, _class, method, playlist, curve):
"""Call the `jump to curve` command.
TODO: playlists plugin.
"""
- # TODO: jump to playlist, get playlist
+ self._on_set_selected_playlist(_class, method, playlist)
index = playlist.index(curve)
results = self.execute_command(
command=self._command_by_name('jump to curve'),
self._on_set_selected_playlist(name)
def _on_set_selected_playlist(self, name):
+ self.log.debug('playlist tree selecting playlist %s' % name)
in_callback(self, self._playlists[name])
def _on_set_selected_curve(self, playlist_name, name):
+ self.log.debug('playlist tree selecting curve %s in %s'
+ % (name, playlist_name))
playlist = self._playlists[playlist_name]
curve = None
for i,c in enumerate(playlist):