From e9f593c83bc4afd1525d31fce86a567b68b8fe72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Amig=C3=B3?= Date: Sun, 9 Dec 2018 19:17:40 +0100 Subject: [PATCH 01/21] Fixing surround programs in RX-V481 --- rxv/rxv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..9cbae86 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -330,7 +330,7 @@ def surround_programs(self): if source_xml is None: return False - setup = source_xml.find('.//*[@Title_1="Setup"]') + setup = source_xml.find('.//Menu[@Title_1="Setup"]') if setup is None: return False From 5f2692b689db09c4eae87aceded4ffb47e4650c8 Mon Sep 17 00:00:00 2001 From: Michael Spahlinger <44210026+spahlimi@users.noreply.github.com> Date: Fri, 4 Jan 2019 20:09:04 +0100 Subject: [PATCH 02/21] Added support for SERVER source playback --- rxv/rxv.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..196279b 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -67,6 +67,8 @@ def __init__(self, play=False, stop=False, pause=False, VolumeMute = '{state}' SelectNetRadioLine = 'Line_{lineno}'\ '' +SelectServerLine = 'Line_{lineno}'\ + '' HdmiOut = '{command}'\ '' @@ -642,6 +644,39 @@ def net_radio(self, path): # print("Sleeping because we are not ready yet") time.sleep(1) + def _direct_sel_server(self, lineno): + request_text = SelectServerLine.format(lineno=lineno) + return self._request('PUT', request_text, zone_cmd=False) + + def server(self, path): + """Play from specified server + + This lets you play a SERVER address in a single command + with by encoding it with > as separators. For instance: + + Server>Playlists>GoodVibes + + This code is copied from the net_radio function. + + TODO: better error handling if we some how time out + """ + layers = path.split(">") + self.input = "SERVER" + + for attempt in range(20): + menu = self.menu_status() + if menu.ready: + for line, value in menu.current_list.items(): + if value == layers[menu.layer - 1]: + lineno = line[5:] + self._direct_sel_server(lineno) + if menu.layer == len(layers): + return + break + else: + # print("Sleeping because we are not ready yet") + time.sleep(1) + @property def sleep(self): request_text = PowerControlSleep.format(sleep_value=GetParam) From 7ef9d95ade8c5718b87b73c8351a7221e3bb856f Mon Sep 17 00:00:00 2001 From: Michael Spahlinger <44210026+spahlimi@users.noreply.github.com> Date: Sun, 13 Jan 2019 09:35:33 +0100 Subject: [PATCH 03/21] Remove trailing whitespace --- rxv/rxv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rxv/rxv.py b/rxv/rxv.py index 196279b..e1b455b 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -656,7 +656,7 @@ def server(self, path): Server>Playlists>GoodVibes - This code is copied from the net_radio function. + This code is copied from the net_radio function. TODO: better error handling if we some how time out """ From 9c3025d53b5651b4f9a9372fac85a0bbc7e22832 Mon Sep 17 00:00:00 2001 From: Raffi Dilanchian Date: Tue, 25 Jun 2019 20:44:58 +0430 Subject: [PATCH 04/21] Search for specific menu tag In RX-V485 there were two matches for `'.//*[@Title_1="Setup"]'` , so the found element was incorrect. --- rxv/rxv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..9cbae86 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -330,7 +330,7 @@ def surround_programs(self): if source_xml is None: return False - setup = source_xml.find('.//*[@Title_1="Setup"]') + setup = source_xml.find('.//Menu[@Title_1="Setup"]') if setup is None: return False From 6f8418e2a42bd740aeccd30a676c9ce96de64bec Mon Sep 17 00:00:00 2001 From: Thomas Bettems Date: Sun, 22 Dec 2019 23:04:44 +0100 Subject: [PATCH 05/21] Added new partymode property to get & set Party Mode feature --- rxv/rxv.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..fd840cb 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -50,6 +50,7 @@ def __init__(self, play=False, stop=False, pause=False, YamahaCommand = '{payload}' Zone = '<{zone}>{request_text}' BasicStatusGet = 'GetParam' +PartyMode = '{state}' PowerControl = '{state}' PowerControlSleep = '{sleep_value}' Input = '{input_name}' @@ -590,6 +591,22 @@ def volume_fade(self, final_vol, sleep=0.5): self.volume = val time.sleep(sleep) + @property + def partymode(self): + request_text = PartyMode.format(state=GetParam) + response = self._request('GET', request_text,False) + pmode = response.find('System/Party_Mode/Mode').text + assert pmode in ["On", "Off"] + return pmode == "On" + + @partymode.setter + def partymode(self, state): + assert state in [True, False] + new_state = "On" if state else "Off" + request_text = PartyMode.format(state=new_state) + response = self._request('PUT', request_text,False) + return response + @property def mute(self): request_text = VolumeMute.format(state=GetParam) From 80d5e4bbdeb554ca0b6594f7ea325027dbf91f7e Mon Sep 17 00:00:00 2001 From: Thomas Bettems Date: Sun, 22 Dec 2019 23:07:25 +0100 Subject: [PATCH 06/21] Added new partymode property to get & set Party Mode feature Party Mode is using following XML format: --- rxv/rxv.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..fd840cb 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -50,6 +50,7 @@ def __init__(self, play=False, stop=False, pause=False, YamahaCommand = '{payload}' Zone = '<{zone}>{request_text}' BasicStatusGet = 'GetParam' +PartyMode = '{state}' PowerControl = '{state}' PowerControlSleep = '{sleep_value}' Input = '{input_name}' @@ -590,6 +591,22 @@ def volume_fade(self, final_vol, sleep=0.5): self.volume = val time.sleep(sleep) + @property + def partymode(self): + request_text = PartyMode.format(state=GetParam) + response = self._request('GET', request_text,False) + pmode = response.find('System/Party_Mode/Mode').text + assert pmode in ["On", "Off"] + return pmode == "On" + + @partymode.setter + def partymode(self, state): + assert state in [True, False] + new_state = "On" if state else "Off" + request_text = PartyMode.format(state=new_state) + response = self._request('PUT', request_text,False) + return response + @property def mute(self): request_text = VolumeMute.format(state=GetParam) From 9586195a941405145f4c4d5da44941314f2ec2e1 Mon Sep 17 00:00:00 2001 From: Thomas Bettems Date: Sun, 22 Dec 2019 23:50:13 +0100 Subject: [PATCH 07/21] Testing CI --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f33d8c9..5792419 100644 --- a/setup.py +++ b/setup.py @@ -50,3 +50,4 @@ def run_tests(self): "Programming Language :: Python :: Implementation :: PyPy" ] ) + From a42ee05632a6beffec2b086ec98d7b854873415f Mon Sep 17 00:00:00 2001 From: Bugmanch Date: Sun, 22 Dec 2019 23:54:17 +0100 Subject: [PATCH 08/21] Testing CI again --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 5792419..f33d8c9 100644 --- a/setup.py +++ b/setup.py @@ -50,4 +50,3 @@ def run_tests(self): "Programming Language :: Python :: Implementation :: PyPy" ] ) - From 8051897980d98a8b0d3bc9ebf728958bd6a65f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20St=C3=A5hl?= Date: Tue, 27 Oct 2020 19:29:45 +0100 Subject: [PATCH 09/21] Extract serial number from SSDP --- rxv/__init__.py | 10 +--------- rxv/rxv.py | 5 +++-- rxv/ssdp.py | 12 ++++++++++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/rxv/__init__.py b/rxv/__init__.py index e71b14e..a6f11e3 100644 --- a/rxv/__init__.py +++ b/rxv/__init__.py @@ -16,12 +16,4 @@ def find(timeout=1.5): """Find all Yamah receivers on local network using SSDP search.""" - return [ - RXV( - ctrl_url=ri.ctrl_url, - model_name=ri.model_name, - friendly_name=ri.friendly_name, - unit_desc_url=ri.unit_desc_url - ) - for ri in ssdp.discover(timeout=timeout) - ] + return [RXV(**ri._asdict()) for ri in ssdp.discover(timeout=timeout)] diff --git a/rxv/rxv.py b/rxv/rxv.py index 7862d5b..ad42d8b 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -84,8 +84,8 @@ def __init__(self, play=False, stop=False, pause=False, class RXV(object): def __init__(self, ctrl_url, model_name="Unknown", - zone="Main_Zone", friendly_name='Unknown', - unit_desc_url=None): + serial_number=None, zone="Main_Zone", + friendly_name='Unknown', unit_desc_url=None): if re.match(r"\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}", ctrl_url): # backward compatibility: accept ip address as a contorl url warnings.warn("Using IP address as a Control URL is deprecated") @@ -93,6 +93,7 @@ def __init__(self, ctrl_url, model_name="Unknown", self.ctrl_url = ctrl_url self.unit_desc_url = unit_desc_url or re.sub('ctrl$', 'desc.xml', ctrl_url) self.model_name = model_name + self.serial_number = serial_number self.friendly_name = friendly_name self._inputs_cache = None self._zones_cache = None diff --git a/rxv/ssdp.py b/rxv/ssdp.py index 5d62d56..180c0af 100644 --- a/rxv/ssdp.py +++ b/rxv/ssdp.py @@ -37,8 +37,15 @@ "{urn:schemas-upnp-org:device-1-0}device" "/{urn:schemas-upnp-org:device-1-0}friendlyName" ) +SERIAL_NUMBER_QUERY = ( + "{urn:schemas-upnp-org:device-1-0}device" + "/{urn:schemas-upnp-org:device-1-0}serialNumber" +) -RxvDetails = namedtuple("RxvDetails", "ctrl_url unit_desc_url, model_name friendly_name") +RxvDetails = namedtuple( + "RxvDetails", + "ctrl_url unit_desc_url, model_name friendly_name serial_number" +) def discover(timeout=1.5): @@ -85,8 +92,9 @@ def rxv_details(location): unit_desc_url = urljoin(url_base_el.text, unit_desc_url_local) model_name = res.find(MODEL_NAME_QUERY).text friendly_name = res.find(FRIENDLY_NAME_QUERY).text + serial_number = res.find(SERIAL_NUMBER_QUERY).text - return RxvDetails(ctrl_url, unit_desc_url, model_name, friendly_name) + return RxvDetails(ctrl_url, unit_desc_url, model_name, friendly_name, serial_number) if __name__ == '__main__': From e96d2b91ffd66513bb5cab1dde73bfc9d8ba3331 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 18:59:09 +0100 Subject: [PATCH 10/21] drop unsupported python versions and fix tox/py.test --- setup.py | 6 ++---- tox.ini | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index f33d8c9..d132014 100644 --- a/setup.py +++ b/setup.py @@ -42,11 +42,9 @@ def run_tests(self): "Operating System :: OS Independent", "Topic :: Software Development :: Libraries", "Topic :: Home Automation", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: PyPy" ] ) diff --git a/tox.ini b/tox.ini index 22b4531..1a343e2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py34,py35,py36,py37,pypy +envlist = py37,py38,py39 skip_missing_interpreters = True [testenv] @@ -8,4 +8,4 @@ setenv = PYTHONPATH = {toxinidir} deps = -r{toxinidir}/test-requirements.txt -commands=py.test tests --timeout=30 --duration=10 --cov=rxv --cov-report html {posargs} +commands=py.test tests --timeout=30 --cov=rxv --cov-report html {posargs} From b0a44356a7f575d867a37c1ee70bca282bad05cf Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 20:53:39 +0100 Subject: [PATCH 11/21] move to setup.cfg only project --- pyproject.toml | 6 ++++ requirements.txt | 1 - setup.cfg | 66 +++++++++++++++++++++++++++++++++++++++++++ setup.py | 50 -------------------------------- test-requirements.txt | 6 ---- tox.ini | 11 -------- 6 files changed, 72 insertions(+), 68 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.py delete mode 100644 test-requirements.txt delete mode 100644 tox.ini diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2e8be56 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "rxv/version.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 945c9b4..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index ba1e011..c666f0b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,72 @@ +[metadata] +name = rxv +description = Automation Library for Yamaha RX-V473, RX-V573, RX-V673, RX-V773 receivers +long_description = file: README.md +long_description_content_type = text/x-rst +maintainer = Wojciech Bederski +maintainer-email = github@wuub.net +author = Wojciech Bederski +author-email = github@wuub.net +url = https://github.com/wuub/rxv +project_urls = + Source=https://github.com/wuub/rxv + Tracker=https://github.com/wuub/rxv/issues +platforms = any +license = BSD +license_file = LICENSE +classifiers = + Development Status :: 5 - Production/Stable + Framework :: tox + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Topic :: Home Automation, + Topic :: Software Development :: Libraries + Topic :: Utilities + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + + +[options] +zip_safe = False +include_package_data = True +packages = find: +install_requires = + requests + defusedxml + +[options.extras_require] +testing = + black + flake8 + mock + pytest + pytest-cov + pytest-timeout + testtools + requests-mock + [wheel] universal = 1 +[tox:tox] +minversion = 3.7 +isolated_build = true +skip_missing_interpreters = true +envlist = + {py37,py38,py39} + +[coverage:run] +source_pkgs= + rxv + +[testenv] +extras = testing +commands = py.test --cov --cov-report=term --cov-report=xml {posargs} + [flake8] exclude = .cache,.git,.tox,.eggs,build,docs/*,*.egg-info max-line-length = 100 diff --git a/setup.py b/setup.py deleted file mode 100644 index d132014..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -from __future__ import absolute_import, division, print_function - -import sys - -from setuptools import find_packages, setup -from setuptools.command.test import test as TestCommand - - -class Tox(TestCommand): - - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self): - import tox - errno = tox.cmdline(self.test_args) - sys.exit(errno) - - -setup( - name='rxv', - version='0.6.0', - description='Automation Library for Yamaha RX-V473, RX-V573, RX-V673, RX-V773 receivers', - long_description=open('README.rst').read(), - author='Wojciech Bederski', - url="https://github.com/wuub/rxv", - license='BSD', - author_email='github@wuub.net', - packages=find_packages(), - install_requires=['requests', 'defusedxml'], - tests_require=['tox'], - zip_safe=False, - cmdclass={'test': Tox}, - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Topic :: Software Development :: Libraries", - "Topic :: Home Automation", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: Implementation :: PyPy" - ] -) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 30e880c..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -mock -pytest>=2.9.2 -pytest-cov>=2.3.1 -pytest-timeout>=1.0.0 -testtools -requests-mock diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 1a343e2..0000000 --- a/tox.ini +++ /dev/null @@ -1,11 +0,0 @@ -[tox] -envlist = py37,py38,py39 -skip_missing_interpreters = True - -[testenv] -setenv = - LANG=en_US.UTF-8 - PYTHONPATH = {toxinidir} -deps = - -r{toxinidir}/test-requirements.txt -commands=py.test tests --timeout=30 --cov=rxv --cov-report html {posargs} From 143280e396328f5e25b19c5c1288b32138836aad Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 20:54:18 +0100 Subject: [PATCH 12/21] don't use deprecated way of instantiation RXV(IP) in tests --- tests/test_feature_support.py | 3 ++- tests/test_rxv.py | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test_feature_support.py b/tests/test_feature_support.py index d4b791d..f5ec310 100644 --- a/tests/test_feature_support.py +++ b/tests/test_feature_support.py @@ -7,6 +7,7 @@ FAKE_IP = '10.0.0.0' DESC_XML = 'http://%s/YamahaRemoteControl/desc.xml' % FAKE_IP +CTRL_URL = 'http://%s/YamahaRemoteControl/ctrl' % FAKE_IP def sample_content(name): @@ -20,7 +21,7 @@ class TestFeaturesV675(testtools.TestCase): def setUp(self, m): super(TestFeaturesV675, self).setUp() m.get(DESC_XML, text=sample_content('rx-v675-desc.xml')) - self.rec = rxv.RXV(FAKE_IP) + self.rec = rxv.RXV(CTRL_URL) def test_supports_method(self): rec = self.rec diff --git a/tests/test_rxv.py b/tests/test_rxv.py index f2f9447..22f9f14 100644 --- a/tests/test_rxv.py +++ b/tests/test_rxv.py @@ -7,6 +7,7 @@ FAKE_IP = '10.0.0.0' DESC_XML = 'http://%s/YamahaRemoteControl/desc.xml' % FAKE_IP +CTRL_URL = 'http://%s/YamahaRemoteControl/ctrl' % FAKE_IP def sample_content(name): @@ -19,10 +20,7 @@ class TestRXV(testtools.TestCase): @requests_mock.mock() def test_basic_object(self, m): m.get(DESC_XML, text=sample_content('rx-v675-desc.xml')) - rec = rxv.RXV(FAKE_IP) - self.assertEqual( - rec.ctrl_url, - 'http://%s/YamahaRemoteControl/ctrl' % FAKE_IP) + rec = rxv.RXV(CTRL_URL) self.assertEqual( rec.unit_desc_url, 'http://%s/YamahaRemoteControl/desc.xml' % FAKE_IP) @@ -33,7 +31,7 @@ class TestDesc(testtools.TestCase): @requests_mock.mock() def test_discover_zones(self, m): m.get(DESC_XML, text=sample_content('rx-v675-desc.xml')) - rec = rxv.RXV(FAKE_IP) + rec = rxv.RXV(CTRL_URL) zones = rec.zone_controllers() self.assertEqual(len(zones), 2, zones) self.assertEqual(zones[0].zone, "Main_Zone") From c40109c636e6534a2c9ff290dc7e1b543adbf4f9 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 21:02:09 +0100 Subject: [PATCH 13/21] replace testtools with standard unittest --- setup.cfg | 1 - tests/test_feature_support.py | 5 +++-- tests/test_rxv.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.cfg b/setup.cfg index c666f0b..60fa367 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,7 +46,6 @@ testing = pytest pytest-cov pytest-timeout - testtools requests-mock [wheel] diff --git a/tests/test_feature_support.py b/tests/test_feature_support.py index f5ec310..9e81288 100644 --- a/tests/test_feature_support.py +++ b/tests/test_feature_support.py @@ -1,7 +1,8 @@ from io import open import requests_mock -import testtools +import unittest + import rxv @@ -15,7 +16,7 @@ def sample_content(name): return f.read() -class TestFeaturesV675(testtools.TestCase): +class TestFeaturesV675(unittest.TestCase): @requests_mock.mock() def setUp(self, m): diff --git a/tests/test_rxv.py b/tests/test_rxv.py index 22f9f14..9690369 100644 --- a/tests/test_rxv.py +++ b/tests/test_rxv.py @@ -1,7 +1,7 @@ from io import open import requests_mock -import testtools +import unittest import rxv @@ -15,7 +15,7 @@ def sample_content(name): return f.read() -class TestRXV(testtools.TestCase): +class TestRXV(unittest.TestCase): @requests_mock.mock() def test_basic_object(self, m): @@ -26,7 +26,7 @@ def test_basic_object(self, m): 'http://%s/YamahaRemoteControl/desc.xml' % FAKE_IP) -class TestDesc(testtools.TestCase): +class TestDesc(unittest.TestCase): @requests_mock.mock() def test_discover_zones(self, m): From 2fb1c6b87b5ff3e890ba0ae8e22f42fae83f0b24 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 21:13:53 +0100 Subject: [PATCH 14/21] setup gh actions build --- .github/workflows/tox.yml | 29 +++++++++++++++++++++++++++++ setup.cfg | 6 ++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/tox.yml diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000..cf1b37b --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,29 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 60fa367..811751a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,12 @@ skip_missing_interpreters = true envlist = {py37,py38,py39} +[gh-actions] +python = + 3.7: py37 + 3.8: py38 + 3.9: py39 + [coverage:run] source_pkgs= rxv From e9a760e933cf722b6736b443e98fcb590aaf9b93 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 21:41:43 +0100 Subject: [PATCH 15/21] bring back flake8 --- setup.cfg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 811751a..8ed2861 100644 --- a/setup.cfg +++ b/setup.cfg @@ -56,12 +56,13 @@ minversion = 3.7 isolated_build = true skip_missing_interpreters = true envlist = + flake8 {py37,py38,py39} [gh-actions] python = 3.7: py37 - 3.8: py38 + 3.8: py38, flake8 3.9: py39 [coverage:run] @@ -72,6 +73,11 @@ source_pkgs= extras = testing commands = py.test --cov --cov-report=term --cov-report=xml {posargs} +[testenv:flake8] +description = run flake8 under {basepython} +commands = flake8 rxv/ tests/ +extras = testing + [flake8] exclude = .cache,.git,.tox,.eggs,build,docs/*,*.egg-info max-line-length = 100 From c76b72581c25c0c0850ccb2bef5fe5c13c7f8444 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 21:59:17 +0100 Subject: [PATCH 16/21] improve envlist --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 8ed2861..1892b49 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,7 +57,7 @@ isolated_build = true skip_missing_interpreters = true envlist = flake8 - {py37,py38,py39} + py{37,38,39} [gh-actions] python = From 625ea0cae76cf356368149769fe0b68f80dc701b Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 22:04:17 +0100 Subject: [PATCH 17/21] simplify badges for now --- README.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 8c3422d..0a5fed5 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,10 @@ rxv === -.. image:: https://travis-ci.org/wuub/rxv.svg?branch=master - :target: https://travis-ci.org/wuub/rxv +.. image:: https://badge.fury.io/py/rxv.svg + :target: https://badge.fury.io/py/rxv -.. image:: https://landscape.io/github/wuub/rxv/master/landscape.svg?style=flat - :target: https://landscape.io/github/wuub/rxv/master - :alt: Code Health -Automation Library for Yamaha RX-V473, RX-V573, RX-V673, RX-V773 receivers +Automation Library for Yamaha receivers Installation ============ From 65ba4cd9668f7d10a26eeee1cae5aee77a925130 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 22:10:39 +0100 Subject: [PATCH 18/21] master -> main --- .github/workflows/tox.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index cf1b37b..f540664 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -3,10 +3,10 @@ name: Tests on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: build: From 572be1b28bf5639826a43637cfc4c40fa98447fc Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 22:10:59 +0100 Subject: [PATCH 19/21] remove travis config --- .travis.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b481729..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -matrix: - fast_finish: true - include: - - python: "2.7" - env: TOXENV=py27 - - python: "3.5" - env: TOXENV=py35 - - python: "3.6" - env: TOXENV=py36 -install: pip install tox -script: tox From 1058b2cb8f121674605ed4ba68a5f0cdfe9d6133 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 22:34:24 +0100 Subject: [PATCH 20/21] add manifest checks, clean manifest and remove makefile --- MANIFEST.in | 4 ++++ Makefile | 12 ------------ rxv/.gitignore | 1 + setup.cfg | 13 ++++++++++++- 4 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 Makefile create mode 100644 rxv/.gitignore diff --git a/MANIFEST.in b/MANIFEST.in index e69de29..e1e0072 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -0,0 +1,4 @@ + include *.rst + include Makefile + recursive-include tests *.py + recursive-include tests *.xml diff --git a/Makefile b/Makefile deleted file mode 100644 index 518b22c..0000000 --- a/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -test: - flake8 - isort --recursive --check-only --diff - tox - -isort: - isort --recursive --apply - -clean: - rm -rf .virtualenv dist build *.egg-info - -.PHONY: clean isort test \ No newline at end of file diff --git a/rxv/.gitignore b/rxv/.gitignore new file mode 100644 index 0000000..9852786 --- /dev/null +++ b/rxv/.gitignore @@ -0,0 +1 @@ +version.py diff --git a/setup.cfg b/setup.cfg index 1892b49..64e52ed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,12 +57,13 @@ isolated_build = true skip_missing_interpreters = true envlist = flake8 + manifest py{37,38,39} [gh-actions] python = 3.7: py37 - 3.8: py38, flake8 + 3.8: py38, flake8, manifest 3.9: py39 [coverage:run] @@ -78,6 +79,16 @@ description = run flake8 under {basepython} commands = flake8 rxv/ tests/ extras = testing +[testenv:manifest] +basepython = python3.8 +deps = check-manifest +skip_install = true +commands = check-manifest + +[check-manifest] +ignore = + rxv/version.py + [flake8] exclude = .cache,.git,.tox,.eggs,build,docs/*,*.egg-info max-line-length = 100 From 1d9d72cf1a552ad4e7621ef608138afdfdecf006 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Tue, 19 Jan 2021 23:11:37 +0100 Subject: [PATCH 21/21] fix whitespace to make flake8 happy --- rxv/rxv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rxv/rxv.py b/rxv/rxv.py index 5dda7fa..97f5b19 100644 --- a/rxv/rxv.py +++ b/rxv/rxv.py @@ -597,7 +597,7 @@ def volume_fade(self, final_vol, sleep=0.5): @property def partymode(self): request_text = PartyMode.format(state=GetParam) - response = self._request('GET', request_text,False) + response = self._request('GET', request_text, False) pmode = response.find('System/Party_Mode/Mode').text assert pmode in ["On", "Off"] return pmode == "On" @@ -607,7 +607,7 @@ def partymode(self, state): assert state in [True, False] new_state = "On" if state else "Off" request_text = PartyMode.format(state=new_state) - response = self._request('PUT', request_text,False) + response = self._request('PUT', request_text, False) return response @property