diff --git a/syng/entry.py b/syng/entry.py index a69684f..bb1350f 100644 --- a/syng/entry.py +++ b/syng/entry.py @@ -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(" ")) - ) - e2_split_names = set( - filter(lambda x: len(x) > 3, other_performer.split(" ")) - ) + def normalize(performers: str) -> set[str]: + return set( + filter( + lambda x: len(x) > 3, + performers.replace(",", " ").replace(".", " ").split(" "), + ) + ) + + e1_split_names = normalize(self.performer) + e2_split_names = normalize(other_performer) return len(e1_split_names.intersection(e2_split_names)) > 0 diff --git a/syng/server.py b/syng/server.py index 58840fe..3ad57af 100644 --- a/syng/server.py +++ b/syng/server.py @@ -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.