修复了歌曲切换部分歌名显示不完全
This commit is contained in:
18
NFLmusic.py
18
NFLmusic.py
@ -851,7 +851,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].splite(".")[0]
|
||||
music_playing = abs_path
|
||||
try:
|
||||
lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc")
|
||||
@ -930,7 +930,7 @@ def former_song():
|
||||
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.insert(0, abs_path)
|
||||
music_playing = abs_path
|
||||
else:
|
||||
@ -939,7 +939,7 @@ def former_song():
|
||||
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.rsplit("/")[-1].split(".", 1)[0]
|
||||
music_playing = abs_path
|
||||
try:
|
||||
lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc")
|
||||
@ -954,7 +954,7 @@ def former_song():
|
||||
file.endswith(('.mp3', '.flac', '.ogg', '.m4a'))]
|
||||
try:
|
||||
music_file_name = music_dir[music_dir.index(music_playing.split("/")[-1]) - 1]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].split(".")[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].rsplit(".", 1)[0]
|
||||
abs_path = path + "/" + music_file_name
|
||||
music_playing = abs_path
|
||||
try:
|
||||
@ -963,7 +963,7 @@ def former_song():
|
||||
lyric = {}
|
||||
except IndexError:
|
||||
music_file_name = music_dir[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].split(".")[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].rsplit(".", 1)[0]
|
||||
music_playing = path + "/" + music_file_name
|
||||
try:
|
||||
lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc")
|
||||
@ -988,7 +988,7 @@ def latter_song():
|
||||
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:
|
||||
@ -997,7 +997,7 @@ def latter_song():
|
||||
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")
|
||||
@ -1012,7 +1012,7 @@ def latter_song():
|
||||
file.endswith(('.mp3', '.flac', '.ogg', '.m4a'))]
|
||||
try:
|
||||
music_file_name = music_dir[music_dir.index(music_playing.split("/")[-1]) + 1]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].split(".")[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].rsplit(".", 1)[0]
|
||||
abs_path = path + "/" + music_file_name
|
||||
music_playing = abs_path
|
||||
try:
|
||||
@ -1021,7 +1021,7 @@ def latter_song():
|
||||
lyric = {}
|
||||
except IndexError:
|
||||
music_file_name = music_dir[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].split(".")[0]
|
||||
music_file_without_endswith = music_file_name.split("/")[-1].rsplit(".", 1)[0]
|
||||
music_playing = path + "/" + music_file_name
|
||||
try:
|
||||
lyric = lyrics.load_lyrics(f"{path}/{music_file_without_endswith}.lrc")
|
||||
|
1
tools/test.py
Normal file
1
tools/test.py
Normal file
@ -0,0 +1 @@
|
||||
"".rsplit()
|
Reference in New Issue
Block a user