forked from spaceforinception/dost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlyrics.py
34 lines (22 loc) · 955 Bytes
/
lyrics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from lyrics_extractor import get_lyrics
def getLyrics(song_title=""):
if isinstance(song_title, list): # Check if input is a list of Words
song_title = " ".join(song_title)
elif song_title == '': # Check of input is blank
song_title = "Vande Mataram"
song_head, song_lyrics = get_lyrics(song_title)
if song_head !='' and song_lyrics != '':
response = f"Lyrics for {song_head} is as follows : \n\n{song_lyrics}"
response = response.split('\n\n')
else:
response ="Err: No lyrics found for " + song_title
return response
if __name__ == "__main__":
from sender import sendMessage
song_title = "Hundred Miles"
song_title = song_title.split()
msg = getLyrics(song_title)
if isinstance(msg, list):
msg = "\n\n".join(msg)
msg += "\n\nType help for more options."
sendMessage(msg=msg)