From d9c711a2f8201e5a45367f0ac75a592c355dde10 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Fri, 19 Apr 2024 11:40:00 +0200 Subject: [PATCH] feat: added lru cache to unify function to speed up indexing --- development/actual_donwload.py | 2 +- music_kraken/download/page_attributes.py | 2 +- music_kraken/utils/shared.py | 2 +- music_kraken/utils/string_processing.py | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/development/actual_donwload.py b/development/actual_donwload.py index ed2a9de..abc5fe6 100644 --- a/development/actual_donwload.py +++ b/development/actual_donwload.py @@ -7,7 +7,7 @@ logging.getLogger().setLevel(logging.DEBUG) if __name__ == "__main__": commands = [ "s: #a Ghost Bath", - "4", + "d: 0", ] diff --git a/music_kraken/download/page_attributes.py b/music_kraken/download/page_attributes.py index e3881f6..ebd7423 100644 --- a/music_kraken/download/page_attributes.py +++ b/music_kraken/download/page_attributes.py @@ -14,7 +14,7 @@ from ..pages import Page, EncyclopaediaMetallum, Musify, YouTube, YoutubeMusic, ALL_PAGES: Set[Type[Page]] = { - EncyclopaediaMetallum, + # EncyclopaediaMetallum, Musify, YoutubeMusic, Bandcamp diff --git a/music_kraken/utils/shared.py b/music_kraken/utils/shared.py index 6676393..d1c0bb7 100644 --- a/music_kraken/utils/shared.py +++ b/music_kraken/utils/shared.py @@ -17,7 +17,7 @@ DEBUG_LOGGING = DEBUG and True DEBUG_TRACE = DEBUG and True DEBUG_OBJECT_TRACE = DEBUG and False DEBUG_YOUTUBE_INITIALIZING = DEBUG and False -DEBUG_PAGES = DEBUG and False +DEBUG_PAGES = DEBUG and True DEBUG_DUMP = DEBUG and True if DEBUG: diff --git a/music_kraken/utils/string_processing.py b/music_kraken/utils/string_processing.py index 570d18e..15ff683 100644 --- a/music_kraken/utils/string_processing.py +++ b/music_kraken/utils/string_processing.py @@ -1,6 +1,7 @@ from typing import Tuple, Union from pathlib import Path import string +from functools import lru_cache from transliterate.exceptions import LanguageDetectionError from transliterate import translit @@ -11,7 +12,7 @@ COMMON_TITLE_APPENDIX_LIST: Tuple[str, ...] = ( "(official video)", ) - +@lru_cache def unify(string: str) -> str: """ returns a unified str, to make comparisons easy.