From 2fff5db81e531a8d9482160c2d95d53d9d78a5b5 Mon Sep 17 00:00:00 2001 From: NFL_jiancx <1678594309@qq.com> Date: Sun, 9 Feb 2025 19:34:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NFLmusic.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/NFLmusic.py b/NFLmusic.py index 419318d..54794fb 100644 --- a/NFLmusic.py +++ b/NFLmusic.py @@ -879,7 +879,7 @@ def tick(): 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) 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) music_playing = abs_path else: @@ -888,7 +888,7 @@ def tick(): except ValueError: 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 try: lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc") @@ -957,7 +957,7 @@ def tick(): 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: refresh() music_dir_with_path = [path + "/" + file for file in os.listdir(path) if @@ -977,6 +977,7 @@ def former_song(): try: current_index = song_list.index(music_playing) except ValueError: + song_list.append(music_playing) current_index = -1 abs_path = song_list[current_index - 1] music_file_without_endswith = abs_path.rsplit("/")[-1].rsplit(".", 1)[0] @@ -1015,7 +1016,7 @@ def former_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: refresh() music_dir_with_path = [path + "/" + file for file in os.listdir(path) if @@ -1039,7 +1040,8 @@ def latter_song(): try: current_index = song_list.index(music_playing) except ValueError: - current_index = -1 + current_index = 0 + song_list.insert(0, music_playing) abs_path = song_list[current_index + 1] music_file_without_endswith = abs_path.split("/")[-1].rsplit(".", 1)[0] music_playing = abs_path @@ -1154,7 +1156,7 @@ def download_version(): copy(version_json[get_treeview_index(version_list, version_download_choice)]["password"]) -version = "4.0.9" +version = "4.0.10" poem = "" appdata = os.getenv("APPDATA") make_resource()