def autodetect_bpm(self, track, parent_window=None): def _on_complete(bpm, err): if err is not None: dialogs.error(None, err) else: self.set_bpm(track, bpm, parent_window=parent_window) bpmdetect.detect_bpm(track.get_loc_for_io(), _on_complete)
def autodetect_bpm(self, track): def _on_complete(bpm, err): if err is not None: dialogs.error(None, err) else: self.set_bpm(track, bpm) bpmdetect.detect_bpm(track.get_loc_for_io(), _on_complete)
def autodetect_bpm(self, track, parent_window=None): def _on_complete(bpm, err): if err is not None: dialogs.error(None, err) elif track and bpm: bpm = int(round(float(bpm))) msg = BPMAutodetectResponse(parent_window, bpm, track) result = msg.run() bpm = msg.get_bpm() msg.destroy() self._set_bpm(result, bpm, track) bpmdetect.detect_bpm(track.get_loc_for_io(), _on_complete)