From f6a0309a3d00b7f80f41bfdf5a7d48fa8ae6f71a Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Sun, 14 Jun 2015 13:17:24 +0200 Subject: Twicks to ParrotZik. --- ParrotZik.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/ParrotZik.py b/ParrotZik.py index efa8732..b327338 100644 --- a/ParrotZik.py +++ b/ParrotZik.py @@ -165,28 +165,12 @@ class ParrotZikBase(object): @property def noise_cancel(self): data = self.api.get("/api/audio/noise_cancellation/enabled") - try: - return self._result_to_bool( - data.answer.audio.noise_cancellation["enabled"]) - except AttributeError: - return False + return self._result_to_bool( + data.answer.audio.noise_cancellation["enabled"]) @noise_cancel.setter def noise_cancel(self, arg): - self.api.get("/api/audio/noise_cancellation/enabled", arg) - - @property - def concert_hall(self): - data = self.api.get("/api/audio/sound_effect/enabled") - try: - return self._result_to_bool( - data.answer.audio.sound_effect["enabled"]) - except AttributeError: - return False - - @concert_hall.setter - def concert_hall(self, arg): - self.api.get("/api/audio/sound_effect/enabled", arg) + self.api.set("/api/audio/noise_cancellation/enabled", arg) def _result_to_bool(self, result): if result == "true": @@ -212,6 +196,16 @@ class ParrotZikVersion1(ParrotZikBase): def lou_reed_mode(self, arg): self.api.get("/api/audio/specific_mode/enabled", arg) + @property + def concert_hall(self): + data = self.api.get("/api/audio/sound_effect/enabled") + return self._result_to_bool( + data.answer.audio.sound_effect["enabled"]) + + @concert_hall.setter + def concert_hall(self, arg): + self.api.get("/api/audio/sound_effect/enabled", arg) + class ParrotZikVersion2(ParrotZikBase): @property -- cgit v1.2.1