@@ -41,7 +41,15 @@ def get_download_link(devicecode: str) -> Optional[str]:
4141
4242
4343def image_works_with_device (supported_device_codes : List [str ], image_path : str ) -> bool :
44- """Determine if an image works for the given device."""
44+ """Determine if an image works for the given device.
45+
46+ Args:
47+ supported_device_codes: List of supported device codes from the config file.
48+ image_path: Path to the image file.
49+
50+ Returns:
51+ True if the image works with the device, False otherwise.
52+ """
4553 with zipfile .ZipFile (image_path ) as image_zip :
4654 with image_zip .open (
4755 "META-INF/com/android/metadata" , mode = "r"
@@ -77,13 +85,24 @@ def image_sdk_level(image_path: str) -> int:
7785 return 0
7886
7987
80- def recovery_works_with_device (device_code : str , recovery_path : str ) -> bool :
88+ def recovery_works_with_device (
89+ supported_device_codes : List [str ], recovery_path : str
90+ ) -> bool :
8191 """Determine if a recovery works for the given device.
8292
8393 BEWARE: THE RECOVERY PART IS STILL VERY BASIC!
94+
95+ Args:
96+ supported_device_codes: List of supported device codes from the config file.
97+ recovery_path: Path to the recovery file.
98+
99+ Returns:
100+ True if the recovery works with the device, False otherwise.
84101 """
85102 recovery_file_name = recovery_path .split ("/" )[- 1 ]
86- if (device_code in recovery_file_name ) and ("twrp" in recovery_file_name ):
103+ if any (code in recovery_file_name for code in supported_device_codes ) and (
104+ "twrp" in recovery_file_name
105+ ):
87106 logger .success ("Device supported by the selected recovery." )
88107 return True
89108 else :
0 commit comments