Skip to content

Commit

Permalink
doc : ENGINE_TYPE_ERROR added
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Aug 10, 2024
1 parent 0bcdcd1 commit 7a94973
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nava/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from functools import wraps
from .thread import NavaThread
from .params import OVERVIEW, Engine
from .params import SOUND_FILE_PLAY_ERROR, SOUND_FILE_EXIST_ERROR
from .params import SOUND_FILE_PLAY_ERROR, SOUND_FILE_EXIST_ERROR, ENGINE_TYPE_ERROR
from .params import SOUND_FILE_PATH_TYPE_ERROR, SOUND_ID_EXIST_ERROR, LOOP_ASYNC_ERROR
from .errors import NavaBaseError
from . import params
Expand Down Expand Up @@ -284,6 +284,8 @@ def play(sound_path, async_mode=False, loop=False, engine=Engine.AUTO):
:type engine: Engine enum
:return: None or sound id
"""
if not isinstance(engine, Engine):
raise NavaBaseError(ENGINE_TYPE_ERROR)
if loop and not async_mode:
raise NavaBaseError(LOOP_ASYNC_ERROR)
try:
Expand Down
1 change: 1 addition & 0 deletions nava/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Engine(Enum):
SOUND_FILE_PATH_TYPE_ERROR = "Sound file's path should be a string."
SOUND_ID_EXIST_ERROR = "Given sound id doesn't exist."
LOOP_ASYNC_ERROR = "`loop` can not be set True when `async_mode` is False."
ENGINE_TYPE_ERROR = "`engine` type must be `Engine` enum."

_play_threads_map = dict()
_play_threads_counter = 0

0 comments on commit 7a94973

Please sign in to comment.