-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
2016 lines (1745 loc) · 87.7 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import tkinter as tk
from calendar import Calendar
from tkinter import messagebox
import pymysql
from tkinter import *
class Musiclly():
#Constructor
def __init__(self, root,username,password):
self.root = root
self.username= username
self.password= password
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width=800
height=600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
root.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
self.root.title( "Database Connection Page" )
self.root.attributes( '-topmost', True )
'''
frame_image = Frame( self.root, borderwidth=2, bg="white", relief=SUNKEN)
frame_image.place( x=10,y=10,width=500,height=500)
frame_image.picture = PhotoImage( file="Musicly.png" )
frame_image.label = Label( frame_image, image=frame_image.picture )
canvas = Canvas(
self.root,
width=500,
height=500
)
canvas.pack()
img = PhotoImage( file='Musicly.png' )
canvas.create_image(
10,
10,
anchor=NW,
image=img
)
# Add image file
bg = PhotoImage( file="musiclybig.jpg" )
# Show image using label
label1 = Label( root, image=bg )
label1.place( x=0, y=0 )
'''
self.root.configure(background = 'white' )
self.root.tk.call( 'wm', 'iconphoto', self.root._w, PhotoImage( file="Musicly.png" ) )
photo = PhotoImage( file="Musicly.png" )
frame1 = Frame( root, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label=tk.Label(root,text="Welcome To Musicly!!",font="Calibri, 22",background='light blue')
label.pack(ipadx=30,ipady=30)
#label.place(x=10,y=10,width=400)
submitbtn = tk.Button( root, text="Connect to DataBase",
bg='light blue', command=lambda: [self.mainWindow(), self.submitact()] )
submitbtn.place( x=250, y=335, width=150 ,height=50)
submitbtne = tk.Button( root, text="Exit",
bg='light blue', command=exit )
submitbtne.place( x=450, y=335, width=100 ,height=50)
# Main SignIn and SignUp window
def mainWindow(self):
mainWindow = Toplevel( root )
mainWindow.title( "Search Songs" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
mainWindow.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
Label( mainWindow, font="Calibri, 12" ).pack()
mainWindow.configure( background='white' )
mainWindow.tk.call( 'wm', 'iconphoto', mainWindow._w, PhotoImage( file="Musicly.png" ) )
frame1 = Frame( mainWindow, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label = tk.Label( mainWindow, text=" Musicly!! ", font="Calibri, 22", background='light blue' )
label.pack( ipadx=30, ipady=30 )
signin = tk.Button( mainWindow, text="SignIn",
bg='light blue', command=lambda: [self.logIn(), self.submitact(),mainWindow.withdraw()] )
signin.place( x=300, y=300, width=200, height=50 )
signup = tk.Button( mainWindow, text="SignUp",
bg='light blue', command=lambda: [self.userInfo(), self.submitact(), mainWindow.withdraw()] )
signup.place( x=300, y=400, width=200, height=50 )
submitbtne = tk.Button( mainWindow, text="Exit",
bg='light blue', command=exit )
submitbtne.place( x=300, y=500, width=200, height=50 )
# Database login credentials
def submitact(self):
user = self.username
passw = self.password
print( f"The name entered by you is {user} {passw}" )
self.logintodb( user, passw )
# userInfo(user, passw)
# To make database connection
def logintodb(self,user, passw, db=None):
# If password is enetered by the
# user
if passw:
conn = pymysql.connect( host='localhost',
user=user,
password=passw,
db='musicly' )
cursor = conn.cursor()
# If no password is enetered by the
# user
else:
conn = pymysql.connect( host='localhost',
user=user,
db='musicly' )
cursor = conn.cursor()
print( "Connected to Database" )
# Window to log in for existing user
def logIn(self):
logIn = Toplevel( root )
logIn.title( "LogIn" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
logIn.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
Label( logIn, font="Calibri, 12" ).pack()
logIn.configure( background='white' )
# Keep the toplevel window in front of the root window
logIn.wm_transient( root )
frame1 = Frame( logIn, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label = tk.Label( logIn, text=" Musicly!! ", font="Calibri, 22", background='light blue' )
label.pack( ipadx=30, ipady=30 )
lblsecrow = tk.Label( logIn, text="UserName -" )
logIn.tk.call( 'wm', 'iconphoto', logIn._w, PhotoImage( file="Musicly.png" ) )
lblsecrow.place( x=250, y=300 )
Username = tk.Entry( logIn, width=35 )
Username.place( x=400, y=300, width=100 )
username=Username
lblsecrow = tk.Label( logIn, text="Password -" )
lblsecrow.place( x=250, y=350 )
Password = tk.Entry( logIn, width=35, show="*" )
Password.place( x=400, y=350, width=100 )
password=Password
next1 = tk.Button( logIn, text="Next",
bg='light blue', command=lambda: [self.userDetailsCheck(username,password),
logIn.withdraw()] )
next1.place( x=250, y=450, width=100 )
exit1 = tk.Button( logIn, text="Exit",
bg='light blue', command=exit )
exit1.place( x=400, y=450, width=100 )
#To check username and password exists in the database or not.
def userDetailsCheck(self,username,password):
username = username.get()
password = password.get()
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
cursor2 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str3 = """SELECT user_name from users
WHERE user_name = '"""+ username + "' AND password = '"+ password + "' ; "
str4 = """SELECT password from users
WHERE user_name = '"""+ username + "' AND password = '"+ password + "' ; "
cursor.execute( str3 )
cursor2.execute(str4)
conn.commit()
row1= cursor.fetchall()
row2 = cursor2.fetchall()
if((row1 != ()) and (row2 != ())):
self.openNewWindowReturn(username, password)
self.submitact()
else:
messagebox.showerror( 'Invalid Input','Invalid Username or Password!!')
exit()
# New Window for Options
def openNewWindow(self,username,password):
# Toplevel object which will
# be treated as a new window
newWindow = Toplevel( root )
username=username.get()
password=password.get()
# sets the title of the
# Toplevel widget
newWindow.title( "Options" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
newWindow.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
Label( newWindow, font="Calibri, 12" ).pack()
newWindow.configure( background='white' )
# Keep the toplevel window in front of the root window
newWindow.wm_transient( root )
frame1 = Frame( newWindow, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label = tk.Label( newWindow, text=" Musicly!! ", font="Calibri, 22", background='light blue' )
label.pack( ipadx=30, ipady=30 )
newWindow.tk.call( 'wm', 'iconphoto', newWindow._w, PhotoImage( file="Musicly.png" ) )
submitbtn1 = tk.Button( newWindow, text="Song Info",
bg='light blue', command=lambda: [self.songInfo(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn1.place( x=150, y=250, width=120 )
submitbtn2 = tk.Button( newWindow, text="Artist Info",
bg='light blue', command=lambda: [self.artistInfo(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn2.place( x=350, y=250, width=120 )
userInfo = tk.Button( newWindow, text="User Info",
bg='light blue',
command=lambda: [self.userInfoFetch( username, password ), self.submitact(),
newWindow.withdraw()] )
userInfo.place( x=550, y=250, width=120 )
submitbtn3 = tk.Button( newWindow, text="Modify Song Review",
bg='light blue', command=lambda: [self.modifySongReview(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn3.place( x=150, y=350, width=120 )
submitbtn4 = tk.Button( newWindow, text="Modify Artist Review",
bg='light blue', command=lambda: [self.modifyArtistReview(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn4.place( x=350, y=350, width=120 )
submitbtn5 = tk.Button( newWindow, text="Modify Song Rating",
bg='light blue', command=lambda: [self.modifySongRating(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn5.place( x=550, y=350, width=120 )
submitbtn6 = tk.Button( newWindow, text="Modify Artist Rating",
bg='light blue', command=lambda: [self.modifyArtistRating(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn6.place( x=550, y=450, width=120 )
submitbtn7 = tk.Button( newWindow, text="Search Songs",
bg='light blue', command=lambda: [self.searchSongs(username,password), self.submitact(),
newWindow.withdraw()] )
submitbtn7.place( x=150, y=450, width=120 )
submitbtn8 = tk.Button( newWindow, text="Exit",
bg='light blue', command=exit )
submitbtn8.place( x=350, y=500, width=120, height= 50 )
# Options window return
def openNewWindowReturn(self,username,password):
newWindow = Toplevel( root )
username = username
password = password
# sets the title of the
# Toplevel widget
newWindow.title( "Options" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
newWindow.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
Label( newWindow, font="Calibri, 12" ).pack()
newWindow.configure( background='white' )
# Keep the toplevel window in front of the root window
newWindow.wm_transient( root )
frame1 = Frame( newWindow, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label = tk.Label( newWindow, text=" Musicly!! ", font="Calibri, 22", background='light blue' )
label.pack( ipadx=30, ipady=30 )
newWindow.tk.call( 'wm', 'iconphoto', newWindow._w, PhotoImage( file="Musicly.png" ) )
submitbtn1 = tk.Button( newWindow, text="Song Info",
bg='light blue', command=lambda: [self.songInfo( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn1.place( x=150, y=250, width=120 )
submitbtn2 = tk.Button( newWindow, text="Artist Info",
bg='light blue',
command=lambda: [self.artistInfo( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn2.place( x=350, y=250, width=120 )
userInfo = tk.Button( newWindow, text="User Info",
bg='light blue',
command=lambda: [self.userInfoFetch( username, password ), self.submitact(),
newWindow.withdraw()] )
userInfo.place( x=550, y=250, width=120 )
submitbtn3 = tk.Button( newWindow, text="Modify Song Review",
bg='light blue',
command=lambda: [self.modifySongReview( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn3.place( x=150, y=350, width=120 )
submitbtn4 = tk.Button( newWindow, text="Modify Artist Review",
bg='light blue',
command=lambda: [self.modifyArtistReview( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn4.place( x=350, y=350, width=120 )
submitbtn5 = tk.Button( newWindow, text="Modify Song Rating",
bg='light blue',
command=lambda: [self.modifySongRating( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn5.place( x=550, y=350, width=120 )
submitbtn6 = tk.Button( newWindow, text="Modify Artist Rating",
bg='light blue',
command=lambda: [self.modifyArtistRating( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn6.place( x=550, y=450, width=120 )
submitbtn7 = tk.Button( newWindow, text="Search Songs",
bg='light blue',
command=lambda: [self.searchSongs( username, password ), self.submitact(),
newWindow.withdraw()] )
submitbtn7.place( x=150, y=450, width=120 )
submitbtn8 = tk.Button( newWindow, text="Exit",
bg='light blue', command=exit )
submitbtn8.place( x=350, y=500, width=120, height=50 )
#User Info Fetch 1
def userInfoFetch(self,username,password):
username = username
password = password
userInfoFetch = Toplevel( root )
userInfoFetch.title( "User Information" )
frame1 = Frame( userInfoFetch, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=10, pady=10 )
label1 = tk.Label( userInfoFetch, text=" Musicly!! ", font="Calibri, 22",
background='light blue' )
label1.pack( ipadx=30, ipady=30 )
Label( userInfoFetch, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
userInfoFetch.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
userInfoFetch.configure( background='white' )
userInfoFetch.tk.call( 'wm', 'iconphoto', userInfoFetch._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = "call userDetailsFetch('"+username+"','" +password+ "');"
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_name = []
list_Member = []
list_udob = []
list_phoneNum = []
list_favSong = []
list_favArt = []
for row in rows:
list_name.append( row[0] )
list_Member.append( row[1] )
list_udob.append( row[2] )
list_phoneNum.append( row[3] )
list_favSong.append( row[4] )
list_favArt.append( row[5] )
label = tk.Label( userInfoFetch, text="User Name: " )
label.place( x=250, y=200 )
label = tk.Label( userInfoFetch, text=list_name )
label.place( x=400, y=200 )
label = tk.Label( userInfoFetch, text="Membership Status: " )
label.place( x=250, y=250 )
label = tk.Label( userInfoFetch, text=list_Member )
label.place( x=400, y=250 )
label = tk.Label( userInfoFetch, text="User DOB: " )
label.place( x=250, y=300 )
label = tk.Label( userInfoFetch, text=list_udob )
label.place( x=400, y=300 )
label = tk.Label( userInfoFetch, text="Phone Num: " )
label.place( x=250, y=350 )
label = tk.Label( userInfoFetch, text=list_phoneNum )
label.place( x=400, y=350 )
label = tk.Label( userInfoFetch, text="Fav Song: " )
label.place( x=250, y=400 )
label = tk.Label( userInfoFetch, text=list_favSong )
label.place( x=400, y=400 )
label = tk.Label( userInfoFetch, text="Fav Artist: " )
label.place( x=250, y=450 )
label = tk.Label( userInfoFetch, text=list_favArt )
label.place( x=400, y=450 )
exit2 = tk.Button( userInfoFetch, text="Exit",
bg='light blue', command=exit )
exit2.place( x=250, y=500, width=100 )
mainmenu = tk.Button( userInfoFetch, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
userInfoFetch.withdraw()] )
mainmenu.place( x=400, y=500, width=100 )
def searchSongs(self,username,password):
username= username
password= password
searchSongs = Toplevel( root )
searchSongs.title( "Search Songs" )
Label( searchSongs, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongs.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
# Keep the toplevel window in front of the root window
searchSongs.wm_transient( root )
searchSongs.configure( background='white' )
searchSongs.tk.call( 'wm', 'iconphoto', searchSongs._w, PhotoImage( file="Musicly.png" ) )
frame1 = Frame( searchSongs, highlightbackground="black", highlightthickness=2 )
frame1.pack( padx=20, pady=20 )
label = tk.Label( searchSongs, text=" Musicly!! ", font="Calibri, 22", background='light blue' )
label.pack( ipadx=30, ipady=30 )
artist = tk.Button( searchSongs, text="Artist",
bg='light blue', command=lambda: [self.searchSongArtistName(username,password), self.submitact(),
searchSongs.withdraw()] )
artist.place( x=350, y=200, width=100 )
genre = tk.Button( searchSongs, text="Genre",
bg='light blue', command=lambda: [self.searchSongGenreName(username,password), self.submitact(),
searchSongs.withdraw()] )
genre.place( x=350, y=250, width=100 )
language = tk.Button( searchSongs, text="Language",
bg='light blue', command=lambda: [self.searchSonglanguageName(username,password), self.submitact(),
searchSongs.withdraw()] )
language.place( x=350, y=300, width=100 )
mood = tk.Button( searchSongs, text="Mood",
bg='light blue', command=lambda: [self.searchSongMoodName(username,password), self.submitact(),
searchSongs.withdraw()] )
mood.place( x=350, y=350, width=100 )
exit5 = tk.Button( searchSongs, text="Exit",
bg='light blue', command=exit )
exit5.place( x=350, y=400, width=100 )
mainmenu = tk.Button( searchSongs, text="Home",
bg='light blue', command=lambda: [self.openNewWindowReturn(username,password), self.submitact(),
searchSongs.withdraw()] )
mainmenu.place( x=350, y=450, width=100 )
#Search Song By Artist Name1
def searchSongArtistName(self,username,password):
username = username
password = password
searchSongs = Toplevel( root )
searchSongs.title( "Song list" )
Label( searchSongs, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongs.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSongs.configure( background='white' )
searchSongs.tk.call( 'wm', 'iconphoto', searchSongs._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = """SELECT distinct artist_name from artist;"""
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_artist = []
for row in rows:
list_artist.append( row[0] )
searchSongs.wm_transient( root )
lblsecrow = tk.Label( searchSongs, text="Artist Name -" )
lblsecrow.place( x=50, y=50 )
def show():
text2 = label.config( text=menu.get() )
menu = StringVar()
menu.set( "Select Artist" )
drop = OptionMenu( searchSongs, menu, *list_artist )
drop.place( x=250, y=50 )
button = tk.Button( searchSongs, text="Click Me", command=show )
button.place( x=300, y=100 )
label = tk.Label( searchSongs, text="" )
label.place( x=150, y=100 )
lblsecrow.place( x=50, y=50 )
next2 = tk.Button( searchSongs, text="Show",
bg='light blue',
command=lambda: [self.searchSongArtistNameList( username, password, label ), self.submitact(),
searchSongs.withdraw()] )
next2.place( x=30, y=170, width=100 )
exit2 = tk.Button( searchSongs, text="Exit",
bg='light blue', command=exit )
exit2.place( x=180, y=170, width=100 )
mainmenu = tk.Button( searchSongs, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongs.withdraw()] )
mainmenu.place( x=100, y=235, width=100 )
#Search Song by Artist Name 2
def searchSongArtistNameList(self,username,password,label):
username = username
password = password
label = label.cget( "text" )
searchSongArtistNameList = Toplevel( root )
searchSongArtistNameList.title( "Songs List" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongArtistNameList.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSongArtistNameList.configure( background='white' )
searchSongArtistNameList.tk.call( 'wm', 'iconphoto', searchSongArtistNameList._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
Label( searchSongArtistNameList, font="Calibri, 12" ).pack()
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = """SELECT a.artist_name, group_concat(s.song_name) song_name
FROM artist a
LEFT JOIN song_artist sa ON a.artist_id=sa.artist_id
LEFT JOIN song s ON sa.song_id = s.song_id
WHERE a.artist_name='"""+label+"'GROUP BY a.artist_name;"
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_name = []
list_songs = []
for row in rows:
list_name.append( row[0] )
list_songs.append( row[1] )
label = tk.Label( searchSongArtistNameList, text="Artist Name: " )
label.place( x=50, y=100 )
label = tk.Label( searchSongArtistNameList, text=list_name )
label.place( x=200, y=100 )
label = tk.Label( searchSongArtistNameList, text="List of Songs: " )
label.place( x=50, y=150 )
label = tk.Label( searchSongArtistNameList, text=list_songs )
label.place( x=200, y=150 )
exit2 = tk.Button( searchSongArtistNameList, text="Exit",
bg='light blue', command=exit )
exit2.place( x=500, y=200, width=100 )
mainmenu = tk.Button( searchSongArtistNameList, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongArtistNameList.withdraw()] )
mainmenu.place( x=500, y=300, width=100 )
#Search Song By genre1
def searchSongGenreName(self,username,password):
username = username
password = password
searchSongGenreName = Toplevel( root )
searchSongGenreName.title( "Song list" )
Label( searchSongGenreName, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongGenreName.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
searchSongGenreName.configure( background='white' )
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = """SELECT distinct genre_name from GENRE;"""
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_genre = []
for row in rows:
list_genre.append( row[0] )
searchSongGenreName.wm_transient( root )
searchSongGenreName.tk.call( 'wm', 'iconphoto', searchSongGenreName._w, PhotoImage( file="Musicly.png" ) )
lblsecrow = tk.Label( searchSongGenreName, text="Genre Name -" )
lblsecrow.place( x=50, y=50 )
def show():
text2 = label.config( text=menu.get() )
menu = StringVar()
menu.set( "Select Genre" )
drop = OptionMenu( searchSongGenreName, menu, *list_genre )
drop.place( x=250, y=50 )
button = tk.Button( searchSongGenreName, text="Click Me", command=show )
button.place( x=300, y=100 )
label = tk.Label( searchSongGenreName, text="" )
label.place( x=150, y=100 )
lblsecrow.place( x=50, y=50 )
next2 = tk.Button( searchSongGenreName, text="Show",
bg='light blue',
command=lambda: [self.searchSongGenreNameList( username, password, label ),
self.submitact(),
searchSongGenreName.withdraw()] )
next2.place( x=30, y=170, width=100 )
exit2 = tk.Button( searchSongGenreName, text="Exit",
bg='light blue', command=exit )
exit2.place( x=180, y=170, width=100 )
mainmenu = tk.Button( searchSongGenreName, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongGenreName.withdraw()] )
mainmenu.place( x=100, y=235, width=100 )
#Search Song by Genre2
def searchSongGenreNameList(self,username,password,label):
username = username
password = password
label = label.cget( "text" )
searchSongGenreNameList = Toplevel( root )
searchSongGenreNameList.title( "Songs List" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongGenreNameList.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSongGenreNameList.tk.call( 'wm', 'iconphoto', searchSongGenreNameList._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
searchSongGenreNameList.configure( background='white' )
Label( searchSongGenreNameList, font="Calibri, 12" ).pack()
conn = pymysql.connect( host='localhost',
user= self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = "call songsGenreFetch('"+label+"');"
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_name = []
list_songs = []
for row in rows:
list_name.append( row[0] )
list_songs.append( row[1] )
label = tk.Label( searchSongGenreNameList, text="Genre Name: " )
label.place( x=50, y=100 )
label = tk.Label( searchSongGenreNameList, text=list_name )
label.place( x=200, y=100 )
label = tk.Label( searchSongGenreNameList, text="List of Songs: " )
label.place( x=50, y=150 )
label = tk.Label( searchSongGenreNameList, text=list_songs )
label.place( x=200, y=150 )
exit2 = tk.Button( searchSongGenreNameList, text="Exit",
bg='light blue', command=exit )
exit2.place( x=500, y=200, width=100 )
mainmenu = tk.Button( searchSongGenreNameList, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongGenreNameList.withdraw()] )
mainmenu.place( x=500, y=300, width=100 )
#Search Song by Language1
def searchSonglanguageName(self,username,password):
username = username
password = password
searchSonglanguageName = Toplevel( root )
searchSonglanguageName.title( "Song list" )
Label( searchSonglanguageName, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSonglanguageName.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSonglanguageName.configure( background='white' )
root.attributes( '-alpha', 0.00 )
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = """SELECT distinct language_name from LANGUAGE;"""
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_genre = []
for row in rows:
list_genre.append( row[0] )
searchSonglanguageName.wm_transient( root )
searchSonglanguageName.tk.call( 'wm', 'iconphoto', searchSonglanguageName._w, PhotoImage( file="Musicly.png" ) )
lblsecrow = tk.Label( searchSonglanguageName, text="Language Name -" )
lblsecrow.place( x=50, y=50 )
def show():
text2 = label.config( text=menu.get() )
menu = StringVar()
menu.set( "Select Language" )
drop = OptionMenu( searchSonglanguageName, menu, *list_genre )
drop.place( x=250, y=50 )
button = tk.Button( searchSonglanguageName, text="Click Me", command=show )
button.place( x=300, y=100 )
label = tk.Label( searchSonglanguageName, text="" )
label.place( x=150, y=100 )
lblsecrow.place( x=50, y=50 )
next2 = tk.Button( searchSonglanguageName, text="Show",
bg='light blue',
command=lambda: [self.searchSongLanguageNameList( username, password, label ),
self.submitact(),
searchSonglanguageName.withdraw()] )
next2.place( x=30, y=170, width=100 )
exit2 = tk.Button( searchSonglanguageName, text="Exit",
bg='light blue', command=exit )
exit2.place( x=180, y=170, width=100 )
mainmenu = tk.Button( searchSonglanguageName, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSonglanguageName.withdraw()] )
mainmenu.place( x=100, y=235, width=100 )
#Search Song by Language 2
def searchSongLanguageNameList(self,username,password,label):
username = username
password = password
label = label.cget( "text" )
searchSongLanguageNameList = Toplevel( root )
searchSongLanguageNameList.title( "Songs List" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongLanguageNameList.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSongLanguageNameList.tk.call( 'wm', 'iconphoto', searchSongLanguageNameList._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
Label( searchSongLanguageNameList, font="Calibri, 12" ).pack()
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = "call songsLanguageFetch('"+label+"');"
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_name = []
list_songs = []
for row in rows:
list_name.append( row[0] )
list_songs.append( row[1] )
label = tk.Label( searchSongLanguageNameList, text="Language Name: " )
label.place( x=50, y=100 )
label = tk.Label( searchSongLanguageNameList, text=list_name )
label.place( x=200, y=100 )
label = tk.Label( searchSongLanguageNameList, text="List of Songs: " )
label.place( x=50, y=150 )
label = tk.Label( searchSongLanguageNameList, text=list_songs )
label.place( x=200, y=150 )
exit2 = tk.Button( searchSongLanguageNameList, text="Exit",
bg='light blue', command=exit )
exit2.place( x=500, y=200, width=100 )
mainmenu = tk.Button( searchSongLanguageNameList, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongLanguageNameList.withdraw()] )
mainmenu.place( x=500, y=300, width=100 )
#Search Song by Mood1
def searchSongMoodName(self,username,password):
username = username
password = password
searchSongMoodName = Toplevel( root )
searchSongMoodName.title( "Song list" )
Label( searchSongMoodName, font="Calibri, 12" ).pack()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongMoodName.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
root.attributes( '-alpha', 0.00 )
searchSongMoodName.configure( background='white' )
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = """SELECT distinct mood_name from MOOD;"""
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_genre = []
for row in rows:
list_genre.append( row[0] )
searchSongMoodName.wm_transient( root )
searchSongMoodName.tk.call( 'wm', 'iconphoto', searchSongMoodName._w, PhotoImage( file="Musicly.png" ) )
lblsecrow = tk.Label( searchSongMoodName, text="Mood Name -" )
lblsecrow.place( x=50, y=50 )
def show():
text2 = label.config( text=menu.get() )
menu = StringVar()
menu.set( "Select Mood" )
drop = OptionMenu( searchSongMoodName, menu, *list_genre )
drop.place( x=250, y=50 )
button = tk.Button( searchSongMoodName, text="Click Me", command=show )
button.place( x=300, y=100 )
label = tk.Label( searchSongMoodName, text="" )
label.place( x=150, y=100 )
lblsecrow.place( x=50, y=50 )
next2 = tk.Button( searchSongMoodName, text="Show",
bg='light blue',
command=lambda: [self.searchSongMoodNameList( username, password, label ),
self.submitact(),
searchSongMoodName.withdraw()] )
next2.place( x=30, y=170, width=100 )
exit2 = tk.Button( searchSongMoodName, text="Exit",
bg='light blue', command=exit )
exit2.place( x=180, y=170, width=100 )
mainmenu = tk.Button( searchSongMoodName, text="Home",
bg='light blue',
command=lambda: [self.openNewWindowReturn( username, password ), self.submitact(),
searchSongMoodName.withdraw()] )
mainmenu.place( x=100, y=235, width=100 )
#Search Song by Mood2
def searchSongMoodNameList(self,username,password,label):
username = username
password = password
label = label.cget( "text" )
searchSongMoodNameList = Toplevel( root )
searchSongMoodNameList.title( "Songs List" )
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
width = 800
height = 600
x = (screen_width / 2) - (width / 2)
y = (screen_height / 2) - (height / 2)
searchSongMoodNameList.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
searchSongMoodNameList.tk.call( 'wm', 'iconphoto', searchSongMoodNameList._w, PhotoImage( file="Musicly.png" ) )
root.attributes( '-alpha', 0.00 )
Label( searchSongMoodNameList, font="Calibri, 12" ).pack()
conn = pymysql.connect( host='localhost',
user=self.username,
password=self.password,
db='musicly' )
cursor = conn.cursor()
cur1 = conn.cursor()
str1 = 'USE musicly; '
cur1.execute( str1 )
str = "call songsMoodFetch('"+label+"');"
cursor.execute( str )
conn.commit()
rows = cursor.fetchall()
list_name = []
list_songs = []
for row in rows:
list_name.append( row[0] )
list_songs.append( row[1] )
label = tk.Label( searchSongMoodNameList, text="Mood Name: " )
label.place( x=50, y=100 )
label = tk.Label( searchSongMoodNameList, text=list_name )
label.place( x=200, y=100 )
label = tk.Label( searchSongMoodNameList, text="List of Songs: " )
label.place( x=50, y=150 )
label = tk.Label( searchSongMoodNameList, text=list_songs )
label.place( x=200, y=150 )
exit2 = tk.Button( searchSongMoodNameList, text="Exit",
bg='light blue', command=exit )
exit2.place( x=500, y=200, width=100 )