INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: [MCWS] Playback/Mute switches mute off if called without parameter  (Read 904 times)

DrKNo

  • World Citizen
  • ***
  • Posts: 201

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: [Select]
       
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"

So what's happening with the requests?

Code: [Select]
.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>

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.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10931
Re: [MCWS] Playback/Mute switches mute off if called without parameter
« Reply #1 on: August 19, 2020, 04:34:37 am »

This is intended behavior.
I mean, the description of Playback/Mute does read "Set the mute.". :)
Logged
~ nevcairiel
~ Author of LAV Filters

DrKNo

  • World Citizen
  • ***
  • Posts: 201
Re: [MCWS] Playback/Mute switches mute off if called without parameter
« Reply #2 on: August 19, 2020, 05:52:54 am »

Alright, thank you, Hendrick! :)
Logged

Kenny Dave

  • Recent member
  • *
  • Posts: 17
Re: [MCWS] Playback/Mute switches mute off if called without parameter
« Reply #3 on: June 16, 2024, 07:27:04 pm »

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

Code: [Select]
http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1
Line

Code: [Select]
<Item Name="VolumeDisplay">Muted</Item>
Bash script for a toggle in bach (linux) is then:
Code: [Select]
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
Logged
Pages: [1]   Go Up