Fix absolute TTS file paths not working

This commit is contained in:
Abdo 2025-06-04 17:53:05 +03:00
parent 8add993fca
commit 2bfe33a740
2 changed files with 7 additions and 3 deletions

View file

@ -189,6 +189,10 @@ class AVPlayer:
self._enqueued.insert(0, SoundOrVideoTag(filename=os.path.basename(filename)))
self._play_next_if_idle()
def insert_tag(self, tag: AVTag) -> None:
self._enqueued.insert(0, tag)
self._play_next_if_idle()
def toggle_pause(self) -> None:
if self.current_player:
self.current_player.toggle_pause()

View file

@ -41,7 +41,7 @@ import anki.template
import aqt
from anki import hooks
from anki.collection import TtsVoice as BackendVoice
from anki.sound import AVTag, TTSTag
from anki.sound import AVTag, SoundOrVideoTag, TTSTag
from anki.utils import checksum, is_win, tmpdir
from aqt import gui_hooks
from aqt.sound import OnDoneCallback, SimpleProcessPlayer
@ -260,7 +260,7 @@ class MacTTSFilePlayer(MacTTSPlayer):
from aqt.sound import av_player
av_player.current_player = None
av_player.insert_file(self.tmppath)
av_player.insert_tag(SoundOrVideoTag(filename=self.tmppath))
# Windows support
@ -617,4 +617,4 @@ if is_win:
from aqt.sound import av_player
av_player.current_player = None
av_player.insert_file(self.tmppath)
av_player.insert_tag(SoundOrVideoTag(filename=self.tmppath))