From 1e9257a27f30ea1f23241c888d2a3d1b8e47d2ce Mon Sep 17 00:00:00 2001 From: ergosteur Date: Tue, 31 Mar 2026 12:50:19 -0400 Subject: [PATCH] Add Volume control and OpenUri support - Implement MPRIS Volume property (readwrite) with 0-10 mapping for Winamp - Implement MPRIS OpenUri method using the discovered /url?p& endpoint - Add Volume to PropertiesChanged signal notifications - Update D-Bus XML interface definition --- winamp_mpris.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/winamp_mpris.py b/winamp_mpris.py index d11f7ce..eef0076 100755 --- a/winamp_mpris.py +++ b/winamp_mpris.py @@ -70,7 +70,9 @@ class WinampMPRIS: - + + + """ @@ -89,6 +91,7 @@ class WinampMPRIS: self._last_update_ts = time.time() self._shuffle = False self._loop_status = "None" + self._volume = 1.0 def _request(self, endpoint): print(f"COMMAND RECEIVED: {endpoint}") @@ -112,7 +115,9 @@ class WinampMPRIS: def Stop(self): self._request("stop") def Seek(self, offset): pass def SetPosition(self, track_id, position): pass - def OpenUri(self, uri): pass + def OpenUri(self, uri): + # Found /url?p& in source code - plays immediately + self._request(f"url?p&{uri}") # --- Root Properties --- @property @@ -185,7 +190,13 @@ class WinampMPRIS: return self._last_position_us @property - def Volume(self): return 1.0 + def Volume(self): return self._volume + @Volume.setter + def Volume(self, value): + self._volume = max(0.0, min(1.0, value)) + # Plugin source shows /vol?volume= accepts 0-10 + vol_10 = int(self._volume * 10) + self._request(f"vol?volume={vol_10}") @property def Metadata(self): @@ -380,7 +391,8 @@ def update_loop(player): "PlaybackStatus": player.PlaybackStatus, "Metadata": player.Metadata, "Shuffle": player.Shuffle, - "LoopStatus": player.LoopStatus + "LoopStatus": player.LoopStatus, + "Volume": player.Volume }, [] )