Announcement

Collapse
No announcement yet.

Search skills to create a plugin for Pcp running on Pi4.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Originally posted by PaulH View Post
    it is also curious to see how the spaces are managed with %20 !
    URL-encoding - very common when you do not want embedded spaces to confuse the parsing of data.

    Accented chars also: Ga%C3%ABtan
    What kind of coding is it ?
    UTF-8 - from 2nd paragraph in the built-in documentation in LMS
    "For strings, Logitech Media Server uses the UTF-8 character-set encoding."

    Is it possible to configure it to ASCII ?
    No. I expect you will be able to find a UTF8 handling library - or just map the few accented characters that you know you will see if you do not plan to make this available to anyone else.
    Last edited by Paul Webster; 2022-01-24, 16:54.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

    Comment


      #32
      Originally posted by PaulH View Post
      dc%3Aa6%3A32%3A75%3A45%3A0a title WOULD%20I%20LIE%20TO%20YOU[/CODE]

      it is also curious to see how the spaces are managed with %20 !
      Accented chars also: Ga%C3%ABtan
      What kind of coding is it ?
      Is it possible to configure it to ASCII ?
      It is known HTML encoding, HTML escaping, HTML URL encoding or percent encoding. https://www.w3schools.com/tags/ref_urlencode.asp

      Two reason
      1. Spaces are significant as a separator of keyword/parameters to distinguish from LMS values returned
      2. Data from LMS is UTF8 and so non ASCII with accented/foreign characters (e.g. chinese ) are in values returned.

      So HTML encoding so spaces and UTF8 characters in LMS returned values can be passed on accurately.

      Ga%C3%ABtan = Gaƫtan
      Last edited by bpa; 2022-01-24, 16:38. Reason: clarify 2nd point

      Comment


        #33
        Originally posted by PaulH View Post
        The output is a little strange;
        What does dc%3Aa6%3A32%3A75%3A45%3A0a mean ?
        MAC address of ther player - %3A is a colon
        dc%3Aa6%3A32%3A75%3A45%3A0a = dc:a6:32:75:45:0a

        Code:
        title ?
        
        dc%3Aa6%3A32%3A75%3A45%3A0a title WOULD%20I%20LIE%20TO%20YOU
        Response syntax - <MAC address><SP><responsetype><SP><VALUE>
        dc:a6:32:75:45:0a title WOULD I LIE TO YOU


        See in WebUI - Help (bottom Left) - Technical Information - Command line Reference
        Last edited by bpa; 2022-01-24, 17:14.

        Comment


          #34
          Originally posted by bpa View Post
          It is known HTML encoding, HTML escaping, HTML URL encoding or percent encoding. [url]https://www.w3schools.com/tags/ref_urlencode.asp[/url
          I saw this thread about the LCD display, but in German. https://forums.slimdevices.com/showt...l=1#post816678
          But it seems that into the readsq.py an UTF8/HTML decoding is done.
          Is it possible to adapt it ?

          Thanks

          Comment


            #35
            Originally posted by PaulH View Post
            I saw this thread about the LCD display, but in German. https://forums.slimdevices.com/showt...l=1#post816678
            But it seems that into the readsq.py an UTF8/HTML decoding is done.
            Is it possible to adapt it ?
            I told you about readsq.py a many post ago.
            It uses the Python library to decode the HTML encoded string into the internal Python string (which supports UTF8).

            You're going in circles.
            Output from a modified readsq has to go out on the serial port but as discussed earlier PCP micropython doesn't support threading or perhaps pyserial. Which is why "nc" is being used.
            Last edited by bpa; 2022-01-25, 13:56. Reason: typos

            Comment


              #36
              Originally posted by bpa View Post
              I told you about readsq.py a many post ago.
              It uses the Python library to deocde the HTML encoded string into the internal Pyhtoin string (which supports UTF8).

              You're going in circles.
              Output from a modified readsq has to go out on the serial port but as discussed earlier PCP micropython doesn't support threading or perhaps pyserial. Which is why "nc" is being used.
              Ok, I will decode that on my HA.

              Comment


                #37
                Originally posted by PaulH View Post
                Ok, I will decode that on my HA.
                If it is Arduino based - there are many example C solution for URL decoding / percent decoding already available.

                Comment

                Working...
                X