Only warn once about missing av player (#1592)

This commit is contained in:
RumovZ 2022-01-16 04:46:01 +01:00 committed by GitHub
parent 0e21c49f58
commit 9936f6f7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,6 +275,7 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
self._taskman = taskman self._taskman = taskman
self._terminate_flag = False self._terminate_flag = False
self._process: subprocess.Popen | None = None self._process: subprocess.Popen | None = None
self._warned_about_missing_player = False
def play(self, tag: AVTag, on_done: OnDoneCallback) -> None: def play(self, tag: AVTag, on_done: OnDoneCallback) -> None:
self._terminate_flag = False self._terminate_flag = False
@ -334,7 +335,9 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
try: try:
ret.result() ret.result()
except FileNotFoundError: except FileNotFoundError:
if not self._warned_about_missing_player:
showWarning(tr.media_sound_and_video_on_cards_will()) showWarning(tr.media_sound_and_video_on_cards_will())
self._warned_about_missing_player = True
# must call cb() here, as we don't currently have another way # must call cb() here, as we don't currently have another way
# to flag to av_player that we've stopped # to flag to av_player that we've stopped
cb() cb()