From c2173954c8f177b1dc7cda24b280d8ec67e2caea Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 9 Oct 2013 23:06:18 +0200 Subject: [PATCH] audio: Reorder methods --- mopidy/audio/actor.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index ea186894..5c931865 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -540,6 +540,15 @@ class Audio(pykka.ThreadingActor): return self._mixer.get_volume(self._mixer_track) == volumes + def _rescale(self, value, old=None, new=None): + """Convert value between scales.""" + new_min, new_max = new + old_min, old_max = old + if old_min == old_max: + return old_max + scaling = float(new_max - new_min) / (old_max - old_min) + return int(round(scaling * (value - old_min) + new_min)) + def get_mute(self): """ Get mute status of the installed mixer. @@ -571,15 +580,6 @@ class Audio(pykka.ThreadingActor): return self._mixer.set_mute(self._mixer_track, bool(mute)) - def _rescale(self, value, old=None, new=None): - """Convert value between scales.""" - new_min, new_max = new - old_min, old_max = old - if old_min == old_max: - return old_max - scaling = float(new_max - new_min) / (old_max - old_min) - return int(round(scaling * (value - old_min) + new_min)) - def set_metadata(self, track): """ Set track metadata for currently playing song.