Пример #1
0
 def setUp(self):
     self.config = conf.AppleTV(ADDRESS_1, NAME)
     self.dmap_service = conf.DmapService(IDENTIFIER_1, None, port=PORT_1)
     self.mrp_service = conf.MrpService(
         IDENTIFIER_2, PORT_2, properties=MRP_PROPERTIES
     )
     self.airplay_service = conf.AirPlayService(
         IDENTIFIER_3, PORT_1, properties=AIRPLAY_PROPERTIES
     )
Пример #2
0
 def _airplay_service(
     self, mdns_service: mdns.Service, response: mdns.Response
 ) -> None:
     """Add a new AirPlay device to discovered list."""
     service = conf.AirPlayService(
         mdns_service.properties.get("deviceid"),
         mdns_service.port,
         properties=mdns_service.properties,
     )
     self._handle_service(mdns_service.address, mdns_service.name, service, response)
Пример #3
0
def full_device(mock_scan, dmap_pin):
    """Mock pyatv.scan."""
    mock_scan.result.append(
        create_conf(
            "127.0.0.1",
            "MRP Device",
            conf.MrpService("mrp_id", 5555),
            conf.DmapService("dmap_id", None, port=6666),
            conf.AirPlayService("airplay_id", port=7777),
        ))
    yield mock_scan
Пример #4
0
def test_equality(config):
    assert config == config

    atv2 = conf.AppleTV(ADDRESS_1, NAME)
    atv2.add_service(conf.AirPlayService(IDENTIFIER_1, PORT_1))
    assert config != atv2
Пример #5
0
    "osvers": "8.0.0",
}

RAOP_PROPERTIES = {
    "am": "AudioAccessory5,1",
    "ov": "14.5",
}

AIRPORT_PROPERTIES = {
    "am": "AirPort10,115",
}

DMAP_SERVICE = conf.DmapService(IDENTIFIER_1, None, port=PORT_1)
MRP_SERVICE = conf.MrpService(IDENTIFIER_2, PORT_2, properties=MRP_PROPERTIES)
AIRPLAY_SERVICE = conf.AirPlayService(IDENTIFIER_3,
                                      PORT_1,
                                      properties=AIRPLAY_PROPERTIES)
COMPANION_SERVICE = conf.CompanionService(PORT_3)
RAOP_SERVICE = conf.RaopService(IDENTIFIER_4,
                                PORT_4,
                                properties=RAOP_PROPERTIES)
AIRPORT_SERVICE = conf.RaopService(IDENTIFIER_1,
                                   PORT_1,
                                   properties=AIRPORT_PROPERTIES)


@pytest.fixture
def config():
    yield conf.AppleTV(ADDRESS_1,
                       NAME,
                       deep_sleep=True,
Пример #6
0
def airplay_device(mock_scan):
    """Mock pyatv.scan."""
    mock_scan.result.append(
        create_conf("127.0.0.1", "AirPlay Device",
                    conf.AirPlayService("airplay_id", port=7777)))
    yield mock_scan
Пример #7
0
 def _airplay_service(self, service_name, address, port, properties):
     """Add a new AirPlay device to discovered list."""
     identifier = properties.get("deviceid")
     name = service_name.replace("." + AIRPLAY_SERVICE, "")
     service = conf.AirPlayService(identifier, port, properties=properties)
     self._handle_service(address, name, service)
Пример #8
0
    def test_equality(self):
        self.assertEqual(self.config, self.config)

        atv2 = conf.AppleTV(ADDRESS_1, NAME)
        atv2.add_service(conf.AirPlayService(IDENTIFIER_1, PORT_1))
        self.assertNotEqual(self.config, atv2)
Пример #9
0
 def setUp(self):
     self.config = conf.AppleTV(ADDRESS_1, NAME)
     self.dmap_service = conf.DmapService(IDENTIFIER_1, None, port=PORT_1)
     self.mrp_service = conf.MrpService(IDENTIFIER_2, PORT_2)
     self.airplay_service = conf.AirPlayService(IDENTIFIER_3, PORT_1)
Пример #10
0
 def _airplay_service(self, service_name, address, port, properties):
     """Add a new AirPlay device to discovered list."""
     identifier = _property_decode(properties, 'deviceid')
     name = service_name.replace('.' + AIRPLAY_SERVICE, '')
     service = conf.AirPlayService(identifier, port)
     self._handle_service(address, name, service)
Пример #11
0
 def add_airplay_service(self, info, address):
     """Add a new AirPlay device to discovered list."""
     name = info.name.replace('._airplay._tcp.local.', '')
     self._handle_service(address, name, conf.AirPlayService(info.port))