Skip to content

Commit

Permalink
Add status checks to play and pause methods and make both methods pub…
Browse files Browse the repository at this point in the history
…lic / Push to version 0.7.11
  • Loading branch information
ol-iver committed Jan 2, 2020
1 parent 81fa571 commit 7b9e3b1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DATA
__title__ = 'denonavr'

VERSION
0.7.10
0.7.11

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# denonavr
[![Build Status](https://travis-ci.org/scarface-4711/denonavr.svg?branch=master)](https://travis-ci.org/scarface-4711/denonavr)

Automation Library for Denon AVR receivers - current version 0.7.10
Automation Library for Denon AVR receivers - current version 0.7.11

## Installation

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ denonavr

|Build Status|

Automation Library for Denon AVR receivers - current version 0.7.10
Automation Library for Denon AVR receivers - current version 0.7.11

Installation
------------
Expand Down
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.7.10"
__version__ = "0.7.11"


def discover():
Expand Down
14 changes: 10 additions & 4 deletions denonavr/denonavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,14 +1543,17 @@ def toggle_play_pause(self):
# Use Play/Pause button only for sources which support NETAUDIO
if (self._state == STATE_PLAYING and
self._input_func in self._netaudio_func_list):
return self._pause()
return self.pause()
elif self._input_func in self._netaudio_func_list:
return self._play()
return self.play()

def _play(self):
def play(self):
"""Send play command to receiver command via HTTP post."""
# Use pause command only for sources which support NETAUDIO
if self._input_func in self._netaudio_func_list:
if self._state == STATE_PLAYING:
_LOGGER.info("Already playing, play command not sent")
return False
body = {"cmd0": "PutNetAudioCommand/CurEnter",
"cmd1": "aspMainZone_WebUpdateStatus/",
"ZoneName": "MAIN ZONE"}
Expand All @@ -1565,10 +1568,13 @@ def _play(self):
_LOGGER.error("Connection error: play command not sent.")
return False

def _pause(self):
def pause(self):
"""Send pause command to receiver command via HTTP post."""
# Use pause command only for sources which support NETAUDIO
if self._input_func in self._netaudio_func_list:
if self._state == STATE_PAUSED:
_LOGGER.info("Already paused, pause command not sent")
return False
body = {"cmd0": "PutNetAudioCommand/CurEnter",
"cmd1": "aspMainZone_WebUpdateStatus/",
"ZoneName": "MAIN ZONE"}
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.7.10',
version='0.7.11',
description='Automation Library for Denon AVR receivers',
long_description='Automation Library for Denon AVR receivers',
url='https://github.com/scarface-4711/denonavr',
Expand Down

0 comments on commit 7b9e3b1

Please sign in to comment.