fix: cleaning the song name deleted the song if the song name was the same as the artist name
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Hazel 2024-05-10 15:25:11 +02:00
parent 8426f6e2ea
commit 36db651dfa
1 changed files with 6 additions and 3 deletions

View File

@ -116,10 +116,13 @@ def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) ->
# Remove artist from the start of the title
if raw_song_title.lower().startswith(artist_name.lower()):
raw_song_title = raw_song_title[len(artist_name):].strip()
if raw_song_title.startswith("-"):
raw_song_title = raw_song_title[1:].strip()
possible_new_name = raw_song_title[len(artist_name):].strip()
for char in ("-", "", ":", "|"):
if possible_new_name.startswith(char):
raw_song_title = possible_new_name[1:].strip()
break
return raw_song_title.strip()