music-kraken-core/src/music_kraken/download/page_attributes.py

39 lines
973 B
Python
Raw Normal View History

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
from ..utils.support_classes import Query, EndThread
2023-05-23 11:59:24 +00:00
from ..pages import Page, EncyclopaediaMetallum, Musify
ALL_PAGES: Tuple[Type[Page], ...] = (
EncyclopaediaMetallum,
Musify
)
AUDIO_PAGES: Tuple[Type[Page], ...] = (
Musify,
)
SHADY_PAGES: Tuple[Type[Page], ...] = (
Musify,
)
2023-03-28 10:50:23 +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
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
"""