Hi

I have my audio spread across my harddisk. I told squeezeserver to
index / , and that works, but it recreates the complete folder
structure of everything - even of folders that dont contain audio.
Which looks like a big mess on the client.

So I wrote a little shell script that locates my audio and recreates a
folder structure of only those folders that contain audio, and add
symlinks to the original audio files in that structure. Luckily,
squeezeserver understands symlinks. 

So I wanted to share the little script here. Hope it works - here
goes:

Code:
--------------------
    
  
  #!/bin/sh
  
  TEMPFILE=/tmp/squeezecenter.idx
  INDEXDIR=/usr/share/squeezecenter/INDEX
  locate -i *.wav *.mp3 *.au *.aif *.aiff *.flac \
  | grep -v "$INDEXDIR/" \
  | grep -v "/mnt/" \
  | grep -v "/\." \
  | grep -v "/_" \
  > $TEMPFILE
  
  OFS=$IFS
  IFS="
  "
  
  for SRC in `cat $TEMPFILE`; do
  if [ -f "$SRC" ]; then
  #DIRDST=`dirname $SRC | md5sum - | sed 's/  -//'`
  DIRDST=`dirname $SRC`
  FILEDST=`basename $SRC`
  if [ ! -f $INDEXDIR/$DIRDST/$FILEDST ]; then
  echo newfile... $SRC
  if [ ! -d $INDEXDIR/$DIRDST ]; then
  echo creating.. $INDEXDIR/$DIRDST
  mkdir -p $INDEXDIR/$DIRDST
  fi
  echo linking... $INDEXDIR/$DIRDST/$FILEDST
  ln -s "$SRC" $INDEXDIR/$DIRDST/$FILEDST
  fi
  fi
  done
  
  IFS=$OFS
  
--------------------


I stored the script in /usr/share/queezecenter/Bin/i1368-linux and run
it from /etc/cron.daily; it generates a fake structure in
/usr/share/squeezeserver/INDEX; and I told squeezecenter this is my
root dir. That seems to work fine.

Ofcourse, this is the ugly way to do it. Preferably, Squeezeserver just
wouldnt generate empty dirs in its index, or remove them in a cleanup
phase.

$2c,
*-pike


-- 
pike67
------------------------------------------------------------------------
pike67's Profile: http://forums.slimdevices.com/member.php?userid=20373
View this thread: http://forums.slimdevices.com/showthread.php?t=53454

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

Reply via email to