mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🎨 Moved extra downloader to download class
This commit is contained in:
committed by
Nikhil Badyal
parent
2d15330df3
commit
e2de08fee3
@@ -1,5 +1,4 @@
|
||||
"""Utilities."""
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -10,7 +9,6 @@ import requests
|
||||
from loguru import logger
|
||||
from requests import Response, Session
|
||||
|
||||
from src.config import RevancedConfig
|
||||
from src.downloader.sources import APK_MIRROR_APK_CHECK
|
||||
from src.downloader.utils import status_code_200
|
||||
from src.exceptions import ScrapingError
|
||||
@@ -173,32 +171,6 @@ def check_java() -> None:
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
from src.app import APP
|
||||
|
||||
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.")
|
||||
|
||||
|
||||
def delete_old_changelog() -> None:
|
||||
"""The function `delete_old_changelog` deleted old changelog file."""
|
||||
Path(changelog_file).unlink(missing_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user