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()