MythVideo:playRandom.sh

From MythTV Official Wiki
Jump to: navigation, search
#!/bin/sh

music_video_dir="/myth/video/videos/Music/"
video_types=".mpg$|.avi$|.mpeg$"

playlist="$1"

shuffle () {
perl -e '
  srand(time|$$);
  @a = <>;
  while ( @a ) {
    $choice = splice(@a, rand @a, 1);
    print $choice;
  }
 '
}

find "${music_video_dir}"       |
  egrep -i "${video_types}"     |
  shuffle > "$playlist"

mplayer -quiet -fs -zoom -vo xv -playlist "$playlist"