fix: cleaning the song name deleted the song if the song name was the same as the artist name
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
8426f6e2ea
commit
36db651dfa
@ -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
|
# Remove artist from the start of the title
|
||||||
if raw_song_title.lower().startswith(artist_name.lower()):
|
if raw_song_title.lower().startswith(artist_name.lower()):
|
||||||
raw_song_title = raw_song_title[len(artist_name):].strip()
|
|
||||||
|
|
||||||
if raw_song_title.startswith("-"):
|
possible_new_name = raw_song_title[len(artist_name):].strip()
|
||||||
raw_song_title = raw_song_title[1:].strip()
|
|
||||||
|
for char in ("-", "–", ":", "|"):
|
||||||
|
if possible_new_name.startswith(char):
|
||||||
|
raw_song_title = possible_new_name[1:].strip()
|
||||||
|
break
|
||||||
|
|
||||||
return raw_song_title.strip()
|
return raw_song_title.strip()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user