Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 2cb3a46

Browse files
sdagueballoob
authored andcommitted
Add support for yamaha receiver discovery (#54)
1 parent 6a059f2 commit 2cb3a46

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

netdisco/discoverables/yamaha.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Discover Yamaha Receivers."""
2+
from netdisco.util import urlparse
3+
from . import SSDPDiscoverable
4+
5+
6+
class Discoverable(SSDPDiscoverable):
7+
"""Add support for discovering Yamaha Receivers."""
8+
9+
def info_from_entry(self, entry):
10+
"""Return the most important info from a uPnP entry."""
11+
descurl = entry.values['location']
12+
url = urlparse(entry.values['location'])
13+
yam = entry.description['X_device']
14+
ctrlurl = "%s://%s%s" % (
15+
url.scheme,
16+
url.netloc,
17+
yam['X_serviceList']['X_service']['X_controlURL'])
18+
device = entry.description['device']
19+
20+
return (device['friendlyName'], ctrlurl, descurl)
21+
22+
def get_entries(self):
23+
"""Get all the Yamaha uPnP entries."""
24+
return self.find_by_device_description({
25+
"manufacturer": "Yamaha Corporation",
26+
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1"
27+
})

0 commit comments

Comments
 (0)