read limit from api request query for search

This commit is contained in:
mungai-njoroge
2023-08-20 23:06:16 +03:00
parent 2471f51d86
commit 68c2cf1909
5 changed files with 40 additions and 14 deletions
+2
View File
@@ -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:]
+2
View File
@@ -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: