mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 11:58:37 +09:00
♻️ Modularized downloader
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Downloader Factory."""
|
||||
from src.config import RevancedConfig
|
||||
from src.downloader.apkmirror import ApkMirror
|
||||
from src.downloader.apkpure import ApkPure
|
||||
from src.downloader.apksos import ApkSos
|
||||
from src.downloader.download import Downloader
|
||||
from src.downloader.uptodown import UptoDown
|
||||
from src.patches import Patches
|
||||
|
||||
|
||||
class DownloaderFactory(object):
|
||||
"""Downloader Factory."""
|
||||
|
||||
@staticmethod
|
||||
def create_downloader(
|
||||
app: str, patcher: Patches, config: RevancedConfig
|
||||
) -> Downloader:
|
||||
"""Returns appropriate downloader.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
app : App Name
|
||||
patcher : Patcher
|
||||
config : Config
|
||||
"""
|
||||
if app in config.apk_pure:
|
||||
return ApkPure(patcher, config)
|
||||
elif app in config.apk_sos:
|
||||
return ApkSos(patcher, config)
|
||||
elif app in config.upto_down:
|
||||
return UptoDown(patcher, config)
|
||||
else:
|
||||
return ApkMirror(patcher, config)
|
||||
Reference in New Issue
Block a user