From 5af95f1b0310b4db6b559d0825990d54d3d63553 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Fri, 24 May 2024 15:46:42 +0200 Subject: [PATCH] feat: auto import pages in page module --- music_kraken/pages/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/music_kraken/pages/__init__.py b/music_kraken/pages/__init__.py index 83a147c..bda24f4 100644 --- a/music_kraken/pages/__init__.py +++ b/music_kraken/pages/__init__.py @@ -1,9 +1,23 @@ +import logging from collections import defaultdict +from pathlib import Path from typing import Dict, Generator, List, Set, Type +""" from ._bandcamp import Bandcamp from ._encyclopaedia_metallum import EncyclopaediaMetallum from ._genius import Genius from ._musify import Musify from ._youtube import YouTube from ._youtube_music import YoutubeMusic +""" + +_page_directory = Path(__file__).parent +_stem_blacklist = set(["__pycache__", "__init__"]) + +for _file in _page_directory.iterdir(): + if _file.stem in _stem_blacklist: + continue + + logging.debug(f"importing {_file.absolute()}") + exec(f"from . import {_file.stem}")