From e0f6b30e486b295abe9a7aae340a80857297a7be Mon Sep 17 00:00:00 2001 From: omadke Date: Fri, 31 Jul 2026 13:20:44 +0530 Subject: [PATCH] music_Update main.py If we have to play music which has to words like "winning speech" this change is required so it takes whole word not just a single word when we speak play "music_name" --- Mega Project 1 - Jarvis/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Mega Project 1 - Jarvis/main.py b/Mega Project 1 - Jarvis/main.py index d725a85..56b3e82 100644 --- a/Mega Project 1 - Jarvis/main.py +++ b/Mega Project 1 - Jarvis/main.py @@ -61,10 +61,16 @@ def processCommand(c): webbrowser.open("https://youtube.com") elif "open linkedin" in c.lower(): webbrowser.open("https://linkedin.com") - elif c.lower().startswith("play"): - song = c.lower().split(" ")[1] - link = musicLibrary.music[song] - webbrowser.open(link) + elif "play" in c.lower(): + # song = c.lower().split(" ")[1] == another way but gives error for song with whitespaces + song = c.lower().replace("play", "").strip() + link = musiclibrary.music.get(song) + if link : + webbrowser.open(link) + else : + speak("song not found") + print(c) + elif "news" in c.lower(): r = requests.get(f"https://newsapi.org/v2/top-headlines?country=in&apiKey={newsapi}")