tuc wrote: 
> Sometimes I (or friends) accidentally zap the active playlist by
> pressing "play" to an item found by a search in the music library. I
> would like to be able to "go back" to the previous active playlist. Now,
> this is quite tricky since it would require every update to the active
> playlist to be "saved to disk" and also require functionality to make
> the "playlist saved to disk available".
> PPS: Long live LMS :-)

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.

save the script, make it executable and let it run

The last line is not working because of the # in front
If you remove that # your lms starts scanning your playlists - snce your
runing a rpi i wasnt sure if you really want that.

Feel free to test it before you add it as a cronjob. You should end in a
playlist in your playlistfolder for every player named
playername_hour.m3u.
If you run it always @ the same hour it should do what you want.


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)
  printf "$playerID playlist move 0 1\n $playerID playlist move 1 0\nexit 
\n"|nc $server $port
  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