tuc wrote: 
> PS: I will try your solution to my original post later today and let you
> know how it went.
> PPS: Long live LMS :-)

first please make sure you've got an answer 

Code:
--------------------
    which nc
  which sed
  
--------------------

otherwise you need to install nc / sed before any further action.


Code:
--------------------
    
  #!/bin/bash
  
  ##vars
  port=9090
  server=127.0.0.1
  hour=`date +%H`
  playlistdir=$(grep "playlistdir:" 
/var/lib/squeezeboxserver/prefs/server.prefs|grep '/'|cut -d ' ' -f2)
  players=$(printf "player count ?\nexit\n" | nc $server $port | cut -d ' ' -f 
3)
  
  for((i=0; i<$players; i++))
  do
  playerID=$(printf "player id $i ?\nexit\n"|nc $server $port|cut -d ' ' -f 
4|sed 's/%3A/:/g')
  player_ID=$(echo $playerID|sed 's/://g')
  playername=$(printf "$playerID name ?\nexit\n" | nc $server $port | cut -d ' 
' -f 3)
  if [ `wc -l /var/lib/squeezeboxserver/prefs/clientplaylist_$player_ID.m3u  | 
awk '{print $1}'` -ge "4" ]
  then
  cp -p /var/lib/squeezeboxserver/prefs/clientplaylist_$player_ID.m3u 
"$playlistdir/$playername"_$hour.m3u
  fi
  done
  
  scanstatus=$(printf "rescan ?\nexit\n"|nc $server $port|cut -d ' ' -f2)
  if [ "$scanstatus" = "1" ]
  then
  echo "lms is already scanning ..aborting"
  exit 0
  fi
  
  find "$playlistdir/" -iname "*_$hour.m3u" -mtime 0 && 
squeezeboxserver-scanner --playlists --novideo --noimage --priority 20 
>/dev/null
  
--------------------


------------------------------------------------------------------------
DJanGo's Profile: http://forums.slimdevices.com/member.php?userid=1516
View this thread: http://forums.slimdevices.com/showthread.php?t=109712

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

Reply via email to