def autoSetWindowTitle(self, currentSong, status): if 'title' in currentSong: windowTitle = currentSong['title'] else: windowTitle = OrpheusUtils.getFilename(currentSong) self.setWindowTitle(windowTitle) if status['state'] == 'play': icon = QIcon.fromTheme('media-playback-start') elif status['state'] == 'pause': icon = QIcon.fromTheme('media-playback-pause') else: icon = QIcon.fromTheme('media-playback-stop') self.setWindowIcon(icon)
def updateMusicLabels(self, currentSong): if 'title' in currentSong: self.titleLabel.setText(currentSong['title']) else: self.titleLabel.setText(OrpheusUtils.getFilename(currentSong)) album = '' if 'album' in currentSong: album = currentSong['album'] self.albumLabel.setVisible(True) self.albumFromLabel.setVisible(True) self.albumLabel.setText(album) else: self.albumLabel.setVisible(False) self.albumFromLabel.setVisible(False) if 'artist' in currentSong: artist = currentSong['artist'] artistList = artist.split(' & ') formattedArtist = artistList[0] artistCount = len(artistList) if artistCount == 1: self.artistAndLabel.setVisible(False) self.lastArtistLabel.setVisible(False) else: for i in range(1, len(artistList) - 1): formattedArtist = formattedArtist + ', ' + artistList[i] self.artistAndLabel.setVisible(True) self.lastArtistLabel.setText(artistList[artistCount - 1]) self.lastArtistLabel.setVisible(True) self.artistLabel.setText(formattedArtist) self.artistLabel.setVisible(True) self.artistFromLabel.setVisible(True) else: self.artistLabel.setVisible(False) self.artistFromLabel.setVisible(False) self.artistAndLabel.setVisible(False) self.lastArtistLabel.setVisible(False)