Пример #1
0
def music_player():  #function defination
    mi.init()
    mu.set_volume(0.7)
    mu.load(random.choice(songs))
    print(
        "*******************************************************************")
    print("\t\tWELCOME TO MY MUSIC_PLAYER")
    print(
        "*******************************************************************")
    print("press 'a' to PLAY | press 'r' to RESUME | press 'n' for next song")
    print("press 's' to STOP | press 'p' to PAUSE")
    print(
        "--------------------------------------------------------------------\n"
    )
    while True:
        query = input("")
        if query == 'a':
            mu.play()
            print("Player Start!")
        elif query == 'r':
            mu.unpause()
            print("Song resume")
        elif query == 'p':
            print("song pause!")
            mu.pause()
        elif query == 'n':
            print("Listen next song!")
            mu.stop()
            time.sleep(1)
            mu.load(random.choice(songs))
            mu.play()
        elif query == 's':
            mu.stop()
            break
    print("Player get quit !")
Пример #2
0
    def play(self):
        global first_play
        if first_play is False:
            mixer_music.stop()
        else:
            first_play = False
            self.worker = Worker(self.path_and_file)
            if self.threadpool.activeThreadCount() == 1:
                mixer.quit()

            self.threadpool.start(self.worker)
Пример #3
0
def sideController(event):
    global auxSlide, playtime, progressBar
    if music.get_busy():
        music.play(0, (event.x / 450) * auxSlide)
        music.stop()
        playtime = (event.x / 450) * auxSlide
        progressBar.set(playtime)
        music.load(playlist[currentSong])
        music.play(0, (event.x / 450) * auxSlide)
    else:
        music.play(0, (event.x / 450) * auxSlide)
        music.stop()
        playtime = (event.x / 450) * auxSlide
        progressBar.set(playtime)
        music.load(playlist[currentSong])
Пример #4
0
 def prev_song(self):
     if self.is_file_get:
         self.song_ptr -= 1
         if self.song_ptr < 0:
             showinfo(title='Info', message='First music of list')
             self.song_ptr = 0
         try:
             mx.stop()
         except Exception as e:
             pass
         data = mx.load(self.listfile[self.song_ptr])
         mx.play()
         self.playing = True
     else:
         showinfo(title="Directory not found",
                  message='Directory is not set')
Пример #5
0
 def next_song(self):
     if self.is_file_get:
         self.song_ptr += 1
         if self.song_ptr == len(self.listfile) - 1:
             showinfo(title='Info', message='End of list')
             self.song_ptr = 0
         try:
             mx.stop()
         except Exception as e:
             pass
         data = mx.load(self.listfile[self.song_ptr])
         mx.play()
         self.playing = True
     else:
         showinfo(title="Directory not found",
                  message='Directory is not set')
Пример #6
0
def nextSong():
    global playtime, auxSlide, currentSong, progressBar, currentSongNameLabel, pathToFile
    music.stop()
    playtime = 0
    progressBar.set(0)
    if currentSong == len(playlist) - 1:
        music.load(playlist[0])
        music.play(0, 0)
        currentSong = 0
    else:
        music.load(playlist[currentSong + 1])
        music.play(0, 0)
        currentSong = currentSong + 1
    changeName(currentSongNameLabel)
    audio = MP3(playlist[currentSong])
    auxSlide = audio.info.length
    progressBar.configure(to=auxSlide)
Пример #7
0
def playSong():
    global playtime
    global firstClick
    global pausePlayClock

    if firstClick == 1:
        music.play(0)
        playButton['text'] = 'Pause'
        firstClick = 0
    else:
        if (pausePlayClock == 1):
            music.play(0, playtime)
            playButton['text'] = 'Pause'
            pausePlayClock = 0
        else:
            music.stop()
            playButton['text'] = 'Play!'
            pausePlayClock = 1
    window.after(1000, loopScale)
Пример #8
0
 def stop_music(self):
     music_player.stop()
     self.now_playing = None
Пример #9
0
def stopMusic():
    player.stop()
Пример #10
0
    interface4.interface1 = interface1
    interface4.interface2 = interface2
    interface4.interface3 = interface3
    interface4.interface4 = interface4
    interface4.interface5 = interface5
    interface4.interface6 = interface6

    interface5.interface1 = interface1
    interface5.interface2 = interface2
    interface5.interface3 = interface3
    interface5.interface4 = interface4
    interface5.interface5 = interface5
    interface5.interface6 = interface6

    interface6.interface1 = interface1
    interface6.interface2 = interface2
    interface6.interface3 = interface3
    interface6.interface4 = interface4
    interface6.interface5 = interface5

    interface7.interfaceAcceuil = interface1

    interface8.interfaceAcceuil = interface1

    music.play(-1)

    #Lancement
    fen.mainloop()

    music.stop()