Skip to content

Commit

Permalink
Add Internet Radio input function if missing / push to version 0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-iver committed Nov 19, 2020
1 parent 272963d commit 34c24e7
Show file tree
Hide file tree
Showing 19 changed files with 2,307 additions and 66 deletions.
131 changes: 118 additions & 13 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ CLASSES
| disable_tone_control(self)
| Disable tone control to change settings like bass or treble.
|
| dynamic_eq_off(self)
| Turn DynamicEQ off.
|
| dynamic_eq_on(self)
| Turn DynamicEQ on.
|
| enable_tone_control(self)
| Enable tone control to change settings like bass or treble.
|
Expand Down Expand Up @@ -173,6 +179,9 @@ CLASSES
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0
|
| toggle_dynamic_eq(self)
| Toggle DynamicEQ.
|
| toggle_play_pause(self)
| Toggle play pause media player.
|
Expand Down Expand Up @@ -205,6 +214,12 @@ CLASSES
| bass_level
| Return level of bass.
|
| dynamic_eq
| Return value of Dynamic EQ.
|
| dynamic_volume_setting_list
| Return a list of available Dynamic Volume settings.
|
| frequency
| Return frequency of current radio station as string.
|
Expand All @@ -223,6 +238,9 @@ CLASSES
| model_name
| Return the model name of the device as string.
|
| multi_eq_setting_list
| Return a list of available MultiEQ settings.
|
| muted
| Boolean if volume is currently muted.
|
Expand Down Expand Up @@ -254,6 +272,9 @@ CLASSES
| receiver_type
| Return the receiver's type.
|
| reference_level_offset_setting_list
| Return a list of available reference level offset settings.
|
| serial_number
| Return the serial number of the device as string.
|
Expand Down Expand Up @@ -294,12 +315,6 @@ CLASSES
| treble_level
| Return level of treble.
|
| volume
| Return volume of Denon AVR as float.
|
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0
|
| zone
| Return Zone of this instance.
|
Expand All @@ -315,11 +330,26 @@ CLASSES
| __weakref__
| list of weak references to the object (if defined)
|
| dynamic_volume
| Return value of Dynamic Volume.
|
| input_func
| Return the current input source as string.
|
| multi_eq
| Return value of MultiEQ.
|
| reference_level_offset
| Return value of Reference Level Offset.
|
| sound_mode
| Return the matched current sound mode as a string.
|
| volume
| Return volume of Denon AVR as float.
|
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0

class DenonAVRZones(DenonAVR)
| DenonAVRZones(parent_avr, zone, name)
Expand Down Expand Up @@ -390,6 +420,12 @@ CLASSES
| disable_tone_control(self)
| Disable tone control to change settings like bass or treble.
|
| dynamic_eq_off(self)
| Turn DynamicEQ off.
|
| dynamic_eq_on(self)
| Turn DynamicEQ on.
|
| enable_tone_control(self)
| Enable tone control to change settings like bass or treble.
|
Expand Down Expand Up @@ -469,6 +505,9 @@ CLASSES
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0
|
| toggle_dynamic_eq(self)
| Toggle DynamicEQ.
|
| toggle_play_pause(self)
| Toggle play pause media player.
|
Expand Down Expand Up @@ -501,6 +540,12 @@ CLASSES
| bass_level
| Return level of bass.
|
| dynamic_eq
| Return value of Dynamic EQ.
|
| dynamic_volume_setting_list
| Return a list of available Dynamic Volume settings.
|
| frequency
| Return frequency of current radio station as string.
|
Expand All @@ -519,6 +564,9 @@ CLASSES
| model_name
| Return the model name of the device as string.
|
| multi_eq_setting_list
| Return a list of available MultiEQ settings.
|
| muted
| Boolean if volume is currently muted.
|
Expand Down Expand Up @@ -550,6 +598,9 @@ CLASSES
| receiver_type
| Return the receiver's type.
|
| reference_level_offset_setting_list
| Return a list of available reference level offset settings.
|
| serial_number
| Return the serial number of the device as string.
|
Expand Down Expand Up @@ -578,12 +629,6 @@ CLASSES
| treble_level
| Return level of treble.
|
| volume
| Return volume of Denon AVR as float.
|
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0
|
| zone
| Return Zone of this instance.
|
Expand All @@ -599,8 +644,23 @@ CLASSES
| __weakref__
| list of weak references to the object (if defined)
|
| dynamic_volume
| Return value of Dynamic Volume.
|
| input_func
| Return the current input source as string.
|
| multi_eq
| Return value of MultiEQ.
|
| reference_level_offset
| Return value of Reference Level Offset.
|
| volume
| Return volume of Denon AVR as float.
|
| Volume is send in a format like -50.0.
| Minimum is -80.0, maximum at 18.0

====================================================================================

Expand Down Expand Up @@ -638,4 +698,49 @@ FUNCTIONS
Send SSDP broadcast messages to a single IP.

ssdp_request(ssdp_st, ssdp_mx=2)
Return request bytes for given st and mx.
Return request bytes for given st and mx.

====================================================================================

Help on module denonavr.audyssey in denonavr:

NAME
denonavr.audyssey - Audyssey Settings.

CLASSES
builtins.object
Audyssey

class Audyssey(builtins.object)
| Audyssey(receiver)
|
| Audyssey Settings.
|
| Methods defined here:
|
| __init__(self, receiver)
| Initialize Audyssey Settings of DenonAVR.
|
| :param receiver: DenonAVR Receiver
| :type receiver: DenonAVR
|
| dynamiceq_off(self)
| Turn DynamicEQ off.
|
| dynamiceq_on(self)
| Turn DynamicEQ on.
|
| send_command(self, xml_tree)
| Send commands.
|
| set_dynamicvol(self, setting)
| Set Dynamic Volume.
|
| set_mutlieq(self, setting)
| Set MultiEQ mode.
|
| set_reflevoffset(self, setting)
| Set Reference Level Offset.
|
| update(self)
| Update settings.
2 changes: 1 addition & 1 deletion denonavr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
logging.getLogger(__name__).addHandler(logging.NullHandler())

__title__ = "denonavr"
__version__ = "0.9.6.dev1"
__version__ = "0.9.6"


def discover():
Expand Down
10 changes: 9 additions & 1 deletion denonavr/audyssey.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
"""Audyssey Settings."""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module implements the Audyssey settings of Denon AVR receivers.
:copyright: (c) 2016 by Oliver Goetz.
:license: MIT, see LICENSE for more details.
"""

import logging
from io import BytesIO
import xml.etree.ElementTree as ET
Expand Down
28 changes: 13 additions & 15 deletions denonavr/denonavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,12 @@ def _update_avr(self):
This method is for pre 2016 AVR(-X) devices
"""
# Use ThreadPoolExecutor to call all URLs of this method in parallel
executor = ThreadPoolExecutor(max_workers=3)
executor = ThreadPoolExecutor(max_workers=2)

status_status = executor.submit(self.get_status_xml, self._urls.status)
status_mainzone = executor.submit(
self.get_status_xml, self._urls.mainzone)

# Update Audyssey
if self._receiver_type == AVR_X.type:
executor.submit(self._audyssey.update())

# Set all tags to be evaluated
relevant_tags = {"Power": None, "InputFuncSelect": None, "Mute": None,
"MasterVolume": None}
Expand Down Expand Up @@ -697,11 +693,12 @@ def _update_avr_2016(self, compatibiliy_check=False):
_LOGGER.error("No Source found for zone %s", self.zone)
success = False
else:
# AirPlay is not always listed in available sources
if (inputfunc == "AirPlay"
and "AirPlay" not in self._input_func_list):
self._input_func_list["AirPlay"] = "AirPlay"
self._input_func_list_rev["AirPlay"] = "AirPlay"
# AirPlay and Internet Radio are not always listed in
# available sources
if inputfunc in ["AirPlay", "Internet Radio"]:
if inputfunc not in self._input_func_list:
self._input_func_list[inputfunc] = inputfunc
self._input_func_list_rev[inputfunc] = inputfunc
try:
self._input_func = self._input_func_list_rev[inputfunc]
except KeyError:
Expand Down Expand Up @@ -1429,11 +1426,12 @@ def _get_status_from_xml_tags(self, root, relevant_tags):
elif child.tag == "InputFuncSelect":
inputfunc = child[0].text
if inputfunc is not None:
# AirPlay is not always listed in available sources
if (inputfunc == "AirPlay"
and "AirPlay" not in self._input_func_list):
self._input_func_list["AirPlay"] = "AirPlay"
self._input_func_list_rev["AirPlay"] = "AirPlay"
# AirPlay and Internet Radio are not always listed in
# available sources
if inputfunc in ["AirPlay", "Internet Radio"]:
if inputfunc not in self._input_func_list:
self._input_func_list[inputfunc] = inputfunc
self._input_func_list_rev[inputfunc] = inputfunc
try:
self._input_func = self._input_func_list_rev[inputfunc]
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import find_packages, setup

setup(name='denonavr',
version='0.9.6.dev1',
version='0.9.6',
description='Automation Library for Denon AVR receivers',
long_description='Automation Library for Denon AVR receivers',
url='https://github.com/scarface-4711/denonavr',
Expand Down
7 changes: 6 additions & 1 deletion tests/test_denonavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"SR5008": NO_ZONES, "M-CR603": NO_ZONES,
"NR1604": ZONE2_ZONE3, "AVR-4810": NO_ZONES,
"AVR-3312": NO_ZONES, "NR1609": ZONE2,
"AVC-8500H": ZONE2_ZONE3, "AVR-X4300H": ZONE2_ZONE3}
"AVC-8500H": ZONE2_ZONE3, "AVR-X4300H": ZONE2_ZONE3,
"AVR-X1100W": ZONE2}

APPCOMMAND_URL = "/goform/AppCommand.xml"
STATUS_URL = "/goform/formMainZone_MainZoneXmlStatus.xml"
Expand Down Expand Up @@ -133,6 +134,10 @@ def test_input_func_switch(self, mock):
self.denon = denonavr.DenonAVR(FAKE_IP, add_zones=zones)
# Switch through all functions and check if successful
for name, zone in self.denon.zones.items():
print("Receiver: {}, Zone: {}".format(receiver, name))
self.assertThat(
len(zone.input_func_list),
testtools.matchers.GreaterThan(0))
for input_func in zone.input_func_list:
self.denon.zones[name].set_input_func(input_func)
self.assertEqual(
Expand Down
Loading

0 comments on commit 34c24e7

Please sign in to comment.