File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1414from typing import Union
1515from typing import NoReturn
1616import requests
17- import vlc
1817import httpx
1918import asyncio
2019import urllib .parse
2120from time import sleep as wait
2221
22+ try :
23+ import vlc
24+
25+ is_vlc_imported = True
26+ except Exception as e :
27+ logging .debug (f"Unable to import vlc lib - { e } " )
28+ # Ref : #49
29+ is_vlc_imported = False
30+
2331appdir = appdirs .AppDirs ("pytgpt" , "Smartwa" )
2432
2533default_path = appdir .user_cache_dir
@@ -1033,6 +1041,9 @@ def play(path_to_audio_file: Union[Path, str]) -> NoReturn:
10331041 raise FileNotFoundError (f"File does not exist - '{ path_to_audio_file } '" )
10341042
10351043 def play_using_vlc ():
1044+ if not is_vlc_imported :
1045+ logging .warn ("Failed to import vlc lib, check logs (debug)" )
1046+ return
10361047 # create instance
10371048 instance = vlc .Instance ()
10381049 # Create a Media Player object
You can’t perform that action at this time.
0 commit comments