feat: improved cleanup of song title
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
90a352153d
commit
a015b8918e
@ -161,3 +161,8 @@ class Collection(Generic[T]):
|
||||
|
||||
def __getitem__(self, item: int):
|
||||
return self._data[item]
|
||||
|
||||
def get(self, item: int, default = None):
|
||||
if item >= len(self._data):
|
||||
return default
|
||||
return self._data[item]
|
||||
|
@ -26,6 +26,7 @@ from ..objects import (
|
||||
)
|
||||
from ..utils.config import logging_settings
|
||||
from ..utils import string_processing, shared
|
||||
from ..utils.string_processing import clean_song_title
|
||||
from ..utils.support_classes.query import Query
|
||||
from ..utils.support_classes.download_result import DownloadResult
|
||||
|
||||
@ -355,8 +356,10 @@ class Musify(Page):
|
||||
if raw_id.isdigit():
|
||||
_id = raw_id
|
||||
|
||||
|
||||
|
||||
return Song(
|
||||
title=song_title,
|
||||
title=clean_song_title(song_title, artist_name=artist_list[0].name if len(artist_list) > 0 else None),
|
||||
main_artist_list=artist_list,
|
||||
source_list=source_list
|
||||
)
|
||||
@ -502,7 +505,7 @@ class Musify(Page):
|
||||
))
|
||||
|
||||
return Song(
|
||||
title=track_name,
|
||||
title=clean_song_title(track_name, artist_name=artist_list[0].name if len(artist_list) > 0 else None),
|
||||
source_list=source_list,
|
||||
lyrics_list=lyrics_list,
|
||||
main_artist_list=artist_list,
|
||||
@ -645,7 +648,7 @@ class Musify(Page):
|
||||
))
|
||||
|
||||
return Song(
|
||||
title=song_name,
|
||||
title=clean_song_title(song_name, artist_name=artist_list[0].name if len(artist_list) > 0 else None),
|
||||
tracksort=tracksort,
|
||||
main_artist_list=artist_list,
|
||||
source_list=source_list
|
||||
|
@ -93,7 +93,7 @@ def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) ->
|
||||
break
|
||||
|
||||
substring = raw_song_title[open_bracket_index + 1:close_bracket_index]
|
||||
if any(disallowed_substring in substring for disallowed_substring in DISALLOWED_SUBSTRING_IN_BRACKETS):
|
||||
if any(disallowed_substring in substring.lower() for disallowed_substring in DISALLOWED_SUBSTRING_IN_BRACKETS):
|
||||
raw_song_title = raw_song_title[:open_bracket_index] + raw_song_title[close_bracket_index + 1:]
|
||||
else:
|
||||
start = close_bracket_index + 1
|
||||
|
Loading…
Reference in New Issue
Block a user