mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Log unexpected droidcast response
This commit is contained in:
parent
ceebb216e0
commit
f6c56e1940
@ -162,6 +162,8 @@ class DroidCast(Uiautomator2):
|
||||
raise ImageTruncated('Empty image after reading from buffer')
|
||||
if image.shape == (1843200,):
|
||||
raise DroidCastVersionIncompatible('Requesting screenshots from `DroidCast` but server is `DroidCast_raw`')
|
||||
if image.size < 500:
|
||||
logger.warning(f'Unexpected screenshot: {resp.content}')
|
||||
|
||||
image = cv2.imdecode(image, cv2.IMREAD_COLOR)
|
||||
if image is None:
|
||||
@ -182,6 +184,8 @@ class DroidCast(Uiautomator2):
|
||||
try:
|
||||
arr = np.frombuffer(image, dtype=np.uint16).reshape((720, 1280))
|
||||
except ValueError as e:
|
||||
if len(image) < 500:
|
||||
logger.warning(f'Unexpected screenshot: {image}')
|
||||
# Try to load as `DroidCast`
|
||||
image = np.frombuffer(image, np.uint8)
|
||||
if image is not None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user