Merge pull request #49 from Shraymonks/tvOS-detect

Check tvOS instead of specific atv models
This commit is contained in:
David
2023-05-28 18:31:00 +02:00
committed by GitHub

View File

@@ -1,7 +1,7 @@
import pyatv import pyatv
import json import json
import asyncio import asyncio
from pyatv.const import DeviceModel from pyatv.const import OperatingSystem
import sys import sys
import aiohttp import aiohttp
import asyncio import asyncio
@@ -28,14 +28,10 @@ async def find_atvs(loop):
atvs = [] atvs = []
for i in devices: for i in devices:
# Only get Apple TV's # Only get Apple TV's
if i.device_info.model in [ if (
DeviceModel.Gen4, i.device_info.operating_system == OperatingSystem.TvOS
DeviceModel.Gen4K, and input(f"Found {i.name}. Do you want to add it? (y/n) ") == "y"
DeviceModel.AppleTV4KGen2, ):
]:
# if i.device_info.model in [DeviceModel.AppleTV4KGen2]: #FOR TESTING
if input("Found {}. Do you want to add it? (y/n) ".format(i.name)) == "y":
identifier = i.identifier identifier = i.identifier
pairing = await pyatv.pair( pairing = await pyatv.pair(