Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7

Hybrid View

  1. #1
    Bill Moseley
    Guest

    Command Line interface - X10 Remote

    Looking for suggestions:

    I have an X10 remote that connects to the serial port. I have a Perl
    script (mouseremote.pl) that listens to the serial port and maps
    keystrokes to commands that are issued via a system() call.

    For example, I have the remote run these commands when in "CD" mode to
    control xmms:

    [CD]
    Power xmms&
    .VolUp xmms-shell -e 'upvolume 2'
    .VolDown xmms-shell -e 'downvolume 2'
    FF xmms-shell -e next
    Pause xmms-shell -e pause
    Play xmms-shell -e play
    Rew xmms-shell -e previous
    ab xmms-shell -e 'shuffle ON'
    Disp xmms-shell -e 'shuffle OFF'
    Stop xmms-shell -e stop
    Mute xmms-shell -e pause

    Is there a utility available to send commands to the slimserver via
    a system call? I know I can connect to port 9090 -- but I'm wondering if
    there's already a program available that will work with my existing
    setup.

    Thanks,



    --
    Bill Moseley
    moseley (AT) hank (DOT) org


  2. #2
    bill fumerola
    Guest

    Command Line interface - X10 Remote

    On Wed, May 11, 2005 at 03:48:36PM -0700, Bill Moseley wrote:
    > Is there a utility available to send commands to the slimserver via
    > a system call? I know I can connect to port 9090 -- but I'm wondering if
    > there's already a program available that will work with my existing
    > setup.


    you could use netcat[1] to simplify sending commands to tcp/9090.

    -- bill

    1. http://public.www.planetmirror.com/p...tcat/nc110.tgz

  3. #3
    Senior Member radish's Avatar
    Join Date
    Apr 2005
    Location
    Red Bank, NJ
    Posts
    5,052
    I use the following little perl script to tell my slimserver to do a rescan whenever I sync new music onto it, you may be able to adapt it to your needs.

    Code:
    use IO::Socket;
    
    $server="servername";
    $port=9090;
    
    print "Connecting to SlimServer at ".$server.":".$port."...\n";
    
    $remote = IO::Socket::INET->new(
                        Proto    => "tcp",
                        PeerAddr => $server,
                        PeerPort => $port,
                    )
                  or die "ERROR: Cannot connect to SlimServer";
    
    $remote->autoflush(1);
    
    print $remote "rescan\n";
    
    $response = <$remote>;
    $response == "rescan" || die "ERROR: Bad response from SlimServer : $response\n";
    
    print $remote "exit\n";
    close $remote;
    
    print "SlimServer is rescanning the music library\n";
    exit;

  4. #4
    Bill Moseley
    Guest

    Re: Command Line interface - X10 Remote

    On Wed, May 11, 2005 at 06:00:08PM -0700, radish wrote:
    >
    > I use the following little perl script to tell my slimserver to do a
    > rescan whenever I sync new music onto it, you may be able to adapt it
    > to your needs.


    Thanks. I'll give it a try.

    > $response == "rescan" || die "ERROR: Bad response from SlimServer : $response\n";


    BTW - I think you want "eq" not "==".

    --
    Bill Moseley
    moseley (AT) hank (DOT) org


  5. #5
    Senior Member radish's Avatar
    Join Date
    Apr 2005
    Location
    Red Bank, NJ
    Posts
    5,052
    Quote Originally Posted by Bill Moseley
    On Wed, May 11, 2005 at 06:00:08PM -0700,

    BTW - I think you want "eq" not "==".
    You're right - thanks!

    Can you tell I'm not a professional perl coder?

  6. #6
    Junior Member
    Join Date
    Jul 2005
    Posts
    26
    Quote Originally Posted by radish
    I use the following little perl script to tell my slimserver to do a rescan whenever I sync new music onto it, you may be able to adapt it to your needs.

    Code:
    use IO::Socket;
    
    $server="servername";
    $port=9090;
    
    print "Connecting to SlimServer at ".$server.":".$port."...\n";
    
    $remote = IO::Socket::INET->new(
                        Proto    => "tcp",
                        PeerAddr => $server,
                        PeerPort => $port,
                    )
                  or die "ERROR: Cannot connect to SlimServer";
    
    $remote->autoflush(1);
    
    print $remote "rescan\n";
    
    $response = <$remote>;
    $response == "rescan" || die "ERROR: Bad response from SlimServer : $response\n";
    
    print $remote "exit\n";
    close $remote;
    
    print "SlimServer is rescanning the music library\n";
    exit;
    Thanks for that ! I've added the script to my transfer script.

    I had to add

    Code:
    chomp $response;
    for the response test to work.

  7. #7
    John Gorst
    Guest

    Command Line interface - X10 Remote

    Bill Moseley wrote:
    > Looking for suggestions:
    >
    > I have an X10 remote that connects to the serial port. I have a Perl
    > script (mouseremote.pl) that listens to the serial port and maps
    > keystrokes to commands that are issued via a system() call.
    >
    > For example, I have the remote run these commands when in "CD" mode to
    > control xmms:
    >
    > [CD]
    > Power xmms&
    > .VolUp xmms-shell -e 'upvolume 2'
    > .VolDown xmms-shell -e 'downvolume 2'
    > FF xmms-shell -e next
    > Pause xmms-shell -e pause
    > Play xmms-shell -e play
    > Rew xmms-shell -e previous
    > ab xmms-shell -e 'shuffle ON'
    > Disp xmms-shell -e 'shuffle OFF'
    > Stop xmms-shell -e stop
    > Mute xmms-shell -e pause
    >
    > Is there a utility available to send commands to the slimserver via
    > a system call? I know I can connect to port 9090 -- but I'm wondering if
    > there's already a program available that will work with my existing
    > setup.


    Enable XPL interface in server setup.
    Go to www.xplproject.org.uk
    Download the perl xpl command line sender and hub
    You can then have you perl script send xpl messages by using the xplsend
    perl script. Slimserver will recieve the xpl messages and act on them
    (e.e. fast forward, stop etc).

    You cna find info on slimserver and xpl on the help section of the
    slimserver web interface.

    HTH


Posting Permissions

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