File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import pywhatkit .misc as kit
2+ import VoiceEngine
3+ import webbrowser as web
4+ import re
5+ import SpeechRecogniter
6+
7+ def play (strcommand ):
8+ strcommand .replace ("play" , "" )
9+ if "spotify" in strcommand :
10+ spotify (strcommand )
11+ elif "youtube" in strcommand :
12+ youtube (strcommand )
13+ else :
14+ VoiceEngine .say ("Sorry, I can't Determine The PlatForm To Play . I support only YouTube and Spotify." )
15+ VoiceEngine .say ("Can You Tell Me Which PlatForm Do You Like To Play The Song" )
16+ command = str (SpeechRecogniter .getinput ()).lower ()
17+ if "youtube" in command or "spotify" in command : play (command )
18+ else : VoiceEngine .say ("Sorry I Unable To Play It." )
19+
20+ def youtube (strcommand ):
21+ strcommand = re .sub (r"(play|youtube|on)" , "" , strcommand )
22+ VoiceEngine .say ("Starting YouTube to play " + strcommand )
23+ kit .playonyt (strcommand )
24+
25+ def spotify ( strcommand ):
26+ strcommand = re .sub (r"(play|spotify|on)" , "" , strcommand )
27+ VoiceEngine .say ("Starting Spotify to play " + strcommand )
28+ web .open_new_tab ("https://open.spotify.com/search/" + strcommand )
You can’t perform that action at this time.
0 commit comments