Ejemplo n.º 1
0
def post(st):
    # TODO: queue all the files in a big list with `loadfile {filename} 1` so you can skip back and forth easily
    # when user chooses, use `get_file_name`
    av_player.clear_queue_and_maybe_interrupt()
    for vid, nid in st['vid2nid'].items():
        av_player.insert_file(vid)
    st['__reset'] = False
    return st
Ejemplo n.º 2
0
    def _on_done(self, ret: Future, cb: OnDoneCallback) -> None:
        ret.result()

        # inject file into the top of the audio queue
        av_player.insert_file(self._tmpfile)

        # then tell player to advance, which will cause the file to be played
        cb()
Ejemplo n.º 3
0
        def _on_done(self, ret: Future, cb: OnDoneCallback):
            ret.result()

            # inject file into the top of the audio queue
            from aqt.sound import av_player

            av_player.insert_file(self.tmppath)

            # then tell player to advance, which will cause the file to be played
            cb()
Ejemplo n.º 4
0
    def _on_done(self, ret: Future, cb: OnDoneCallback) -> None:
        try:
            ret.result()
        except PlayerInterrupted:
            # don't fire done callback when interrupted
            return

        # inject file into the top of the audio queue
        av_player.insert_file(self._tmpfile)

        # then tell player to advance, which will cause the file to be played
        cb()
Ejemplo n.º 5
0
    def _on_done(self, ret: Future, cb: OnDoneCallback) -> None:
        ret.result()

        # inject file into the top of the audio queue
        if self.audio_file_path != None:
            av_player.insert_file(self.audio_file_path)

        if self.playback_error:
            aqt.utils.showWarning("AwesomeTTS: " + self.playback_error_message)

        # then tell player to advance, which will cause the file to be played
        cb()
Ejemplo n.º 6
0
        def _on_done(self, ret: Future, cb: OnDoneCallback) -> None:
            try:
                ret.result()
            except RuntimeError:
                tooltip(tr.errors_windows_tts_runtime_error())
                return

            # inject file into the top of the audio queue
            from aqt.sound import av_player

            av_player.insert_file(self.tmppath)

            # then tell player to advance, which will cause the file to be played
            cb()
Ejemplo n.º 7
0
Archivo: tts.py Proyecto: yycmmc/anki
        def _on_done(self, ret: Future, cb: OnDoneCallback) -> None:
            try:
                ret.result()
            except RuntimeError:
                # fixme: i18n if this turns out to happen frequently
                tooltip(
                    "TTS failed to play. Please check available languages in system settings."
                )
                return

            # inject file into the top of the audio queue
            from aqt.sound import av_player

            av_player.insert_file(self.tmppath)

            # then tell player to advance, which will cause the file to be played
            cb()
Ejemplo n.º 8
0
def play_all(sounds):
    # Note: sounds will not work if hitmarkers is active.
    if av_player:
        # Delay audio playback to prevent reviewer from stopping playback
        # on showQuestion
        mw.progress.timer(
            1.1, lambda: [
                av_player.insert_file(filename=audio_path)
                for audio_path in give_sounds(sounds)
            ], False)
    else:
        for audio_path in give_sounds(sounds):
            legacy_play(audio_path)