Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Senior Member
    Join Date
    Aug 2012
    Posts
    154

    SqueezeJS.Controller.playerRequest([JSON formatted CLI request])

    How do I set the squeezebox volume through the SqueezeJS framework and JSON format CLI request?


    Is there away to get a complete list of all the properties and objects they are associated to?

    I am trying via IFTTT JSON webhook:

    { "entity_id": "media_player.playername", "command": "volume", "parameters": "0"}

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    SqueezeJS.Controller.playerRequest([JSON formattedCLI request])

    > How do I set the squeezebox volume through the SqueezeJS framework and
    > JSON format CLI request?


    Relative change (-1):
    SqueezeJS.Controller.setVolume(1, '-')

    Absolute:
    SqueezeJS.Controller.setVolume(50)

    > Is there away to get a complete list of all the properties and objects
    > they are associated to?


    What Objects? Properties of what?

    --

    Michael

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Posts
    154
    Thanks as in, is there a list or documentation where I can see for example:

    Controller . SetVolume

    ^ ^
    "Object" "Property"


    And a list of all objects and properties available. Apologies if these are 'termed' differently.
    Quote Originally Posted by mherger View Post
    > How do I set the squeezebox volume through the SqueezeJS framework and
    > JSON format CLI request?


    Relative change (-1):
    SqueezeJS.Controller.setVolume(1, '-')

    Absolute:
    SqueezeJS.Controller.setVolume(50)

    > Is there away to get a complete list of all the properties and objects
    > they are associated to?


    What Objects? Properties of what?

    --

    Michael

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    SqueezeJS.Controller.playerRequest([JSON formattedCLI request])

    > Thanks as in, is there a list or documentation where I can see for
    > example:
    >
    > Controller . SetVolume
    > ^ ^
    > "Object" "Property"


    No, there's not a complete list. Some basics are covered in
    http://wiki.slimdevices.com/index.php/SqueezeJS.

    Other than that, there's the source :-). Base.js has the controller methods:

    https://github.com/Logitech/slimserv...S/Base.js#L248

    --

    Michael

  5. #5
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,581
    I have incorporated a script into a custom "Now Playing" screen which allows control of some Squeezebox functions via keyboard:
    Code:
    <!-- Binding arrow keys to functions: https://craig.is/killing/mice -->
    <script type="text/javascript" src="/html/ext/mousetrap.js"></script>
    <script type="text/javascript">
    	Mousetrap.bind ('up', function() {SqueezeJS.Controller.setVolume(1, '+')});
    	Mousetrap.bind ('down', function() {SqueezeJS.Controller.setVolume(1, '-')});
    	Mousetrap.bind ('space', function() {SqueezeJS.Controller.playerControl(['pause'])});
    	Mousetrap.bind ('left', function() {SqueezeJS.Controller.playerControl(['playlist index -1'])});
    	Mousetrap.bind ('right', function() {SqueezeJS.Controller.playerControl(['playlist index +1'])});
    </script>
    The final two "playlist index" commands, however, do not work. I'm thinking it may not be a "SqueezeJS.Controller.playerControl" command, but I can't find any alternative. Any suggestions on how to correct this? Thanks.

  6. #6
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    SqueezeJS.Controller.playerRequest([JSON formattedCLI request])

    > Mousetrap.bind ('left', function() {SqueezeJS.Controller.playerControl(['playlist index -1'])});
    > Mousetrap.bind ('right', function() {SqueezeJS.Controller.playerControl(['playlist index +1'])});
    >
    > The final two "playlist index" commands, however, do not work. I'm
    > thinking it may not be a "SqueezeJS.Controller.playerControl" command,
    > but I can't find any alternative. Any suggestions on how to correct
    > this? Thanks.


    Make the parameters separate elements of the list:

    ['playlist', 'index', '+1']


    --

    Michael

  7. #7
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,581
    Thanks Michael, that works well! One follow-up if I may: if I want the "left" arrow to first return to the beginning of the currently playing track rather than go to the previous track, what would be the proper command for that? Essentially, I want to duplicate the behavior of the "back" arrow on the front of the Touch.
    Last edited by Apesbrain; 2019-03-12 at 07:14.

  8. #8
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    SqueezeJS.Controller.playerRequest([JSON formattedCLI request])

    > Thanks Michael, that works well! One follow-up if I may: if I want the
    > "left" arrow to return to the beginning of the currently playing track
    > rather than go to the previous track, what would be the proper command
    > for that?


    Check out what the Default web UI would send ;-). I think it's "button rew".

    --

    Michael

  9. #9
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,581
    Thanks for the suggestion. ['button', 'rew'] duplicates the effect of the ['playlist', 'index', '-1'] command, but does not return to the start of the currently playing track as does the web UI button. The source for the web UI assigns [id="ctrlPrevious"] to the "Previous" button, but I can't find a definition for this element. Any other suggestions are welcome.

  10. #10
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    SqueezeJS.Controller.playerRequest([JSON formattedCLI request])

    > Thanks for the suggestion. ['button', 'rew'] duplicates the effect of
    > the ['playlist', 'index', '-1'] command, but does not return to the


    It shouldn't, when you're well in to a track. See the networking tab in
    your browser's dev tools. You should see the exact request the web UI is
    sending to the server.

    --

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •