Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import webbrowser
from connection import connection
def Music():
connect = connection()
cursor = connect.cursor()
option = int(input("Press 1 to play music\nPress 2 to add music\n Option: "))
if option == 1:
music = input("Which music do you want to listen? \nMusic: ")
music = music.lower()
sql = 'SELECT link FROM music WHERE name = "' + music + '"'
cursor.execute(sql)
connect.commit()
myresult = cursor.fetchall()
for x in myresult:
new = 2
url = str(x)
url = url[2:]
url = url[:-3]
print(url)
webbrowser.open(str(url), new=new)
break
else:
sql = "INSERT INTO music (name, link) VALUES (%s, %s)"
connect.commit()
name = input("Name of the music: ")
name = name.lower()
link = input("Link: ")
link = link[8:]
link = str(link)
val = (name, link)
cursor.execute(sql, val)
connect.commit()
#########Start Code Here#########
#Music()