コード例 #1
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
 def on_ok_button(self):
     '''ok button callback'''
     logging.info(
         'Entered callback function in MainWindow: on_ok_button(self)')
     show_notification("Stop!", "Please don't push this button again")
     self.play_list.play_next()
     self.play_list.current_notify()
コード例 #2
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
    def current_notify(self):
        """display the curront song information using show_notification"""
        logging.info(
            'Entered function in PlayListManager: current_notify(self)')

        line2 = self.current_song['album'] + "\n" + self.current_song['track']
        show_notification(self.current_song['artist'], line2)
コード例 #3
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
 def volume_down(self, prcnt=10):
     """turn the volume down 10% by default"""
     logging.info(
         'Entered function in PlayListManager: volume_down(self,prcnt=10)')
     self.current_volume = vlc.libvlc_audio_get_volume(self.player)
     self.current_volume = self.current_volume - prcnt
     if self.current_volume < 0:
         self.current_volume = 0
     vlc.libvlc_audio_set_volume(self.player, self.current_volume)
     show_notification("Volume", str(self.current_volume))
コード例 #4
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
 def volume_up(self, prcnt=10):
     '''pump up the volume 10% by default'''
     logging.info(
         'Entered function in PlayListManager: volume_up(self,prcnt=10)')
     self.current_volume = vlc.libvlc_audio_get_volume(self.player)
     self.current_volume = self.current_volume + prcnt
     if self.current_volume > 100:
         self.current_volume = 100
     vlc.libvlc_audio_set_volume(self.player, self.current_volume)
     show_notification("Volume", str(self.current_volume))
コード例 #5
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
    def play_random(self):
        '''return and remove a random song object from the playlist to be played'''
        logging.info('Entered function in PlayListManager: play_random(self)')

        songs_in_list = len(self.playlist)
        print("playlist contains", songs_in_list, "songs.")
        if songs_in_list > 0:
            song_pick = random.randint(0, songs_in_list - 1)
            pick = self.playlist.pop(song_pick)
            self.play(pick)
        else:
            show_notification("Nothing to play",
                              "random function has nothing to do")
コード例 #6
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
    def play_next(self):
        '''pop the next song off the playlist add it to played songs
         ironically, this doesn't actually play it, and needs to be renamed
         It uses the new play function to reuse the code with shuffle option'''
        logging.info('Entered function in PlayListManager: play_next(self)')

        songs_remaining = len(self.playlist)
        show_notification("songs remaining: ", str(songs_remaining), 1)

        if songs_remaining > 0:
            trak = self.playlist.pop(0)
            self.play(trak)
        else:
            show_notification("Nothing to play", "nothing to do")
コード例 #7
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
    def on_load_button(self):
        '''load button notify and callback'''
        logging.info(
            'Entered callback function in MainWindow: on_load_button(self)')
        #        load_files = tkinter.filedialog.askdirectory()

        load_files = tutil.read_dir(os.getcwd())
        print(load_files)
        #      if the user selects dumb files, it should do nothing gracefully
        # and so we know read_dir is too generic a name...
        #lets count files actually added
        file_count = len(load_files)
        print(file_count)
        pth = os.getcwd()
        for fname in load_files:
            full_path = os.path.join(pth, fname)
            self.play_list.add_song(full_path)
        msg = "Added " + str(file_count) + " songs successfully"
        show_notification("Playlist", msg)
        return file_count
コード例 #8
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
 def play(self, song_dict):
     '''play a track from a song object'''
     logging.info('Entered function in PlayListManager: play(self)')
     print("The beginning of the play function...")
     _file = song_dict['file']
     self.player.stop()
     fresh = self._cache.update_cache(_file)
     if fresh:
         logging.info("Track is fresh, starting to play")
         #            print("This is where we actually do the dirty work")
         self.current_song = song_dict
         media = self.instance.media_new(_file)
         self.player.set_media(media)
         self.player.play()
         header = song_dict['artist']
         body = song_dict['album'] + "\n" + song_dict['track']
         show_notification(header, body, 0)
     else:
         show_notification("Skipping", "You already heard that one", 0)
         self.play_random()
コード例 #9
0
ファイル: minimus.py プロジェクト: ThomasFluckiger/minimus
 def get_volume(self):
     '''return the volume and show a notification'''
     logging.info('Entered function in PlayListManager: get_volume(self)')
     vol_ = vlc.libvlc_audio_get_volume(self.player)
     show_notification("Volume", vol_)
     return vol_