mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
32 lines
1.6 KiB
Python
32 lines
1.6 KiB
Python
import dependency_injector.containers as containers
|
|
import dependency_injector.providers as providers
|
|
from dynamic_preferences.registries import global_preferences_registry
|
|
from YtManagerApp.management.appconfig import AppConfig
|
|
from YtManagerApp.management.download_manager import DownloadManager
|
|
from YtManagerApp.management.subscription_manager import SubscriptionManager
|
|
from YtManagerApp.management.video_manager import VideoManager
|
|
from YtManagerApp.management.video_provider_manager import VideoProviderManager
|
|
from YtManagerApp.management.youtube_dl_manager import YoutubeDlManager
|
|
from YtManagerApp.scheduler.scheduler import YtsmScheduler
|
|
|
|
|
|
class VideoProviders(containers.DeclarativeContainer):
|
|
from YtManagerApp.providers.ytapi_video_provider import YouTubeApiVideoProvider
|
|
from YtManagerApp.providers.dummy_video_provider import DummyVideoProvider
|
|
ytApiProvider = providers.Factory(YouTubeApiVideoProvider)
|
|
dummyProvider = providers.Factory(DummyVideoProvider)
|
|
|
|
|
|
class Services(containers.DeclarativeContainer):
|
|
globalPreferencesRegistry = providers.Object(global_preferences_registry.manager())
|
|
appConfig = providers.Singleton(AppConfig, globalPreferencesRegistry)
|
|
scheduler = providers.Singleton(YtsmScheduler, appConfig)
|
|
youtubeDLManager = providers.Singleton(YoutubeDlManager)
|
|
videoManager = providers.Singleton(VideoManager)
|
|
videoProviderManager = providers.Singleton(VideoProviderManager, [
|
|
VideoProviders.ytApiProvider(),
|
|
VideoProviders.dummyProvider(),
|
|
])
|
|
subscriptionManager = providers.Singleton(SubscriptionManager)
|
|
downloadManager = providers.Singleton(DownloadManager)
|