File: apple_tv.py

package info (click to toggle)
python-netdisco 2.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 508 kB
  • sloc: python: 1,532; xml: 247; sh: 10; makefile: 8
file content (16 lines) | stat: -rw-r--r-- 547 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Discover Apple TV media players."""
from . import MDNSDiscoverable
from ..const import ATTR_NAME, ATTR_PROPERTIES


class Discoverable(MDNSDiscoverable):
    """Add support for Apple TV devices."""

    def __init__(self, nd):
        super(Discoverable, self).__init__(nd, '_appletv-v2._tcp.local.')

    def info_from_entry(self, entry):
        """Returns most important info from mDNS entries."""
        info = super().info_from_entry(entry)
        info[ATTR_NAME] = info[ATTR_PROPERTIES]['Name'].replace('\xa0', ' ')
        return info