You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
751 B

4 years ago
  1. """Discover PlexMediaServer."""
  2. from . import GDMDiscoverable
  3. from ..const import ATTR_NAME, ATTR_HOST, ATTR_PORT, ATTR_URLBASE
  4. class Discoverable(GDMDiscoverable):
  5. """Add support for discovering Plex Media Server."""
  6. def info_from_entry(self, entry):
  7. """Return most important info from a GDM entry."""
  8. return {
  9. ATTR_NAME: entry['data']['Name'],
  10. ATTR_HOST: entry['from'][0],
  11. ATTR_PORT: entry['data']['Port'],
  12. ATTR_URLBASE: 'https://%s:%s' % (entry['from'][0],
  13. entry['data']['Port'])
  14. }
  15. def get_entries(self):
  16. """Return all PMS entries."""
  17. return self.find_by_data({'Content-Type': 'plex/media-server'})