Music Server Interface

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • Gast

    #76
    Okay, there we go, the initial version: https://github.com/mjesun/loxberry-music-server-gateway! I have never built it and installed as a plugin (only ran it locally on my desktop) but I think it should work.

    Very easy to configure: you just have to point to where your server is, and restart it to take effect (defaults to localhost:8091 but you can change that to point e.g. to your laptop). Regarding the Music Server emulation, Loxone Config uses port 7091 by default, which is also the one used by the plugin internally. But you do not have to care about this internal port; you will receive all actions in the server specified in the LoxBerry UI.

    The easiest to experiment with it is to log all calls you get and see what is their shape, although they are fully described in the README. The SSE interface (EventSource) is not implemented yet, but the server does polling (once every 5 seconds) to know the state of the server, so that should be good for now.

    Next week it's going to be tough for me to check issues and do some stuff on it, but I will keep reading y'all! ^_^

    Kommentar

  • Gast

    #77
    And here some screenshots of the plugin working against a Spotify backend. I will release it at some point too, once everything is stable, at the moment I'm having issues with the player (librespot) i'm using underneath. Data is consumed through the Spotify API.
    Angehängte Dateien

    Kommentar

    • hismastersvoice
      Supermoderator
      • 25.08.2015
      • 7147

      #78
      Gast
      I also go to set the already used 15 Band-EQ to an 10 Band-EQ, so we can also use the EQ-Control from the MSI.
      I have seen that commands from the EQs are shown, but until now I don´t have tried anything with this commands. But I believe it works.
      Kein Support per PN!

      Kommentar


      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        I haven't mapped the equalizer yet into MSG, but I am planning to do so! Main issue with the equalizer is that it completely crashes the Loxone Miniserver when you send an invalid response, and the server restarts from scratch. I am not sure why the equalizer is SO critical; but I think it may be due to a buffer overrun bug when manipulating the string.

        But yes, in short you will be able to get each of the frequencies shown in the UI, plus their gain (in the [-10, 10] format). On an unrelated topic, I hate the interface saying 31 Hz where it should be 31.25 Hz, and 63 Hz where it should be 62.5 Hz!

      • hismastersvoice
        hismastersvoice kommentierte
        Kommentar bearbeiten
        Nothing that is important, but I can easy change to an 10 Band and convert the Numbers to -10,10
    • hismastersvoice
      Supermoderator
      • 25.08.2015
      • 7147

      #79
      Gast
      One other qustion...
      Do I have to install MSG an MSI?
      If I run MSG MusicServer 1 are showing "online" but how to configure a second MusicServer than?
      Kein Support per PN!

      Kommentar


      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        You only need MSG to start getting calls from commands happened in the UI. You can have both if you want but you would need two separate music servers set up on your Loxone Config. In fact, I will make MSI dependant on MSG at some point in the future. So you will be able to plug it the way you prefer. Something like:

                                                Casatunes
                                                Squeezelinte
        Loxone UI <-> MSG <-> LMS
                                                Spotify backend
                                                MSI
                                                MS4L

        (In your case I think you will embed MSG inside MS4L though, but you get the idea: MSG adapts and standardizes calls and you can plug anything to it that respects its interface. MSG will do all the hard work for you).

        Edit: you can only plug once at the same time. Just for clarification
        Zuletzt geändert von Gast; 10.05.2020, 19:55.

      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        Ooh, I just re-read your comment and understood what you meant.

        At the moment there is only one, but I plan adding the option to run many more. Still early development
    • Prof.Mobilux
      Supermoderator
      • 25.08.2015
      • 4590

      #80
      Gast Really cool work! Just run the first tests and it's really cool!

      Just have seen: Volume control seems to be a bug: Always POSTs "/zone/1/volume/undefined" instead of volume value.

      I will start development for the LMS Gateway now within Christian Fenzl Squeezelite Plugin.
      🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


      LoxBerry - Beyond the Limits

      Kommentar


      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        Happy to know you like it! We will progressively map the entire functionality while keeping the API small and consistent for everything.

        Re: volume; I just pushed a fix for it (a last-minute refactor 🤦‍♂️, should be good now).
    • Christian Fenzl
      Lebende Foren Legende
      • 31.08.2015
      • 11200

      #81
      Gast Some questions in between

      - Will MSG provide a push webserver for every single Music Server emulation (own port each), or will you provide one webserver for all MS together?

      - If a request of MSG to us fails for some reason (e.g. our user had done no config), would you expect an HTTP 500, or an error payload in json?

      - For commands like play, time, volume etc., do you always expect the full zone state as response, or would it be enough to respond with a diff (e.g. volume only responds volume) ?


      We excitedly look forward for the push interface ;-)
      Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine

      Kommentar


      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        - Will MSG provide a push webserver for every single Music Server emulation (own port each), or will you provide one webserver for all MS together?
        It will be one port per emulated Music Server. How those are treated is left to the implementer (for instance, I think hismastersvoice will be creating "logical zones" over multiple servers; i.e. read from 8091 zones 1-20, then 8092 zones 21-40 (although these zones are a separate music server on a different port).

        - If a request of MSG to us fails for some reason (e.g. our user had done no config), would you expect an HTTP 500, or an error payload in json?
        Funny enough, the Loxone protocol has no way of prompting an internal error in the UI (I will confirm this weekend, but so far I have *never* seen a field related to this - they're too good ). Right now if you don't return a 200 the server handles it, which in the case of an explicit error (as you said, a 5XX error) is pretty wrong because the action failed on purpose. It sounds reasonable to use those error codes to signal this; I will make sure the default behavior is interrupted if you return 5XX. In particular, for now just send a 503 (Service temporarily unavailable).

        - For commands like play, time, volume etc., do you always expect the full zone state as response, or would it be enough to respond with a diff (e.g. volume only responds volume) ?
        A diff is good enough, but in my personal opinion, never miss a chance of updating the whole state if possible The more you send, the closer the status represented in the UI matches the real status of the player.

        Can't wait for what y'all are doing!!
    • Prof.Mobilux
      Supermoderator
      • 25.08.2015
      • 4590

      #82
      Gast Additionally to Christian Fenzl question (we currently are working on the same code :-), I found a bug in the volume settings again:

      - Volume slider works now as expected
      - Button for "Volume step up" sends "volume 100"
      - Button for "Volume step down" sends "volume NaN"
      Zuletzt geändert von Prof.Mobilux; 12.05.2020, 20:48.
      🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


      LoxBerry - Beyond the Limits

      Kommentar


      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        Crap! Okay, I noted it side with the 5XX from Christian Fenzl and will check this weekend.
    • Prof.Mobilux
      Supermoderator
      • 25.08.2015
      • 4590

      #83
      ...and for the others: See the status of the MSG implementation of LoxBerry Squeezelite Plugin here:


      (Left side: LoxConfig WebUI Right side: LMS WebUI)

      Synchronisation is still not smoothly because currently MSG plugin only pull for new states, but we cannot push at the moment. Nevertheless, it's already pretty cool :-).
      Zuletzt geändert von Prof.Mobilux; 12.05.2020, 20:08.
      🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


      LoxBerry - Beyond the Limits

      Kommentar


      • Lee
        Lee kommentierte
        Kommentar bearbeiten
        Gast Awesome job. Please don't let msi die! I would like to connect my Heos via MSI or can I also connect it via MSG?

      • TomekWaw
        TomekWaw kommentierte
        Kommentar bearbeiten
        Wow!

      • Gast
        Gast kommentierte
        Kommentar bearbeiten
        Lee MSI is a more "Loxone" approach: basic commands, with UDP virtual inputs/outputs, but very limited in what it can do. MSG on the flip side is a full fledged gateway for all actions in the Music Server UI. MSG is the evolution of MSI, after a bunch of bloggers asked for a deeper integration between their players and the UI. As a result, MSI will also be made dependant on MSG, because it's easier to use the gateway, but will not disappear.
    • Gast

      #84
      Zitat von Prof.Mobilux
      ...and for the others: See the status of the MSG implementation of LoxBerry Squeezelite Plugin here:


      (Left side: LoxConfig WebUI Right side: LMS WebUI)

      Synchronisation is still not smoothly because currently MSG plugin only pull for new states, but we cannot push at the moment. Nevertheless, it's already pretty cool :-).
      This looks awesome! So much progress in just a few days!

      For this weekend - if I get some time, which is unsure right now, I will be focusing on:

      * When outputting JSON error, show the fragment around it.
      * Fix the bug with volume (again!).
      * Fix the cover bug on version 11 of the app.
      * Block optimistic updates when the error obtained is a 5XX.
      * Start working on SSE updates for real-time syncing on events.

      I also want to start taking a look at designing an API for nested directories, so that we can bring full data exploration and playlists to the UI (e.g. see the tracks of a playlist or the files of a folder when checking the media library or the favorites). I anticipate it not changing the existing contract, so it will work on top of existing stuff.
      Zuletzt geändert von Gast; 15.05.2020, 15:43.

      Kommentar

      • hismastersvoice
        Supermoderator
        • 25.08.2015
        • 7147

        #85
        Gast
        I do also some testing this night. Thanks to madito
        Beside volume etc I found another thing to look at.

        Version 11 App don`t show the Cover in big if you go to the player

        Klicke auf die Grafik für eine vergrößerte Ansicht

Name: 15-05-_2020_15-18-25.png
Ansichten: 886
Größe: 49,8 KB
ID: 249504Klicke auf die Grafik für eine vergrößerte Ansicht

Name: 15-05-_2020_15-18-35.png
Ansichten: 881
Größe: 53,8 KB
ID: 249505
        Kein Support per PN!

        Kommentar


        • Gast
          Gast kommentierte
          Kommentar bearbeiten
          Noted in the post! I will try reproducing this one using the latest version. In web works well but I assume those are different versions (I don't actually recognize the styling of the player).
      • Prof.Mobilux
        Supermoderator
        • 25.08.2015
        • 4590

        #86
        hismastersvoice I saw the same, but wasn't that a bug in App V11? I think I read something about blank (white) covers in App V11...
        🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


        LoxBerry - Beyond the Limits

        Kommentar


        • hismastersvoice
          hismastersvoice kommentierte
          Kommentar bearbeiten
          There was so much bugs in V11, can´t remember all of them
          Will have a look if I find the post.

        • Prof.Mobilux
          Prof.Mobilux kommentierte
          Kommentar bearbeiten
          Just updated the app. Still no cover.... So could be an issue with MSG. Maybe we have to set the artworkspec?
      • Prof.Mobilux
        Supermoderator
        • 25.08.2015
        • 4590

        #87
        hismastersvoice You wrote that you grab the cover info from the songinfo. I tried this for the playlist and grab the current playlist with the following command (I use json rpc instead of the CLI for that, but it's the same syntax as the CLI):

        Code:
        curl -s -H "Content-Type: application/json" -X POST -d '{"id":1,"method":"slim.request","params":["c4:32:5e:e7:32:39", ["status",0,500,"tags:acd"]]}' http://localhost:9000/jsonrpc.js | jq
        This is the result:

        Code:
        {
        "duration": 171.441,
        "coverid": "-198249376",
        "playlist index": 89,
        "title": "Beautiful Pain (Losin My Mind)",
        "artist": "Polo G",
        "id": "-198249376"
        }
        But when I try to grab the cover with the converid I only get a default "radio" icon when the playlist comes from a stream or from spotify.

        Code:
        [URL]http://192.168.3.212:9000/music/-198249376/cover.jpg[/URL]
        Is this the same in your installation or do I use the wrong URL?
        🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


        LoxBerry - Beyond the Limits

        Kommentar

        • Prof.Mobilux
          Supermoderator
          • 25.08.2015
          • 4590

          #88
          Ah, found a "trick". With this command you also get an icon url:

          Code:
          curl -s -H "Content-Type: application/json" -X POST -d '{"id":1,"method":"slim.request","params":["c4:32:5e:e7:32:39", ["status",0,500,"tags:acd","menu:playlist","useContextMenu:1"]]}' http://localhost:9000/jsonrpc.js | jq
          🇺🇦 Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine


          LoxBerry - Beyond the Limits

          Kommentar

          • hismastersvoice
            Supermoderator
            • 25.08.2015
            • 7147

            #89
            For now I take it from /music/current/cover.jpg?player=xxxxxx
            Only if get I get a 404 back, I take it from status 2, the 404 happens sometime at Tunein Radios.
            Will also do a test with your proposal.
            Zuletzt geändert von hismastersvoice; 15.05.2020, 18:45.
            Kein Support per PN!

            Kommentar


            • Prof.Mobilux
              Prof.Mobilux kommentierte
              Kommentar bearbeiten
              Yes, but you also need the covers when you display the playlist, favorites etc. The "menulaylist useContextMenu:1" for the playlist and menu:favorite useContextMenu:1" do the trick. Works also from the CLI.

            • hismastersvoice
              hismastersvoice kommentierte
              Kommentar bearbeiten
              Switch to JSON. Makes it easier to Implement. Thanks
          • hismastersvoice
            Supermoderator
            • 25.08.2015
            • 7147

            #90
            Gast
            What I still have a problem with...
            Fav and Zone-Favs.
            I understand that I can send a json, but for Favs I need a URL. How the json have to look for a favs?
            can you give us an exemplare?
            Kein Support per PN!

            Kommentar


            • Gast
              Gast kommentierte
              Kommentar bearbeiten
              URLs as id’s are supported; but it’s probably your server the one that is not understanding it on your path. Probably those slashes are confusing PHP and you don’t get the expected value. I will URL-encode them as well when MSG calls the backend just in case; but if you get the full URL that should be good.

            • hismastersvoice
              hismastersvoice kommentierte
              Kommentar bearbeiten
              I think that it is so that the // from http is the problem.
              Will have a deeper look tomorrow how to split it in a better way.

            • Gast
              Gast kommentierte
              Kommentar bearbeiten
              I just published an update that encodes ids when sent via the /play command. This should fix the issue, and if you use any framework the id should be transparently decoded. If not you need to apply URL decoding following RFC3986.
          Lädt...