Skip to content
Snippets Groups Projects
Commit 0dd0f32b authored by Christoph Stahl's avatar Christoph Stahl
Browse files

Improved checking for duplicate performers in queue

parent a38dedee
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ from __future__ import annotations ...@@ -3,6 +3,7 @@ from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from dataclasses import field from dataclasses import field
import re
from typing import Any from typing import Any
from typing import Optional from typing import Optional
from uuid import UUID from uuid import UUID
...@@ -64,8 +65,8 @@ class Entry: ...@@ -64,8 +65,8 @@ class Entry:
""" """
Update the attributes with given substitutions. Update the attributes with given substitutions.
:param \*\*kwargs: Keywords taken from the list of attributes. :param \\*\\*kwargs: Keywords taken from the list of attributes.
:type \*\*kwargs: Any :type \\*\\*kwargs: Any
:rtype: None :rtype: None
""" """
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
...@@ -74,8 +75,19 @@ class Entry: ...@@ -74,8 +75,19 @@ class Entry:
def normalize(performers: str) -> set[str]: def normalize(performers: str) -> set[str]:
return set( return set(
filter( filter(
lambda x: len(x) > 3, lambda x: len(x) > 0
performers.replace(",", " ").replace(".", " ").split(" "), and x not in ["der", "die", "das", "alle", "und"],
re.sub(
r"[^a-zA-Z0-9\s]",
"",
re.sub(
r"\s",
" ",
performers.lower()
.replace(".", " ")
.replace(",", " "),
),
).split(" "),
) )
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment