修复已知问题,优化用户体验

This commit is contained in:
2025-02-09 19:34:42 +08:00
parent 7d6b484309
commit 2fff5db81e

View File

@ -879,7 +879,7 @@ def tick():
song_list_full = [song for song in music_dir_with_path if song not in song_list] song_list_full = [song for song in music_dir_with_path if song not in song_list]
random_index = randint(0, len(song_list_full) - 1) random_index = randint(0, len(song_list_full) - 1)
abs_path = song_list_full[random_index] abs_path = song_list_full[random_index]
music_file_without_endswith = abs_path.split("/")[-1].split(".")[0] music_file_without_endswith = abs_path.split("/")[-1].rsplit(".", 1)[0]
song_list.append(abs_path) song_list.append(abs_path)
music_playing = abs_path music_playing = abs_path
else: else:
@ -888,7 +888,7 @@ def tick():
except ValueError: except ValueError:
current_index = -1 current_index = -1
abs_path = song_list[current_index + 1] abs_path = song_list[current_index + 1]
music_file_without_endswith = abs_path.split("/")[-1].split(".")[0] music_file_without_endswith = abs_path.split("/")[-1].rsplit(".", 1)[0]
music_playing = abs_path music_playing = abs_path
try: try:
lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc") lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc")
@ -957,7 +957,7 @@ def tick():
def former_song(): def former_song():
global music_playing, lyric, music_file_name, song_list, song_list_limit global music_playing, lyric, music_file_name, song_list, song_list_limit, music_file_without_endswith
if playingmode == 1: if playingmode == 1:
refresh() refresh()
music_dir_with_path = [path + "/" + file for file in os.listdir(path) if music_dir_with_path = [path + "/" + file for file in os.listdir(path) if
@ -977,6 +977,7 @@ def former_song():
try: try:
current_index = song_list.index(music_playing) current_index = song_list.index(music_playing)
except ValueError: except ValueError:
song_list.append(music_playing)
current_index = -1 current_index = -1
abs_path = song_list[current_index - 1] abs_path = song_list[current_index - 1]
music_file_without_endswith = abs_path.rsplit("/")[-1].rsplit(".", 1)[0] music_file_without_endswith = abs_path.rsplit("/")[-1].rsplit(".", 1)[0]
@ -1015,7 +1016,7 @@ def former_song():
def latter_song(): def latter_song():
global music_playing, lyric, music_file_name, song_list, song_list_limit global music_playing, lyric, music_file_name, song_list, song_list_limit, music_file_without_endswith
if playingmode == 1: if playingmode == 1:
refresh() refresh()
music_dir_with_path = [path + "/" + file for file in os.listdir(path) if music_dir_with_path = [path + "/" + file for file in os.listdir(path) if
@ -1039,7 +1040,8 @@ def latter_song():
try: try:
current_index = song_list.index(music_playing) current_index = song_list.index(music_playing)
except ValueError: except ValueError:
current_index = -1 current_index = 0
song_list.insert(0, music_playing)
abs_path = song_list[current_index + 1] abs_path = song_list[current_index + 1]
music_file_without_endswith = abs_path.split("/")[-1].rsplit(".", 1)[0] music_file_without_endswith = abs_path.split("/")[-1].rsplit(".", 1)[0]
music_playing = abs_path music_playing = abs_path
@ -1154,7 +1156,7 @@ def download_version():
copy(version_json[get_treeview_index(version_list, version_download_choice)]["password"]) copy(version_json[get_treeview_index(version_list, version_download_choice)]["password"])
version = "4.0.9" version = "4.0.10"
poem = "" poem = ""
appdata = os.getenv("APPDATA") appdata = os.getenv("APPDATA")
make_resource() make_resource()