diff --git a/i18n/en_US.py b/i18n/en_US.py index 45f5c23..7c31012 100644 --- a/i18n/en_US.py +++ b/i18n/en_US.py @@ -80,7 +80,8 @@ "lyrics": "Lyrics", "songList": "Song List", "audioInfo": "Audio Info", - "settings": "Settings" + "settings": "Settings", + "onlineMusic": "Online Music" } songList = { diff --git a/i18n/lang.py b/i18n/lang.py index 7f4a13d..d5a9b17 100644 --- a/i18n/lang.py +++ b/i18n/lang.py @@ -23,7 +23,7 @@ def loadLang(): global langCode, langInfo, infomation, menuBar, mainMenu, tooltips, songList, dialog, update, sets - if langCode == 'zh_CN': + if 'zh_CN' in langCode: langInfo = zh_CN.langInfo infomation = zh_CN.infomation menuBar = zh_CN.menuBar diff --git a/i18n/zh_CN.py b/i18n/zh_CN.py index a74c7f6..69748e2 100644 --- a/i18n/zh_CN.py +++ b/i18n/zh_CN.py @@ -80,7 +80,8 @@ "lyrics": "歌词", "songList": "播放列表", "audioInfo": "媒体信息", - "settings": "设置" + "settings": "设置", + "onlineMusic": "在线歌曲" } songList = { diff --git a/lib/work.py b/lib/work.py index 0aa9b87..4bb1545 100644 --- a/lib/work.py +++ b/lib/work.py @@ -107,7 +107,7 @@ def audioFromUrlInfo(audioID): # 网站音频信息更新 audioAlbumText = ID_json['songs'][0]['al']['name'] playAudio.src = audioUrl currentLength = secondConvert(0) - audioInfo = "Album: " + str(audioAlbumText) + "\nArtist: " + str(audioArtistText) + audioInfo = "Album: " + str(audioAlbumText) + "\nArtist: " + str(audioArtistText) + "\nTitle: " + str(audioTitleText) + "\nNetease Cloud Music ID: " + str(audioID) return True elif ID_json['songs'] == [] or ID_json['code'] != 200: log_init.logging.warning("Invalid input") diff --git a/player.py b/player.py index 7c1949f..89b8f9c 100644 --- a/player.py +++ b/player.py @@ -16,6 +16,7 @@ audioListShown = False firstPlay = True audioLoaded = None +toastImportError = False currentDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(currentDir) @@ -186,7 +187,7 @@ def readSong(audioPathTemp): if cfg.cfgData["play"][0]["immediatelyPlay"] == True: global audioLoaded while(True): - time.sleep(1) + time.sleep(0.001) if audioLoaded == True: playOrPauseMusic(0) audioLoaded = False @@ -226,6 +227,7 @@ def audioInfoUpdate(): else: audioArtistAndAlbum.value = work.audioArtistText audioCover.update() + onlineAudioSign.visible = False page.update() # 网络音频信息更新 @@ -251,7 +253,18 @@ def audioFromUrlInfo(e): songID_input.error_text = "" audioCover.update() lyricUrlRead(songID) + onlineAudioSign.visible = True closeSongWeb_dlg(e) + if work.audioState == True: + playOrPauseMusic(0) + if cfg.cfgData["play"][0]["immediatelyPlay"] == True: + global audioLoaded + while(True): + time.sleep(0.001) + if audioLoaded == True: + playOrPauseMusic(0) + audioLoaded = False + break elif getReturn == "vipSongOrNoCopyright": songID_input.error_text = lang.dialog["vipOrNoCopyrightAlert"] elif getReturn == False: @@ -749,9 +762,10 @@ def viewPop(e): audioCover = ft.Image(src = "./asset/track.png", width = 128, height = 128, border_radius = 8) audioTitle = ft.Text(audioTitleText, weight = ft.FontWeight.BOLD, size = 25, overflow = ft.TextOverflow.ELLIPSIS) + onlineAudioSign = ft.Icon(ft.icons.WIFI_OUTLINED, size = 16, visible = False, tooltip = lang.tooltips["onlineMusic"]) audioArtistAndAlbum = ft.Text(audioArtistText, size = 18, opacity = 90) audioProgressStatus = ft.Text("00:00/00:00", size = 15, opacity = 90) - audioDetail = ft.Column(controls = [audioTitle, audioArtistAndAlbum, audioProgressStatus]) + audioDetail = ft.Column(controls = [ft.Row(controls = [audioTitle, onlineAudioSign]), audioArtistAndAlbum, audioProgressStatus]) audioBasicInfo = ft.Container(content = ft.Row(controls = [audioCover, audioDetail]), padding = 3) audioProgressBar = ft.Slider(min = 0, max = 1000, tooltip = lang.tooltips["audioPosition"], on_change_start = autoStopKeepAudioProgress, on_change_end = progressCtrl) work.playAudio.on_loaded = loadAudio