diff --git a/README.md b/README.md index 0d66d12..c201cc1 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,21 @@ By default, script build the version as recommended by Revanced team. fact to define your normal configurations in `.env` file and sometimes if you want to build something different just once. Add it in `GitHub secrets`.
Or you can ignore what I said above and always use `GitHub secrets`. -13. Sample Envs
+13. If APKMirror or other apk source is blocked in your region or script somehow is unable to download from apkmirror. + You can download apk manually from any source. Place them in `/apks` directory and provide environment variable + in `.env` file or in `ENVS` in `GitHub secrets`(Recommended) in the format. + ```dotenv + EXISTING_DOWNLOADED_APKS= + ``` + Example: + ```dotenv + EXISTING_DOWNLOADED_APKS=youtube,youtube_music + ``` + If you add above. Script will not download the `Youtube` & `youtube music`apk from internet and expects an apk in + `/apks` folder. + + Name of the downloaded apk must match with the available app choices found [here.](#note) +14. Sample Envs
Thanks to [@aliharslan0](https://github.com/aliharslan0/pyrevanced) for his work. diff --git a/src/config.py b/src/config.py index b7566ac..d67d856 100644 --- a/src/config.py +++ b/src/config.py @@ -83,3 +83,4 @@ class RevancedConfig: self.alternative_youtube_music_patches = env.list( "ALTERNATIVE_YOUTUBE_MUSIC_PATCHES", [] ) + self.existing_downloaded_apks = env.list("EXISTING_DOWNLOADED_APKS", []) diff --git a/src/downloader.py b/src/downloader.py index bd614c2..809f11d 100644 --- a/src/downloader.py +++ b/src/downloader.py @@ -272,8 +272,12 @@ class Downloader(object): :param version: version to download :param app: App to download - :return: Version of apk + :return: Version of apk. """ + if app in self.config.existing_downloaded_apks: + logger.debug("Will not download apk from the internet as it already exist.") + # Returning Latest as I don't know, which version user provided. + return "latest" if app in self.config.upto_down: return self.upto_down_downloader(app) elif app in self.config.apk_pure: