Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    3

    CLI output as plain ascii?

    when using the Command Line Interface via port 9090, can I make the beast talk back in plain ascii...?
    I always get answers with HTML substitution characters (like %3A instead of a : or %20 for all blank etc.) which is less helpful on a user-interface that is not used with a browser normally...

    Any ideas how to turn off this behaviour?

    Thank,
    Klaus

  2. #2
    Senior Member radish's Avatar
    Join Date
    Apr 2005
    Location
    Red Bank, NJ
    Posts
    5,052
    It's URL encoded, not HTML encoded - and no, there's no way I know to switch it off. That's because plain ASCII doesn't support all the characters which might be needed (file/song names with wacky characters, etc). Don't know what you're writing your UI in but I'm sure it has a library to do URLdecode.

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    ...sorry, right its url...

    ...and no there is nothing like this (I write a interface for a Crestron controller)... About 80% of my processor-cycles (and there aren't too many...) I'm wasting with things like:

    While (Find ("\x253A", work, 1) > 0) // while there are %3A
    { Work = mid(work, 1, Find ("\x253A", work, 1) - 1) + ":" +
    mid(work, Find("\x253A",work,1)+3,
    len(work)-1-Find "\x253A",work,1));
    }

    This is to replace %3A with a simple : ... I'd neet to do this for ??? characters. In the end the whole interface tends to be unusable because of this...
    And I can't see the sense of url-encoding it. When its UTF-8, then just output UTF-8...

    Klaus
    Last edited by nine11turbo; 2008-11-29 at 15:09.

  4. #4
    Senior Member radish's Avatar
    Join Date
    Apr 2005
    Location
    Red Bank, NJ
    Posts
    5,052
    I've seen other Crestron modules around for SC, so it must be possible. Typically when doing a URL decode you wouldn't have a block like that for each different character, you'd look for %, and take the next 2 chars as a character code, then replace all 3 with the appropriate symbol. As for why it was chosen, my guess is for ease of delimitation. It's done in URLs because ":", "/" etc have special meaning, and it's the same here. Space for example is often used as a delimiter so if you have a space in a value it needs to be escaped. I guess URL encoding was just seen as convenient as it's a pretty widely understood scheme.

  5. #5
    Quote Originally Posted by radish View Post
    I've seen other Crestron modules around for SC, so it must be possible. Typically when doing a URL decode you wouldn't have a block like that for each different character, you'd look for %, and take the next 2 chars as a character code, then replace all 3 with the appropriate symbol.
    Right, but that'll get you a byte but, IIUC, not necessarily a character. I think the CLI response is not merely URL-encoded, but the encoded bytes are UTF-8. This lets SqueezeCenter support all characters & languages over a 7-bit clean protocol.
    http://www.tux.org/~peterw/
    Note: The best way to reach me is email or PM, as I don't spend time on the forums.
    Free plugins: AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu DenonSerial
    FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
    SettingsManager SleepFade StatusFirst SyncOptions VolumeLock

  6. #6
    Senior Member gharris999's Avatar
    Join Date
    Apr 2005
    Location
    Santa Fe, NM
    Posts
    3,299
    Quote Originally Posted by nine11turbo View Post
    when using the Command Line Interface via port 9090, can I make the beast talk back in plain ascii...?
    I always get answers with HTML substitution characters (like %3A instead of a : or %20 for all blank etc.) which is less helpful on a user-interface that is not used with a browser normally...

    Any ideas how to turn off this behaviour?

    Thank,
    Klaus
    If you can query from a windows client, you can use my SCCLITool to get the data. It has a "-t" option which translates the % and UTF8 encoding.

    The zip includes the full source which perhaps you could adapt to whatever operating system you are using.
    Attached Files Attached Files

  7. #7
    Administrator andyg's Avatar
    Join Date
    Jan 2006
    Location
    Pittsburgh, PA
    Posts
    7,396
    URI-unescaping is simple and fast. It only takes one line of Perl to do it. I'm sure you can find a similarly easy way to do it in whatever language you're using.

    $string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;

  8. #8
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    Quote Originally Posted by andyg View Post
    URI-unescaping is simple and fast. It only takes one line of Perl to do it. I'm sure you can find a similarly easy way to do it in whatever language you're using.

    $string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
    if there would be something like RegEx in Crestron world it would be easy

    Thanks for all input but I think the way to go is to "offload" the parsing to the server where SqueezeCenter is running... Any hints where to look how to get a Netgear ReadyNAS to execute Pearl (or semething else like Python)scripts through a Telnet interface? This way the scripts could get the info from Squeezecenter, do all character conversion etc and deliver formatted text as I need it...?

    thanks for all help
    Klaus

Posting Permissions

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