Skip to content

Commit

Permalink
airplay: Disable AirPlay for macOS
Browse files Browse the repository at this point in the history
Pairing does not work towards macOS, so set Unsupported as pairing
requirement until I figure that out.
  • Loading branch information
postlund committed Jun 26, 2023
1 parent 3f054a0 commit 703dc74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyatv/protocols/airplay/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
PERCENTAGE_MIN = 0.0
PERCENTAGE_MAX = 100.0

UNSUPPORTED_MODELS = [r"^Mac\d+,\d+$"]


class AirPlayMajorVersion(Enum):
"""Major AirPlay protocol version."""
Expand Down Expand Up @@ -243,6 +245,13 @@ def update_service_details(service: MutableService):
# Access control might say that pairing is not possible, e.g. only devices
# belonging to the same home (not supported by pyatv)
service.pairing = PairingRequirement.Disabled
elif any(
re.match(model, service.properties.get("model", ""))
for model in UNSUPPORTED_MODELS
):
# Set as "unsupported" for devices we know that pyatv does
# (yet) support.
service.pairing = PairingRequirement.Unsupported
else:
service.pairing = get_pairing_requirement(service)

Expand Down
1 change: 1 addition & 0 deletions tests/protocols/airplay/test_airplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async def test_service_info_password(airplay_props, mrp_props, requires_password
({"flags": "0x200"}, {}, PairingRequirement.Mandatory),
({"acl": "1"}, {}, PairingRequirement.Disabled),
({"acl": "1", "sf": "0x200"}, {}, PairingRequirement.Disabled),
({"model": "Mac10,1"}, {}, PairingRequirement.Unsupported),
],
)
async def test_service_info_pairing(airplay_props, devinfo, pairing_req):
Expand Down

0 comments on commit 703dc74

Please sign in to comment.