More > JRiver Media Center 27 for Windows

[MCWS] Playback/Mute switches mute off if called without parameter

(1/1)

DrKNo:
I hope I'm not making eyes roll with my constant posts right now. I will be working normally again next week, I'll promise ill be quieter then  ;D

So, I think Playback mute changes the state of mute when called without parameter (When it should only return the value). Just to get an idea of what's happening: I'm turning on mute, test the return value of that call (True), then look at the result from playback/info (VolumeDisplay should be "Muted"), and then call playback/mute without parameter to return the state. The last calls consistently returns False ("0") for me. Please note that the return values here are auto converted to true false, while MCWS returns 1 or 0.


--- Code: ---       
self.assertEqual(self.server.playback.mute(True), True)    # Set mute to True ('1'), and test proper return value
time.sleep(5)       # wait 5 seconds to make sure JRiver has time to update it's state
print(self.server.playback.info())      # Check what playback info has to say (VolumeDisplay: "Muted")
self.assertEqual(self.server.playback.mute(), True)      # Check fails, mcws returns "False"

--- End code ---

So what's happening with the requests?


--- Code: ---.http://192.168.178.45:52199/MCWS/v1/Playback/Mute?Set=1
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK">
<Item Name="State">1</Item>
</Response>

{ [..] 'Volume': 1, 'VolumeDisplay': 'Muted', [...]}

http://192.168.178.45:52199/MCWS/v1/Playback/Mute
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK">
<Item Name="State">0</Item>
</Response>

--- End code ---

So while the initial call returns the expected value, and the display info does too, the last call returns "False" again.
Watching JRiver, the GUI turns mute on as expected, but turns it off after the parameterless call to playback/mute. So I assume the missing value is interpreted as False?

Aaaaaaand finally, after debugging and writing this, I took a look again at the API documentation, and see that the behavior differs from playback/repeat. Is this intended behavior? It would be nice to be able to check the mute status directly. If this is intended, I can just reroute the call to playback/info and test for the DisplayVolume field.

PS: The server this was tested on was the current Raspberry package.

Hendrik:
This is intended behavior.
I mean, the description of Playback/Mute does read "Set the mute.". :)

DrKNo:
Alright, thank you, Hendrick! :)

Kenny Dave:
If anyone else apart from OP and myself are trying to return the mute status without changing it: query


--- Code: ---http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1
--- End code ---

Line


--- Code: ---<Item Name="VolumeDisplay">Muted</Item>
--- End code ---

Bash script for a toggle in bach (linux) is then:

--- Code: ---case $1 in
    "jriv_vol_0")
        cur_mute_XML=$(wget -qO- http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1)
        cur_mute=$(grep -oPm1 "(?<=<Item Name=\"VolumeDisplay\">)[^<]+" <<< "$cur_mute_XML")

        if [ $cur_mute = "Muted" ]; then
            wget -O/dev/null -q http://localhost:52199/MCWS/v1/Playback/Mute?Set=0
        else
            wget -O/dev/null -q localhost:52199/MCWS/v1/Playback/Mute?Set=1
        fi
--- End code ---

Navigation

[0] Message Index

Go to full version