Skip to content

Commit

Permalink
A bunch of small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Apr 3, 2024
1 parent 26986b2 commit 37ac88f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion i18n/en_US.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"lyrics": "Lyrics",
"songList": "Song List",
"audioInfo": "Audio Info",
"settings": "Settings"
"settings": "Settings",
"onlineMusic": "Online Music"
}

songList = {
Expand Down
2 changes: 1 addition & 1 deletion i18n/lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion i18n/zh_CN.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"lyrics": "歌词",
"songList": "播放列表",
"audioInfo": "媒体信息",
"settings": "设置"
"settings": "设置",
"onlineMusic": "在线歌曲"
}

songList = {
Expand Down
2 changes: 1 addition & 1 deletion lib/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
18 changes: 16 additions & 2 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
audioListShown = False
firstPlay = True
audioLoaded = None
toastImportError = False
currentDir = os.path.dirname(os.path.abspath(__file__))
os.chdir(currentDir)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -226,6 +227,7 @@ def audioInfoUpdate():
else:
audioArtistAndAlbum.value = work.audioArtistText
audioCover.update()
onlineAudioSign.visible = False
page.update()

# 网络音频信息更新
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37ac88f

Please sign in to comment.