mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-24 19:38:36 +09:00
🐛 Handle a case when user enters invalid app for rebuilding
This commit is contained in:
@@ -8,6 +8,7 @@ from src.config import RevancedConfig
|
||||
from src.downloader import Downloader
|
||||
from src.parser import Parser
|
||||
from src.patches import Patches
|
||||
from src.utils import AppNotFound
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@@ -25,35 +26,51 @@ def main() -> None:
|
||||
logger.info("Trying to build %s" % app)
|
||||
app_all_patches, version, is_experimental = patcher.get_app_configs(app)
|
||||
version = downloader.download_apk_to_patch(version, app)
|
||||
config.app_versions[app] = version
|
||||
patcher.include_exclude_patch(app, parser, app_all_patches)
|
||||
logger.info(f"Downloaded {app}, version {version}")
|
||||
parser.patch_app(app=app, version=version, is_experimental=is_experimental)
|
||||
except AppNotFound as e:
|
||||
logger.info(f"Invalid app requested to build {e}")
|
||||
except Exception as e:
|
||||
logger.exception(f"Failed to build {app} because of {e}")
|
||||
if len(config.alternative_youtube_patches):
|
||||
if len(config.alternative_youtube_patches) and "youtube" in config.apps:
|
||||
for alternative_patch in config.alternative_youtube_patches:
|
||||
logger.info(f"Rebuilding youtube with inverted ${alternative_patch} patch.")
|
||||
_, version, is_experimental = patcher.get_app_configs("youtube")
|
||||
parser.invert_patch(alternative_patch)
|
||||
parser.patch_app(
|
||||
app="youtube",
|
||||
version=version,
|
||||
is_experimental=is_experimental,
|
||||
output_prefix="-" + alternative_patch + "-",
|
||||
)
|
||||
if len(config.alternative_youtube_music_patches):
|
||||
was_inverted = parser.invert_patch(alternative_patch)
|
||||
if was_inverted:
|
||||
logger.info(
|
||||
f"Rebuilding youtube with inverted {alternative_patch} patch."
|
||||
)
|
||||
parser.patch_app(
|
||||
app="youtube",
|
||||
version=config.app_versions.get("youtube", "latest"),
|
||||
is_experimental=is_experimental,
|
||||
output_prefix="-" + alternative_patch + "-",
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
f"Skipping Rebuilding youtube as {alternative_patch} patch was not found."
|
||||
)
|
||||
if len(config.alternative_youtube_music_patches) and "youtube_music" in config.apps:
|
||||
for alternative_patch in config.alternative_youtube_music_patches:
|
||||
logger.info(
|
||||
f"Rebuilding youtube music with inverted ${alternative_patch} patch."
|
||||
)
|
||||
|
||||
_, version, is_experimental = patcher.get_app_configs("youtube_music")
|
||||
parser.invert_patch(alternative_patch)
|
||||
parser.patch_app(
|
||||
app="youtube_music",
|
||||
version=version,
|
||||
is_experimental=is_experimental,
|
||||
output_prefix="-" + alternative_patch + "-",
|
||||
)
|
||||
was_inverted = parser.invert_patch(alternative_patch)
|
||||
if was_inverted:
|
||||
logger.info(
|
||||
f"Rebuilding youtube music with inverted {alternative_patch} patch."
|
||||
)
|
||||
parser.patch_app(
|
||||
app="youtube_music",
|
||||
version=config.app_versions.get("youtube_music", "latest"),
|
||||
is_experimental=is_experimental,
|
||||
output_prefix="-" + alternative_patch + "-",
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
f"Skipping Rebuilding youtube music as {alternative_patch} patch was not found."
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user