Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    16

    Searching a CLI tool

    Hi,
    I'm looking for a DOS command line tool to submit commands via TCP/IP to Squeezeserver.


    Any suggestions?

    Regards
    DoXer
    Last edited by DoXer; 2012-07-12 at 08:16.

  2. #2
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    10,387
    Dos ?!? 2012? The year in which "intelligent" forum software won't even let me write that in all capital letters anymore...
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    New: Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com

  3. #3
    Junior Member
    Join Date
    May 2009
    Posts
    16
    With DOS I mean the commandline of MS OSes like Windows 7, XP....

    Or how do you call the COPY, DIR... commands?
    Last edited by DoXer; 2012-07-12 at 10:06.

  4. #4
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    1,466
    The old style CLI offered by the server works with something such as telnet or netcat.

    http://wiki.slimdevices.com/index.ph...dia_Server_CLI

    Anything able to open then write to a TCP/IP socket should work.

    Beware of encoding issues, and decoding on the way back.
    IMHO this interface is less reliable than the "current" JSON interface: you have to do your own error handling, both at transport and application levels. Using some JSON library most of that comes free.

    EDIT: Ok I saw your answer to Pippin's remark. Find the JSON toolkit of your choice and you'll be fine. I guess it is a matter of language preference. I've been using the CLI with Perl, socket or JSON styles.
    4 SB 3 • iPeng (iPhone + iPad) • SqueezeLite • Squeezebox Server 7.6.2 (Debian 6.0) with plugins: CD Player, WaveInput by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • Just Covers by Tom Kalmijn • WeatherTime by Martin Rehfeld • Local Player, BBC iPlayer, SwitchPlayer by Triode • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  5. #5
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    1,466
    Quote Originally Posted by DoXer View Post
    With DOS I mean the commandline of MS OSes like Windows 7, XP....

    Or how do you call the COPY, DIR... commands?
    I would say this is called the "windows shell". That's a command line interface to the windows O.S. (and it's been designed to mimic DOS)

    DOS was, in itself, - err, is - an O.S. Lowmem, highmem and all that is long gone by now.
    Last edited by epoch1970; 2012-07-12 at 10:15.
    4 SB 3 • iPeng (iPhone + iPad) • SqueezeLite • Squeezebox Server 7.6.2 (Debian 6.0) with plugins: CD Player, WaveInput by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • Just Covers by Tom Kalmijn • WeatherTime by Martin Rehfeld • Local Player, BBC iPlayer, SwitchPlayer by Triode • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  6. #6
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,316
    Quote Originally Posted by DoXer View Post
    I'm looking for a DOS command line tool to submit commands via TCP/IP to Squeezeserver.
    Not sure if something is available in Windows out of the box, telnet probably is, but else you can download and use netcat according to the following page:
    http://www.nicobaumgartner.ch/blog/?p=237
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
    You may also want to try my Android apps Squeeze Display and RSS Photo Show
    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  7. #7
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    10,387
    putty would be the most common tool under Windows. At least that's what it was when I was still using Windows, which was, admittedly, a while ago...
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    New: Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com

  8. #8
    Senior Member gharris999's Avatar
    Join Date
    Apr 2005
    Location
    Santa Fe, NM
    Posts
    3,299
    My SCCLITool.exe is exactly what you want. Part of the SCPowerTool package. Download it from here:

    http://code.google.com/p/srvrpowerct...t.exe&can=2&q=

    Use example: batch file to trigger a scan for new on a separate server:

    scan_for_new.cmd
    Code:
    @echo off
    set LMS_NAME=squeezenas
    set LMS_MACADDR=aa:bb:cc:dd:ee:ff
    set LMS_IP=192.168.1.222
    set LMS_CLIPORT=9090
    set BROADCASTIP=192.168.1.255
    set NETMASK=255.255.255.0
    
    :checkwake
    echo Checking %LMS_NAME% status..
    ping %LMS_IP% -n 1 -w 10 >NUL 2>&1
    
    if errorlevel 1 goto wakeup
    goto awake
    
    :wakeup
    echo %LMS_NAME% is asleep...attempting to wake it up..
    rem Wakeup the server..
    SCWOLTool.exe %LMS_MACADDR% %BROADCASTIP% %NETMASK% 7
    
    sleep 18
    goto checkwake
    
    
    :awake
    
    rem Rescan the whole library:
    rem echo %LMS_NAME% is awake...initiating db wipe and rescan.
    rem SCCLITool.exe wipecache -q -w 0 -h %LMS_IP% -p %LMS_CLIPORT%
    
    rem Scan for new music:
    echo %LMS_NAME% is awake...initiating scan for new music.
    SCCLITool.exe rescan external -q -w 0 -h %LMS_IP% -p %LMS_CLIPORT%
    PS: the complete C source code to the tool is at that site too.
    Last edited by gharris999; 2012-07-12 at 19:29.

  9. #9
    Senior Member gharris999's Avatar
    Join Date
    Apr 2005
    Location
    Santa Fe, NM
    Posts
    3,299
    Also, if you need to return and process data from the server in a windows batch file, pay attention to what epoch1970 says about encoding issues.

    In your batch file, with windows 7, you can change to a UTF8 code page and do something like this:

    test.cmd:
    Code:
    @echo off
    rem change to UTF8 codepage:
    chcp 65001
    
    rem query the server for some data and save it to a file:
    
    scclitool.exe albums 0 500 new -w3 -t -h %LMS_IP% -p %LMS_CLIPORT% >temp.txt
    
    rem I believe that temp.txt will be ansi encoded.  At least with my tests, all the diacritics 
    rem appeared to be correct and notepad.exe reported that the file was ansi.
    rem I'm not sure why simple redirection should result in a UTF8 to ansi translation.
    
    rem (the -t arg to scclitool.exe un-percent-encodes the query output from the server).
    
    rem process or extract data from temp.txt  (I'm a big fan of sed.exe for jobs like this).
    
    rem do something with the data 
    
    rem clean up
    del temp.txt
    Last edited by gharris999; 2012-07-12 at 19:08.

Posting Permissions

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