Exemplo n.º 1
0
 def set_basic_infos(self, title, totalTime, album, path, size, musicId):
     artist, musicName = get_artist_and_musicname_from_title(title)
     self.title = title
     self.artist = artist
     self.musicName = musicName
     self.album = album
     self.path = path
     self.artistEdit.setText(artist)
     self.musicEdit.setText(musicName)
     self.albumEdit.setText(album)
     self.timeLabel.setText('时长: %s' % totalTime)
     self.sizeLabel.setText('大小: %.2f MB' % convert_B_to_MB(size))
     self.pathLabel.setText(path)
     trace = '线上资源'
     if musicId == Configures.LocalMusicId:
         trace = '本地资源'
     self.traceInfoLabel.setText('歌曲来源: %s' % trace)
     self.set_favorite_info(title in self.lovedSongs)
     item = get_base_name_from_path(path)
     freq, totalSpan, spanMax, nearPlaylistName, nearPlayedDate, nearPlayedTime = self.songinfosManager.get_statistic_infos_of_item(
         item)
     if freq:
         countInfos = '播放次数: %i 次#平均播放时长: %.1f 秒#最长播放时长: %.1f 秒' % (
             freq, totalSpan / freq, spanMax)
         nearPlaylistInfo = '最近播放位置: %s#最近播放时长: %.1f 秒' % (nearPlaylistName,
                                                           nearPlayedTime)
         nearPlayedDateInfo = '最近播放: %s' % format_time_str_with_weekday(
             nearPlayedDate)
     else:
         countInfos = '播放次数: 0 次'
         nearPlaylistInfo = '最近播放位置: 未曾播放'
         nearPlayedDateInfo = '最近播放: 未曾播放'
     self.countInfoLabel.setText(countInfos.replace('#', ' ' * 15))
     self.nearPlaylistLabel.setText(nearPlaylistInfo.replace('#', ' ' * 15))
     self.nearPlayedDateLabel.setText(nearPlayedDateInfo)
Exemplo n.º 2
0
 def set_basic_infos(self, title, totalTime, album, path, size, musicId):
     artist, musicName = get_artist_and_musicname_from_title(title)
     self.title = title
     self.artist = artist
     self.musicName = musicName
     self.album = album
     self.path = path
     self.artistEdit.setText(artist)
     self.musicEdit.setText(musicName)
     self.albumEdit.setText(album)
     self.timeLabel.setText('时长: %s'%totalTime)
     self.sizeLabel.setText('大小: %.2f MB'%convert_B_to_MB(size))
     self.pathLabel.setText(path)
     trace = '线上资源'
     if musicId == Configures.LocalMusicId:
         trace = '本地资源'
     self.traceInfoLabel.setText('歌曲来源: %s'%trace)
     self.set_favorite_info(title in self.lovedSongs)
     item = get_base_name_from_path(path)
     freq, totalSpan, spanMax, nearPlaylistName, nearPlayedDate, nearPlayedTime = self.songinfosManager.get_statistic_infos_of_item(item)
     if freq:
         countInfos = '播放次数: %i 次#平均播放时长: %.1f 秒#最长播放时长: %.1f 秒'%(freq, totalSpan/freq, spanMax)
         nearPlaylistInfo = '最近播放位置: %s#最近播放时长: %.1f 秒'%(nearPlaylistName,nearPlayedTime)
         nearPlayedDateInfo = '最近播放: %s'%format_time_str_with_weekday(nearPlayedDate)
     else:
         countInfos = '播放次数: 0 次'
         nearPlaylistInfo = '最近播放位置: 未曾播放'
         nearPlayedDateInfo = '最近播放: 未曾播放'
     self.countInfoLabel.setText(countInfos.replace('#', ' '*15))
     self.nearPlaylistLabel.setText(nearPlaylistInfo.replace('#', ' '*15))
     self.nearPlayedDateLabel.setText(nearPlayedDateInfo)
Exemplo n.º 3
0
 def update_progress(self, currentLength, totalLength):
     currentLength = int(currentLength)
     totalLength = int(totalLength)
     if self.progressBar.maximum() != totalLength:
         self.progressBar.setRange(0, totalLength)
     oldLength = self.progressBar.value()
     self.progressBar.setValue(currentLength)
     self.progressBar.update()
     self.sizeProgressLabel.setText('%.1fMB / %.1fMB'%(convert_B_to_MB(currentLength), convert_B_to_MB(totalLength)))
     self.netSpeed = (currentLength - oldLength) / (1024 * self.timeSpan)
     self.statusLabel.setText('%.2f KB/s'%self.netSpeed)