mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2025-12-11 14:36:44 +03:00
Combine ifs
This commit is contained in:
@@ -28,27 +28,28 @@ 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.operating_system == OperatingSystem.TvOS:
|
if (
|
||||||
if input("Found {}. Do you want to add it? (y/n) ".format(i.name)) == "y":
|
i.device_info.operating_system == OperatingSystem.TvOS
|
||||||
|
and input("Found {}. Do you want to add it? (y/n) ".format(i.name)) == "y"
|
||||||
|
):
|
||||||
|
identifier = i.identifier
|
||||||
|
|
||||||
identifier = i.identifier
|
pairing = await pyatv.pair(
|
||||||
|
i, loop=loop, protocol=pyatv.Protocol.AirPlay
|
||||||
|
)
|
||||||
|
await pairing.begin()
|
||||||
|
if pairing.device_provides_pin:
|
||||||
|
pin = await _read_input(loop, "Enter PIN on screen: ")
|
||||||
|
pairing.pin(pin)
|
||||||
|
|
||||||
pairing = await pyatv.pair(
|
await pairing.finish()
|
||||||
i, loop=loop, protocol=pyatv.Protocol.AirPlay
|
if pairing.has_paired:
|
||||||
|
creds = pairing.service.credentials
|
||||||
|
atvs.append(
|
||||||
|
{"identifier": identifier, "airplay_credentials": creds}
|
||||||
)
|
)
|
||||||
await pairing.begin()
|
print("Pairing successful")
|
||||||
if pairing.device_provides_pin:
|
await pairing.close()
|
||||||
pin = await _read_input(loop, "Enter PIN on screen: ")
|
|
||||||
pairing.pin(pin)
|
|
||||||
|
|
||||||
await pairing.finish()
|
|
||||||
if pairing.has_paired:
|
|
||||||
creds = pairing.service.credentials
|
|
||||||
atvs.append(
|
|
||||||
{"identifier": identifier, "airplay_credentials": creds}
|
|
||||||
)
|
|
||||||
print("Pairing successful")
|
|
||||||
await pairing.close()
|
|
||||||
return atvs
|
return atvs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user