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

33 lines
865 B
Python
Raw Normal View History

2023-03-29 13:22:18 +00:00
from typing import Tuple, Type, Dict
2023-03-28 10:50:23 +00:00
2023-05-23 11:59:24 +00:00
from ..utils.enums.source import SourcePages
from ..pages import Page, EncyclopaediaMetallum, Musify
2023-03-28 10:50:23 +00:00
2023-05-23 15:53:03 +00:00
NAME_PAGE_MAP: Dict[str, Page] = dict()
PAGE_NAME_MAP: Dict[Page, str] = dict()
SOURCE_PAGE_MAP: Dict[SourcePages, Page] = dict()
2023-03-29 13:22:18 +00:00
2023-05-23 15:53:03 +00:00
ALL_PAGES: Tuple[Page, ...] = (
EncyclopaediaMetallum(),
2023-05-24 16:02:19 +00:00
Musify()
)
2023-05-23 15:53:03 +00:00
AUDIO_PAGES: Tuple[Page, ...] = (
Musify(),
)
2023-05-23 15:53:03 +00:00
SHADY_PAGES: Tuple[Page, ...] = (
Musify(),
)
2023-03-28 10:50:23 +00:00
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
PAGE_NAME_MAP[page] = SHORTHANDS[i]
2023-03-30 10:09:36 +00:00
SOURCE_PAGE_MAP[page.SOURCE_TYPE] = page