mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
read limit from api request query for search
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import hashlib
|
||||
import re
|
||||
|
||||
from unidecode import unidecode
|
||||
|
||||
@@ -14,6 +15,7 @@ def create_hash(*args: str, decode=False, limit=10) -> str:
|
||||
|
||||
str_ = str_.lower().strip().replace(" ", "")
|
||||
str_ = "".join(t for t in str_ if t.isalnum())
|
||||
str_ = re.sub(r"[^a-zA-Z0-9\s]", "", str_)
|
||||
str_ = str_.encode("utf-8")
|
||||
str_ = hashlib.sha256(str_).hexdigest()
|
||||
return str_[-limit:]
|
||||
|
||||
@@ -133,6 +133,8 @@ def get_album_info(bracket_text: str | None) -> list[str]:
|
||||
if not bracket_text:
|
||||
return []
|
||||
|
||||
# replace all non-alphanumeric characters with an empty string
|
||||
bracket_text = re.sub(r"[^a-zA-Z0-9\s]", "", bracket_text)
|
||||
versions = []
|
||||
|
||||
for version_keywords in AlbumVersionEnum:
|
||||
|
||||
Reference in New Issue
Block a user