2023-05-26 07:00:02 +00:00
|
|
|
from typing import Tuple, Type, Dict, List
|
|
|
|
import threading
|
|
|
|
from queue import Queue
|
2023-03-28 10:50:23 +00:00
|
|
|
|
2023-05-23 11:59:24 +00:00
|
|
|
from ..utils.enums.source import SourcePages
|
2023-05-26 07:00:02 +00:00
|
|
|
from ..utils.support_classes import Query, EndThread
|
2023-05-23 11:59:24 +00:00
|
|
|
from ..pages import Page, EncyclopaediaMetallum, Musify
|
|
|
|
|
2023-05-26 07:00:02 +00:00
|
|
|
ALL_PAGES: Tuple[Type[Page], ...] = (
|
|
|
|
EncyclopaediaMetallum,
|
|
|
|
Musify
|
2023-03-28 12:04:15 +00:00
|
|
|
)
|
|
|
|
|
2023-05-26 07:00:02 +00:00
|
|
|
AUDIO_PAGES: Tuple[Type[Page], ...] = (
|
|
|
|
Musify,
|
2023-03-28 12:04:15 +00:00
|
|
|
)
|
|
|
|
|
2023-05-26 07:00:02 +00:00
|
|
|
SHADY_PAGES: Tuple[Type[Page], ...] = (
|
|
|
|
Musify,
|
2023-03-28 12:04:15 +00:00
|
|
|
)
|
2023-03-28 10:50:23 +00:00
|
|
|
|
2023-05-26 07:00:02 +00:00
|
|
|
|
|
|
|
exit_threads = EndThread()
|
|
|
|
search_queue: Queue[Query] = Queue()
|
|
|
|
|
|
|
|
_page_threads: Dict[Type[Page], List[Page]] = dict()
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
2023-05-23 15:53:03 +00:00
|
|
|
# this needs to be case-insensitive
|
2023-03-29 13:22:18 +00:00
|
|
|
SHORTHANDS = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
|
|
|
|
for i, page in enumerate(ALL_PAGES):
|
2023-05-23 15:53:03 +00:00
|
|
|
NAME_PAGE_MAP[type(page).__name__.lower()] = page
|
2023-03-30 07:01:09 +00:00
|
|
|
NAME_PAGE_MAP[SHORTHANDS[i].lower()] = page
|
2023-03-29 13:22:18 +00:00
|
|
|
|
2023-05-25 11:46:47 +00:00
|
|
|
PAGE_NAME_MAP[type(page)] = SHORTHANDS[i]
|
2023-03-30 10:09:36 +00:00
|
|
|
|
|
|
|
SOURCE_PAGE_MAP[page.SOURCE_TYPE] = page
|
2023-05-26 07:00:02 +00:00
|
|
|
"""
|