diff --git a/music_kraken/utils/string_processing.py b/music_kraken/utils/string_processing.py index b591604..00b6024 100644 --- a/music_kraken/utils/string_processing.py +++ b/music_kraken/utils/string_processing.py @@ -56,6 +56,7 @@ def fit_to_file_system(string: Union[str, Path]) -> Union[str, Path]: return fit_string(string) +@lru_cache(maxsize=128) def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) -> str: """ This function cleans common naming "conventions" for non clean song titles, like the title of youtube videos @@ -76,6 +77,9 @@ def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) -> # remove brackets and their content if they contain disallowed substrings for open_bracket, close_bracket in zip(OPEN_BRACKETS, CLOSE_BRACKETS): + if open_bracket not in raw_song_title or close_bracket not in raw_song_title: + continue + start = 0 while True: