You could try using the port 9090 cli rather than calling scanner.pl
directly in your script and see if that makes a difference.  Here is
some code based on Max Spicer's shutdown perl script:


Code:
--------------------
    
  #!/usr/bin/perl -w
  # perl script to initiate a rescan via the cli
  # uses code from Max Spicer's shutdown.pl
  
  use strict;
  use IO::Socket;
  use POSIX qw(strftime);
  
  # Print debug output if true.  Higher values increase verbosity.
  my $debug = 0;
  
  
  # Change server details below if necessary
  my $socket = IO::Socket::INET->new (PeerAddr => '127.0.0.1',
  PeerPort => 9090,
  Proto    => 'tcp',
  Type     => SOCK_STREAM)
  or die 'Couldn\'t connect to server';
  
  # Iniate a rescan
  print "Initiating a rescan...\n";
  my $rescan = sendAndReceive('rescan');
  
  $debug && print "rescan returned $rescan\n";
  
  close $socket;
  
  # Send given cmd to $socket and return answer with original command removed 
from
  # front if present.  Routine nicked from code by Felix Mueller. :-)
  sub sendAndReceive {
  my $cmd = shift;
  
  return if( $cmd eq "");
  
  print $socket "$cmd\n";
  $debug > 1 && print "Sent $cmd to server\n";
  my $answer = <$socket>;
  $debug > 1 && print "Server replied: $answer\n";
  $answer =~ s/$cmd //i;
  $answer =~ s/\n//;
  
  return $answer;
  }
  
--------------------

I use this method all the time to get SC to look for new music and it
works flawlessly for me without needing to restart the SC service.


-- 
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=40610

_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/beta

Reply via email to