Beispiel #1
0
    def load_playlist_contents(self):
        log.debug("")
        try:
            self.library.load_playlist_contents()

            log.debug("done")
            self.load_playlists_done_signal.emit()
        except Exception as e:  # pylint: disable-msg=broad-except
            print("load_playlist_contents caught exception", e)
            log.error("caught exception: %s", e)
Beispiel #2
0
    def play_playlist(self, playlist_id):
        log.debug(playlist_id)
        track_ids = self.library.playlist_contents.get(playlist_id)
        if track_ids is None:
            log.error("Unable to find playlist %s", playlist_id)
            return

        self.player.set_tracks_to_play(track_ids)
        self.player.shuffle_tracks()
        self.player.play_next_track()

        self.gui.set_track_list_content(track_ids, self.library)
Beispiel #3
0
    def force_worker_quit(self):
        try:
            if self.worker_thread.isRunning():
                # Gracefully quit, once the thread reaches the event loop
                self.worker_thread.quit()
                self.worker_thread.wait()

            if self.custom_worker_thread.isRunning():
                self.worker_interrupt_signal.emit()
                self.custom_worker_thread.wait()
        except Exception as e:  # pylint: disable-msg=broad-except
            log.error("caught exception: %s", e)
Beispiel #4
0
    def load_library(self):
        log.debug("")
        try:
            self.player.initialize()

            self.library.load_core()

            log.debug("done")
            self.load_library_done_signal.emit()
        except Exception as e:  # pylint: disable-msg=broad-except
            print("load_library caught exception", e)
            log.error("caught exception: %s", e)
Beispiel #5
0
    def set_track_list_content(self, song_ids, library):
        self.track_list_model.clear()
        unknown_song_str = "Unknown - Unknown"
        for song_id in song_ids:
            song_info = library.songs.get(song_id)
            song_str = unknown_song_str
            if song_info:
                song_str = "{0} - {1}".format(song_info['title'],
                                              song_info['artist'])
            else:
                log.error("Could not find track info for %s", song_id)

            item = QtGui.QStandardItem(song_str)
            self.track_list_model.appendRow(item)

        # first track always auto-plays right now
        self.set_selected_track_in_list(0)