@@ -21,7 +21,7 @@ def which(program: str) -> str:
2121__AVPLAY = 'avplay' # all
2222__MPV = 'mpv'
2323__VLC = 'vlc'
24- __MPG123 = 'mpg123' # mp3
24+ __MPG123 = 'mpg123' # mp3
2525__CMUS = 'cmus'
2626__SIMPLEAUDIO = 'simpleaudio' # wav
2727__PYAUDIO = 'pyaudio' # wav
@@ -64,7 +64,9 @@ def which(program: str) -> str:
6464player_play = dict ()
6565
6666
67- def reg_check (player : str ) -> Callable [[Callable [[], bool ]], Callable [[], bool ]]:
67+ def reg_check (
68+ player : str
69+ ) -> Callable [[Callable [[], bool ]], Callable [[], bool ]]:
6870 def __get_f (f : Callable [[], bool ]) -> Callable [[], bool ]:
6971 if player not in __PLAYERS_AND_AUTO :
7072 raise ValueError (player )
@@ -75,7 +77,9 @@ def __get_f(f: Callable[[], bool]) -> Callable[[], bool]:
7577 return __get_f
7678
7779
78- def reg_play (player : str ) -> Callable [[Callable [[], bool ]], Callable [[], bool ]]:
80+ def reg_play (
81+ player : str
82+ ) -> Callable [[Callable [[], bool ]], Callable [[], bool ]]:
7983 def __get_f (f : Callable [[str ], None ]) -> Callable [[str ], None ]:
8084 if player not in __PLAYERS_AND_AUTO :
8185 raise ValueError (player )
@@ -274,6 +278,7 @@ def play_pydub(audio: str) -> None:
274278def check_auto () -> bool :
275279 return True
276280
281+
277282@reg_play (__AUTO )
278283def play_auto (audio : str ) -> None :
279284 for i in __PLAYERS :
@@ -297,11 +302,13 @@ def is_player(player: str) -> bool:
297302
298303
299304def is_available (player : str ) -> bool :
300- return player_check .get (realias (player ), lambda :False )()
305+ return player_check .get (realias (player ), lambda : False )()
306+
301307
302308def get_players () -> list :
303309 return __PLAYERS_AND_AUTO .copy ()
304310
311+
305312def get_availables () -> list :
306313 return [i for i in __PLAYERS_AND_AUTO if is_available (i )]
307314
@@ -318,4 +325,3 @@ def playa(audio: str, player: str) -> None:
318325 assert len (__PLAYERS_AND_AUTO ) == len (ALIAS )
319326 assert len (__PLAYERS_AND_AUTO ) == len (player_check )
320327 assert len (__PLAYERS_AND_AUTO ) == len (player_play )
321-
0 commit comments