🎨 Moved extra downloader to download class

This commit is contained in:
Nikhil Badyal
2023-09-02 17:26:21 +05:30
committed by Nikhil Badyal
parent 2d15330df3
commit e2de08fee3
3 changed files with 27 additions and 30 deletions
+24
View File
@@ -132,3 +132,27 @@ class Downloader(object):
def direct_download(self: Self, dl: str, file_name: str) -> None:
"""Download from DL."""
self._download(dl, file_name)
@staticmethod
def extra_downloads(config: RevancedConfig) -> None:
"""The function `extra_downloads` downloads extra files specified.
Parameters
----------
config : RevancedConfig
The `config` parameter is an instance of the `RevancedConfig` class. It is used to provide
configuration settings for the download process.
"""
try:
for extra in config.extra_download_files:
url, file_name = extra.split("@")
file_name_without_extension, file_extension = os.path.splitext(file_name)
new_file_name = f"{file_name_without_extension}-output{file_extension}"
APP.download(
url,
config,
assets_filter=f".*{file_extension}",
file_name=new_file_name,
)
except (ValueError, IndexError):
logger.info("Unable to download extra file. Provide input in url@name.apk format.")