From b5af038a026a61e19299534ea93ca6394380d822 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 28 Oct 2012 23:24:52 +0100 Subject: [PATCH] Make sure volume are returned as an int --- docs/changes.rst | 4 ++++ mopidy/utils/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changes.rst b/docs/changes.rst index 2926adf9..5d58b503 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -18,6 +18,10 @@ v0.8.1 (in development) observed by some users on some Spotify tracks due to a change introduced in 0.8.0. See the issue for a patch that applies to 0.8.0. +- :issue:`216`: Volume returned by the MPD command `status` contained a + floating point ``.0`` suffix. This bug was introduced with the large audio + outout and mixer changes in v0.8.0. It now returns an integer again. + v0.8.0 (2012-09-20) =================== diff --git a/mopidy/utils/__init__.py b/mopidy/utils/__init__.py index aacc2e85..7d1a6dd6 100644 --- a/mopidy/utils/__init__.py +++ b/mopidy/utils/__init__.py @@ -24,7 +24,7 @@ def rescale(v, old=None, new=None): new_min, new_max = new old_min, old_max = old scaling = float(new_max - new_min) / (old_max - old_min) - return round(scaling * (v - old_min) + new_min) + return int(round(scaling * (v - old_min) + new_min)) def import_module(name):