Skip to content

Commit

Permalink
Fixed potential AttributeError when checking for deleted sources
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-iver committed May 8, 2017
1 parent 0111b2b commit 9f840ec
Show file tree
Hide file tree
Showing 12 changed files with 3,004 additions and 10 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.4.0
0.4.1

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

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.4.0
Automation Library for Denon AVR receivers - current version 0.4.1

## 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.4.0
Automation Library for Denon AVR receivers - current version 0.4.1

Installation
------------
Expand Down
2 changes: 1 addition & 1 deletion denonavr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logging.getLogger(__name__).addHandler(logging.NullHandler())

__title__ = "denonavr"
__version__ = "0.4.0"
__version__ = "0.4.1"


def discover():
Expand Down
15 changes: 11 additions & 4 deletions denonavr/denonavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,19 @@ def _get_renamed_deleted_sourcesapp(self):
return (renamed_sources, deleted_sources, False)

for child in root.findall("./cmd/functionrename/list"):
renamed_sources[child.find("name").text.strip()] = (
child.find("rename").text.strip())
try:
renamed_sources[child.find("name").text.strip()] = (
child.find("rename").text.strip())
except AttributeError:
continue

for child in root.findall("./cmd/functiondelete/list"):
deleted_sources[child.find("FuncName").text.strip()] = "DEL" if (
child.find("use").text.strip() == "0") else None
try:
deleted_sources[child.find("FuncName").text.strip(
)] = "DEL" if (
child.find("use").text.strip() == "0") else None
except AttributeError:
continue

return (renamed_sources, deleted_sources, True)

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.4.0',
version='0.4.1',
description='Automation Library for Denon AVR receivers',
long_description='Automation Library for Denon AVR receivers',
url='https://github.com/scarface-4711/denonavr',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_denonavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FAKE_IP = "10.0.0.0"
TESTING_RECEIVERS = ("AVR-X4100W", "AVR-2312CI", "AVR-1912", "AVR-3311CI",
"M-RC610")
"M-RC610", "AVR-X4100W-2")

APPCOMMAND_URL = "/goform/AppCommand.xml"
STATUS_URL = "/goform/formMainZone_MainZoneXmlStatus.xml"
Expand Down
132 changes: 132 additions & 0 deletions tests/xml/AVR-X2100W-2-AppCommand.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8" ?>
<rx>
<cmd>
<functionrename>
<list>
<name>CBL/SAT</name>
<rename>TV </rename>
</list>
<list>
<name>DVD</name>
<rename>DVD </rename>
</list>
<list>
<name>Blu-ray</name>
<rename>Dune </rename>
</list>
<list>
<name>GAME</name>
<rename>Xbox360 </rename>
</list>
<list>
<name>AUX1</name>
<rename>AUX1 </rename>
</list>
<list>
<name>AUX2</name>
<rename>AUX2 </rename>
</list>
<list>
<name>Media Player</name>
<rename>AndroidTV </rename>
</list>
<list>
<name>iPod/USB</name>
<rename>iPod/USB</rename>
</list>
<list>
<name>CD</name>
<rename>CD </rename>
</list>
<list>
<name>TUNER</name>
<rename>Tuner</rename>
</list>
<list>
<name>NETWORK</name>
<rename>Online Music</rename>
</list>
<list>
<name>TV AUDIO</name>
<rename>TV Audio </rename>
</list>
<list>
<name>Bluetooth</name>
<rename>Bluetooth</rename>
</list>
<list>
<name>SpotifyConnect</name>
<rename>Spotify</rename>
</list>
</functionrename>
</cmd>
<cmd>
<functiondelete>
<list>
<name>CBL/SAT</name>
<FuncName>CBL/SAT</FuncName>
<use>1</use>
</list>
<list>
<name>DVD</name>
<FuncName>DVD</FuncName>
<use>0</use>
</list>
<list>
<name>Blu-ray</name>
<FuncName>Blu-ray</FuncName>
<use>1</use>
</list>
<list>
<name>GAME</name>
<FuncName>GAME</FuncName>
<use>1</use>
</list>
<list>
<name>AUX1</name>
<FuncName>AUX1</FuncName>
<use>1</use>
</list>
<list>
<name>AUX2</name>
<FuncName>AUX2</FuncName>
<use>1</use>
</list>
<list>
<name>Media Player</name>
<FuncName>Media Player</FuncName>
<use>1</use>
</list>
<list>
<name>iPod/USB</name>
<FuncName>iPod/USB</FuncName>
<use>1</use>
</list>
<list>
<name>CD</name>
<FuncName>CD</FuncName>
<use>0</use>
</list>
<list>
<name>TUNER</name>
<FuncName>TUNER</FuncName>
<use>1</use>
</list>
<list>
<name>NETWORK</name>
<FuncName>NETWORK</FuncName>
<use>1</use>
</list>
<list>
<name>TV AUDIO</name>
<FuncName>TV AUDIO</FuncName>
<use>0</use>
</list>
<list>
<name>Bluetooth</name>
<FuncName>Bluetooth</FuncName>
<use>1</use>
</list>
</functiondelete>
</cmd>
</rx>
Loading

0 comments on commit 9f840ec

Please sign in to comment.