Esempio n. 1
0
 def add_song_to_favourite(self):
     fav_song_tuple=self.playList.curselection()
     try:
         if(len(fav_song_tuple)==0):
             raise noSongSelectError("plzz select a song to add favourite")
         song_name=self.playList.get(fav_song_tuple[0])
         result=self.my_player.add_to_favourites(song_name)
         messagebox.showinfo("Sucess",result)
         rcolor = lambda: random.randint(0, 255)
         red = hex(rcolor())
         green = hex(rcolor())
         blue = hex(rcolor())
         red = red[2:]
         green = green[2:]
         blue = blue[2:]
         if len(red) == 1:
             red = '0' + red
         if len(green) == 1:
             green = '0'+ green
         if len(blue) == 1:
             blue = '0' + blue
         mycolor = '#' + red + green + blue
         self.playList.config(fg=mycolor)
     except(noSongSelectError)as ex:
         messagebox.showerror("ERROR!", ex)
     except cx_Oracle.DatabaseError :
         print(traceback.format_exc())
         messagebox.showerror("some error")
Esempio n. 2
0
 def remove_song(self):
     self.song_index_remove = self.playList.curselection()
     print("value of curselection", self.song_index)
     # print("size of list in playlist", len(self.playList.opt))
     try:
         if (len(self.song_index_remove) == 0):
             raise noSongSelectError("plzz select a song")
         self.song_name = self.playList.get(self.song_index_remove[0])
         self.my_player.remove_song(self.song_name)
         self.playList.delete(self.song_index_remove[0])
     except noSongSelectError as ex:
         messagebox.showerror("ERROR", ex)
Esempio n. 3
0
 def remove_song_to_favourite(self):
     fav_song_tuple = self.playList.curselection()
     try:
         if (len(fav_song_tuple) == 0):
             raise noSongSelectError("plzz select a song to add favourite")
         song_name = self.playList.get(fav_song_tuple[0])
         result = self.my_player.remove_song_favourite(song_name)
         messagebox.showinfo("Sucess", result)
     except(noSongSelectError)as ex:
         messagebox.showerror("ERROR!", ex)
     except cx_Oracle.DatabaseError:
         print(traceback.format_exc())
         messagebox.showerror("some error")
Esempio n. 4
0
 def previous_song(self):
     print("total song in dict", self.my_player.getSong_count())
     try:
         if hasattr(self,"song_index")==False:
             raise noSongSelectError("plzz select a song")
         self.pre_song_index=self.song_index[0]-1
         if self.pre_song_index==-1:
             self.pre_song_index=self.my_player.getSong_count()-1
         self.playList.select_clear(0,tk.END)
         self.playList.select_set(self.pre_song_index)
         self.play_song()
         if(self.isPaused):
             self.isPaused=False
     except(noSongSelectError)as ex:
         messagebox.showerror("ERROR!",ex)
Esempio n. 5
0
 def play_song(self):
     if(self.isThreadRunning==True):
         self.isPaused = False
         self.my_player.stop_song()
         self.isThreadRunning=False
         self.isPlaying=False
         self.stopThread=True
         time.sleep(1)
     self.song_index=self.playList.curselection()
     print("value of curselection",self.song_index)
     try:
         if (len(self.song_index) == 0):
             raise noSongSelectError("plzz select a song")
         self.song_name=self.playList.get(self.song_index[0])
         self.show_song_details()
         self.my_player.song_play()
         self.change_volume(self.vol_scale.get())
         self.songProgress.config(length=self.song_length)
         self.songProgress.config(maximum=self.song_length)
         self.setup_thread()
     except noSongSelectError as ex:
         messagebox.showerror("ERROR",ex)