Beispiel #1
0
    def __init__(
        self,
        loop,
        session_manager: ClientSessionManager,
        config: conf.AppleTV,
        airplay: Stream,
    ) -> None:
        """Initialize a new Apple TV."""
        super().__init__()
        self._session_manager = session_manager
        self._config = config
        self._dmap_service = config.get_service(Protocol.DMAP)
        assert self._dmap_service is not None
        daap_http = net.HttpSession(
            session_manager.session,
            f"http://{config.address}:{self._dmap_service.port}/",
        )
        self._requester = DaapRequester(daap_http,
                                        self._dmap_service.credentials)

        self._apple_tv = BaseDmapAppleTV(self._requester)
        self._dmap_remote = DmapRemoteControl(self._apple_tv)
        self._dmap_metadata = DmapMetadata(config.identifier, self._apple_tv)
        self._dmap_power = DmapPower()
        self._dmap_push_updater = DmapPushUpdater(loop, self._apple_tv, self)
        self._dmap_features = DmapFeatures(config, self._apple_tv)
        self._airplay = airplay
Beispiel #2
0
 def __init__(self, config, session, _):
     """Initialize a new MrpPairingHandler."""
     super().__init__(session, config.get_service(Protocol.AirPlay))
     self.srp = SRPAuthHandler()
     self.http = net.HttpSession(
         session, f"http://{config.address}:{self.service.port}/")
     self.authenticator = DeviceAuthenticator(self.http, self.srp)
     self.auth_data = self._setup_credentials()
     self.srp.initialize(binascii.unhexlify(self.auth_data.seed))
     self.pin_code = None
     self._has_paired = False
Beispiel #3
0
    async def _player(self, session: ClientSession) -> AirPlayPlayer:
        http = net.HttpSession(
            session, f"http://{self.config.address}:{self.service.port}/")
        player = AirPlayPlayer(self.loop, http)

        # If credentials have been loaded, do device verification first
        if self.credentials:
            srp = SRPAuthHandler()
            srp.initialize(binascii.unhexlify(self.credentials))
            verifier = AuthenticationVerifier(http, srp)
            await verifier.verify_authed()

        return player