Beispiel #1
0
 async def get_connected_device(self, hsgid):
     self.dmap_service = DmapService("dmapid", hsgid, port=self.server.port)
     self.airplay_service = AirPlayService("airplay_id", self.server.port,
                                           DEVICE_CREDENTIALS)
     self.conf = AppleTV(ipaddress.IPv4Address("127.0.0.1"), "Apple TV")
     self.conf.add_service(self.dmap_service)
     self.conf.add_service(self.airplay_service)
     return await connect(self.conf, self.loop)
Beispiel #2
0
 async def get_connected_device(self, hsgid):
     self.dmap_service = DmapService('dmap_id',
                                     hsgid,
                                     port=self.server.port)
     self.airplay_service = AirPlayService('airplay_id', self.server.port,
                                           DEVICE_CREDENTIALS)
     self.conf = AppleTV('127.0.0.1', 'Apple TV')
     self.conf.add_service(self.dmap_service)
     self.conf.add_service(self.airplay_service)
     return await pyatv.connect(self.conf, self.loop)
Beispiel #3
0
    def setUp(self):
        AioHTTPTestCase.setUp(self)
        self.pairing = None

        self.service = DmapService("dmap_id",
                                   PAIRING_GUID,
                                   port=self.server.port)
        self.conf = AppleTV("127.0.0.1", "Apple TV")
        self.conf.add_service(self.service)

        self.zeroconf = zeroconf_stub.stub(pyatv.dmap.pairing)
Beispiel #4
0
def _manual_device(args):
    config = AppleTV(args.address, args.name)
    if args.dmap_credentials or args.protocol == const.Protocol.DMAP:
        config.add_service(
            DmapService(args.id, args.dmap_credentials, port=args.port))
    if args.mrp_credentials or args.protocol == const.Protocol.MRP:
        config.add_service(
            MrpService(args.id, args.port, credentials=args.mrp_credentials))
    if args.airplay_credentials:
        config.add_service(
            AirPlayService(args.id, credentials=args.airplay_credentials))
    return config
Beispiel #5
0
    def setUp(self):
        AioHTTPTestCase.setUp(self)
        self.pairing = None

        self.service = DmapService('dmap_id',
                                   PAIRING_GUID,
                                   port=self.server.port)
        self.conf = AppleTV('127.0.0.1', 'Apple TV')
        self.conf.add_service(self.service)

        # TODO: currently stubs internal method, should provide stub
        # for netifaces later
        pairing._get_private_ip_addresses = \
            lambda: [ipaddress.ip_address('10.0.0.1')]

        self.zeroconf = zeroconf_stub.stub(pyatv.dmap.pairing)
Beispiel #6
0
def _manual_device(args):
    config = AppleTV(IPv4Address(args.address), args.name)
    if args.dmap_credentials or args.protocol == const.Protocol.DMAP:
        config.add_service(
            DmapService(args.id, args.dmap_credentials, port=args.port))
    if args.mrp_credentials or args.protocol == const.Protocol.MRP:
        config.add_service(
            MrpService(args.id, args.port, credentials=args.mrp_credentials))
    if args.airplay_credentials or args.protocol == const.Protocol.AirPlay:
        config.add_service(
            AirPlayService(args.id, credentials=args.airplay_credentials))
    if args.companion_credentials or args.protocol == const.Protocol.Companion:
        config.add_service(
            CompanionService(args.port,
                             credentials=args.companion_credentials))
    if args.raop_credentials or args.protocol == const.Protocol.RAOP:
        config.add_service(
            RaopService(args.id, args.port, credentials=args.raop_credentials))
    return config
Beispiel #7
0
def _handle_commands(args, loop):
    details = AppleTV(args.address, args.name)
    if args.protocol == const.PROTOCOL_DMAP:
        details.add_service(DmapService(args.login_id, port=args.port))
    elif args.protocol == const.PROTOCOL_MRP:
        details.add_service(MrpService(args.port))

    atv = pyatv.connect_to_apple_tv(details, loop, protocol=args.protocol)
    atv.push_updater.listener = PushListener()

    try:
        if args.airplay_credentials is not None:
            yield from atv.airplay.load_credentials(args.airplay_credentials)

        for cmd in args.command:
            ret = yield from _handle_device_command(args, cmd, atv, loop)
            if ret != 0:
                return ret
    finally:
        yield from atv.logout()

    return 0
 def get_connected_device(self, identifier):
     conf = AppleTV('127.0.0.1', 'Apple TV')
     conf.add_service(DmapService(identifier, port=self.server.port))
     conf.add_service(AirPlayService(self.server.port))
     return connect_to_apple_tv(conf, self.loop)
Beispiel #9
0
 def get_connected_device(self, identifier):
     details = AppleTV('127.0.0.1', 'Apple TV')
     details.add_service(DmapService(identifier, port=self.app.port))
     details.add_service(AirPlayService(self.app.port))
     return connect_to_apple_tv(details, self.loop)