Seperate at commas for performer names
This commit is contained in:
parent
f7f5e5d7e9
commit
57e55363d9
2 changed files with 12 additions and 8 deletions
|
@ -61,7 +61,7 @@ class Entry:
|
|||
started_at: Optional[float] = None
|
||||
|
||||
def update(self, **kwargs: Any) -> None:
|
||||
r"""
|
||||
"""
|
||||
Update the attributes with given substitutions.
|
||||
|
||||
:param \*\*kwargs: Keywords taken from the list of attributes.
|
||||
|
@ -71,11 +71,15 @@ class Entry:
|
|||
self.__dict__.update(kwargs)
|
||||
|
||||
def shares_performer(self, other_performer: str) -> bool:
|
||||
e1_split_names = set(
|
||||
filter(lambda x: len(x) > 3, self.performer.split(" "))
|
||||
def normalize(performers: str) -> set[str]:
|
||||
return set(
|
||||
filter(
|
||||
lambda x: len(x) > 3,
|
||||
performers.replace(",", " ").replace(".", " ").split(" "),
|
||||
)
|
||||
e2_split_names = set(
|
||||
filter(lambda x: len(x) > 3, other_performer.split(" "))
|
||||
)
|
||||
|
||||
e1_split_names = normalize(self.performer)
|
||||
e2_split_names = normalize(other_performer)
|
||||
|
||||
return len(e1_split_names.intersection(e2_split_names)) > 0
|
||||
|
|
|
@ -230,7 +230,7 @@ async def append_to_queue(
|
|||
room: str, entry: Entry, report_to: Optional[str] = None
|
||||
) -> None:
|
||||
"""
|
||||
Append an song to the queue for a given session.
|
||||
Append a song to the queue for a given session.
|
||||
|
||||
Checks, if the computed start time is before the configured end time of the
|
||||
event, and reports an error, if the end time is exceeded.
|
||||
|
|
Loading…
Add table
Reference in a new issue