misc
This commit is contained in:
parent
645d1c49c0
commit
d27bc450f5
@ -20,6 +20,6 @@ class LyricsResult:
|
|||||||
confidence: int
|
confidence: int
|
||||||
time: float = 0.00
|
time: float = 0.00
|
||||||
|
|
||||||
def todict(self):
|
def todict(self) -> dict:
|
||||||
"""Return as dict"""
|
"""Return as dict"""
|
||||||
return asdict(self)
|
return asdict(self)
|
@ -18,7 +18,7 @@ class Aggregate:
|
|||||||
Aggregate all source methods
|
Aggregate all source methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, exclude_methods=None):
|
def __init__(self, exclude_methods=None) -> None:
|
||||||
if not exclude_methods:
|
if not exclude_methods:
|
||||||
exclude_methods: list = []
|
exclude_methods: list = []
|
||||||
self.exclude_methods = exclude_methods
|
self.exclude_methods = exclude_methods
|
||||||
|
@ -22,7 +22,7 @@ log_level = logging.getLevelName(logger.level)
|
|||||||
|
|
||||||
class Cache:
|
class Cache:
|
||||||
"""Cache Search Module"""
|
"""Cache Search Module"""
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
self.cache_db: str = os.path.join("/", "var",
|
self.cache_db: str = os.path.join("/", "var",
|
||||||
"lib", "singerdbs",
|
"lib", "singerdbs",
|
||||||
"cached_lyrics.db")
|
"cached_lyrics.db")
|
||||||
|
@ -27,7 +27,7 @@ class InvalidResponseException(Exception):
|
|||||||
|
|
||||||
class Genius:
|
class Genius:
|
||||||
"""Genius Search Module"""
|
"""Genius Search Module"""
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
self.label: str = "Genius"
|
self.label: str = "Genius"
|
||||||
self.genius_url: str = private.GENIUS_URL
|
self.genius_url: str = private.GENIUS_URL
|
||||||
self.genius_search_url: str = f'{self.genius_url}api/search/song?q='
|
self.genius_search_url: str = f'{self.genius_url}api/search/song?q='
|
||||||
|
@ -23,7 +23,7 @@ class InvalidResponseException(Exception):
|
|||||||
|
|
||||||
class LRCLib:
|
class LRCLib:
|
||||||
"""LRCLib Search Module"""
|
"""LRCLib Search Module"""
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
self.label: str = "LRCLib"
|
self.label: str = "LRCLib"
|
||||||
self.lrclib_url: str = "https://lrclib.net/api/search"
|
self.lrclib_url: str = "https://lrclib.net/api/search"
|
||||||
self.headers: dict = common.SCRAPE_HEADERS
|
self.headers: dict = common.SCRAPE_HEADERS
|
||||||
|
@ -30,12 +30,12 @@ class RedisCache:
|
|||||||
Redis Cache Methods
|
Redis Cache Methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
self.redis_client = redis.Redis(password=private.REDIS_PW)
|
self.redis_client = redis.Redis(password=private.REDIS_PW)
|
||||||
self.notifier = notifier.DiscordNotifier()
|
self.notifier = notifier.DiscordNotifier()
|
||||||
self.notify_warnings = True
|
self.notify_warnings = True
|
||||||
|
|
||||||
async def create_index(self):
|
async def create_index(self) -> None:
|
||||||
"""Create Index"""
|
"""Create Index"""
|
||||||
try:
|
try:
|
||||||
schema = (
|
schema = (
|
||||||
@ -51,7 +51,7 @@ class RedisCache:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
await self.notifier.send(f"ERROR @ {__file__}", f"Failed to create idx: {str(e)}")
|
await self.notifier.send(f"ERROR @ {__file__}", f"Failed to create idx: {str(e)}")
|
||||||
|
|
||||||
async def search(self, **kwargs):
|
async def search(self, **kwargs) -> list[tuple]:
|
||||||
"""
|
"""
|
||||||
Search Redis Cache
|
Search Redis Cache
|
||||||
Args:
|
Args:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user