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

Commit c106816

Browse files
Oliverballoob
authored andcommitted
Added support for Denon AVR receivers (#74)
* Added support for Denon AVR receivers * Correcting description
1 parent 5042a90 commit c106816

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

netdisco/discoverables/denonavr.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Discover Denon AVR devices."""
2+
3+
try:
4+
# python 3
5+
from urllib.parse import urlparse
6+
except ImportError:
7+
# python 2
8+
from urlparse import urlparse
9+
10+
from . import SSDPDiscoverable
11+
12+
13+
class Discoverable(SSDPDiscoverable):
14+
"""Add support for discovering Denon AVR devices."""
15+
16+
def get_entries(self):
17+
"""Get all Denon AVR uPnP entries."""
18+
return self.find_by_device_description({
19+
"manufacturer": "Denon",
20+
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1"
21+
})
22+
23+
def info_from_entry(self, entry):
24+
"""Get most important info, which is name, model and host."""
25+
name = entry.description['device']['friendlyName']
26+
model = entry.description['device']['modelName']
27+
host = urlparse(
28+
entry.description['device']['presentationURL']).hostname
29+
30+
return (host, name, model)

0 commit comments

Comments
 (0)