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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atca
    Senior Member
    • Aug 2012
    • 190

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

    That's a behaviour you can configure in LMS Settings/Player/Syncronization.

    --

    Michael
  • atca
    Senior Member
    • Aug 2012
    • 190

    #2
    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"}

    Comment

    • mherger
      Babelfish's Best Boy
      • Apr 2005
      • 24643

      #3
      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
      Michael

      "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
      (LMS: Settings/Information)

      Comment

      • atca
        Senior Member
        • Aug 2012
        • 190

        #4
        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.
        Originally posted by mherger
        > 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

        Comment

        • mherger
          Babelfish's Best Boy
          • Apr 2005
          • 24643

          #5
          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:



          --

          Michael
          Michael

          "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
          (LMS: Settings/Information)

          Comment

          • Apesbrain
            Senior Member
            • Jun 2005
            • 2304

            #6
            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.

            Comment

            • mherger
              Babelfish's Best Boy
              • Apr 2005
              • 24643

              #7
              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
              Michael

              "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
              (LMS: Settings/Information)

              Comment

              • Apesbrain
                Senior Member
                • Jun 2005
                • 2304

                #8
                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, 15:14.

                Comment

                • mherger
                  Babelfish's Best Boy
                  • Apr 2005
                  • 24643

                  #9
                  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
                  Michael

                  "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                  (LMS: Settings/Information)

                  Comment

                  • Apesbrain
                    Senior Member
                    • Jun 2005
                    • 2304

                    #10
                    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.

                    Comment

                    • mherger
                      Babelfish's Best Boy
                      • Apr 2005
                      • 24643

                      #11
                      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
                      Michael

                      "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                      (LMS: Settings/Information)

                      Comment

                      • Apesbrain
                        Senior Member
                        • Jun 2005
                        • 2304

                        #12
                        Originally posted by mherger
                        >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.
                        When I look at the Networking tab I see nothing obvious in what the browser is sending in response to a press on those buttons.

                        However, inspecting the buttons reveals the following:

                        Previous: <button type="button" style="padding: 0px; width: 31px;" class=" x-btn-text" id="ext-gen41" title="Previous"></button>
                        Next: <button type="button" style="padding: 0px; width: 31px;" class=" x-btn-text" id="ext-gen45" title="Next"></button>

                        Any idea on where I would find the definitions of those two "id" items?

                        Comment

                        • mherger
                          Babelfish's Best Boy
                          • Apr 2005
                          • 24643

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

                          > When I look at the Networking tab I see nothing obvious in what the
                          > browser is sending in response to a press on those buttons.


                          Whenever you press a button you should see a call to /jsonrpc.js. Click
                          the entry and more details (parameters, results etc.) should be shown on
                          the side.

                          > However, inspecting the buttons reveals the following:
                          >
                          > Previous: <button type="button" style="padding: 0px; width: 31px;"
                          > class=" x-btn-text" *id="ext-gen41"* title="Previous"></button>
                          > Next: <button type="button" style="padding: 0px; width: 31px;" class="
                          > x-btn-text" *id="ext-gen45"* title="Next"></button>
                          >
                          > Any idea on where I would find the definitions of those two "id" items?


                          These IDs are created on the fly by the JS framework being used (extjs).
                          There really is no easier way to see the requests than the networking
                          traffic as outlined above.

                          --

                          Michael
                          Michael

                          "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                          (LMS: Settings/Information)

                          Comment

                          • Apesbrain
                            Senior Member
                            • Jun 2005
                            • 2304

                            #14
                            Got it! Switched from Chrome over to Firefox and found it easier to see the requests being sent:

                            ['button', 'jump_rew']
                            ['button', 'jump_fwd']

                            Thanks.

                            Comment

                            • MillmoorRon
                              Senior Member
                              • Jul 2006
                              • 327

                              #15
                              Just been looking at the same thing and found this thread.

                              I have two players synchronised but I only want the volume adjusted on one of them.

                              Is this possible by this method?

                              Comment

                              Working...