All pastes #610606 Raw Edit

Mine

public text v1 · immutable
·published 2007-07-09 15:37 UTC
rendered paste body
#!/bin/bash


mythVidDir=/mnt/mythtv/storage/mythtv/
linkDir=/home/wired/links/mythtv
rm -r $linkDir/*

recordedVids=($mythVidDir*.mpg)

# shows+=("_Recent")
# mkdir "$linkDir/$showname/"

for file in "${recordedVids[@]}"
do
  #echo $file[@]
  filename="${file#$mythVidDir}"
  #echo $filename
  showname="${filename%% - *.mpg}"
  episodename="${filename#* - }"
  if [ "$showname" == "$episodename" ]
  then
    showname="_Recent"
  fi
  showsCount=${#shows[@]} 
  showExists=""
  for show in "${shows[@]}"
  do
    if [ "$showname" == "$show" ]
    then
      showExists="yes"
      break
    fi
  done
  if [ -z $showExists ]
  then
    mkdir "$linkDir/$showname/"
    shows+=("$showname")
  fi
  ln -s "$file" "$linkDir/$showname/$episodename"
done
ln -s "/home/wired/scripts/mythlinker" "$linkDir/UPDATE"