mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
♻️ Fixed Patched getting mixed
This commit is contained in:
@@ -49,7 +49,7 @@ apk_mirror_version_urls = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Downloader:
|
class Downloader(object):
|
||||||
_CHUNK_SIZE = 2**21 * 5
|
_CHUNK_SIZE = 2**21 * 5
|
||||||
_QUEUE = PriorityQueue()
|
_QUEUE = PriorityQueue()
|
||||||
_QUEUE_LENGTH = 0
|
_QUEUE_LENGTH = 0
|
||||||
@@ -172,7 +172,7 @@ class Downloader:
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
class Patches:
|
class Patches(object):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
logger.debug("fetching all patches")
|
logger.debug("fetching all patches")
|
||||||
resp = session.get(
|
resp = session.get(
|
||||||
@@ -246,29 +246,22 @@ class Patches:
|
|||||||
return patches, version
|
return patches, version
|
||||||
|
|
||||||
|
|
||||||
class ArgParser:
|
class ArgParser(object):
|
||||||
_PATCHES = []
|
def __init__(self):
|
||||||
_EXCLUDED = []
|
self._PATCHES = []
|
||||||
|
self._EXCLUDED = []
|
||||||
|
|
||||||
@classmethod
|
def include(self, name: str) -> None:
|
||||||
def include(cls, name: str) -> None:
|
self._PATCHES.extend(["-i", name])
|
||||||
cls._PATCHES.extend(["-i", name])
|
|
||||||
|
|
||||||
@classmethod
|
def exclude(self, name: str) -> None:
|
||||||
def exclude(cls, name: str) -> None:
|
self._PATCHES.extend(["-e", name])
|
||||||
cls._PATCHES.extend(["-e", name])
|
self._EXCLUDED.append(name)
|
||||||
cls._EXCLUDED.append(name)
|
|
||||||
|
|
||||||
@classmethod
|
def get_excluded_patches(self) -> List[Any]:
|
||||||
def get_excluded_patches(cls) -> List[Any]:
|
return self._EXCLUDED
|
||||||
return cls._EXCLUDED
|
|
||||||
|
|
||||||
@classmethod
|
def run(self, app: str, version: str, is_experimental: bool = False) -> None:
|
||||||
def reset_excluded_patches(cls) -> None:
|
|
||||||
cls._EXCLUDED = []
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def run(cls, app: str, version: str, is_experimental: bool = False) -> None:
|
|
||||||
logger.debug(f"Sending request to revanced cli for building {app} revanced")
|
logger.debug(f"Sending request to revanced cli for building {app} revanced")
|
||||||
args = [
|
args = [
|
||||||
"-jar",
|
"-jar",
|
||||||
@@ -294,8 +287,8 @@ class ArgParser:
|
|||||||
if app in ("reddit", "tiktok"):
|
if app in ("reddit", "tiktok"):
|
||||||
args.append("-r")
|
args.append("-r")
|
||||||
|
|
||||||
if cls._PATCHES:
|
if self._PATCHES:
|
||||||
args.extend(cls._PATCHES)
|
args.extend(self._PATCHES)
|
||||||
|
|
||||||
start = perf_counter()
|
start = perf_counter()
|
||||||
process = Popen(["java", *args], stdout=PIPE)
|
process = Popen(["java", *args], stdout=PIPE)
|
||||||
@@ -368,7 +361,6 @@ def main() -> None:
|
|||||||
logger.debug(f"Excluded patches {excluded} for {app}")
|
logger.debug(f"Excluded patches {excluded} for {app}")
|
||||||
else:
|
else:
|
||||||
logger.debug(f"No excluded patches for {app}")
|
logger.debug(f"No excluded patches for {app}")
|
||||||
arg_parser.reset_excluded_patches()
|
|
||||||
|
|
||||||
def get_patches_version() -> Any:
|
def get_patches_version() -> Any:
|
||||||
experiment = False
|
experiment = False
|
||||||
@@ -384,7 +376,7 @@ def main() -> None:
|
|||||||
for app in apps:
|
for app in apps:
|
||||||
try:
|
try:
|
||||||
is_experimental = False
|
is_experimental = False
|
||||||
arg_parser = ArgParser
|
arg_parser = ArgParser()
|
||||||
logger.debug("Trying to build %s" % app)
|
logger.debug("Trying to build %s" % app)
|
||||||
app_patches, version, is_experimental = get_patches_version()
|
app_patches, version, is_experimental = get_patches_version()
|
||||||
download_from_apkmirror(version, app, downloader)
|
download_from_apkmirror(version, app, downloader)
|
||||||
|
|||||||
Reference in New Issue
Block a user