[MPlayer-users] mplayer 1.0pre5

Giacomo Comes comes at naic.edu
Thu Sep 2 17:15:40 CEST 2004


> Giacomo for scripting purposes, I am basically looking for a way to play a
> collection of multimedia files in a directory randomly and continuously, I
> would also need to change the files that are being played, new additions etc

Try this:
you have to specify the options for the mplayer command and add
all the possible extensions of the files to play

Hope it's ok.

Giacomo



#!/bin/bash

#### cd to the directory that contains the files to play
#### forever loop
while : ; do
    unset LIST
    #### create the list of all the files to play
    for a in * ; do
        LIST[${#LIST[*]}]=$a
    done
    #### play once randomly all the files in the list
    while ((${#LIST[*]})) ; do
        i=$(($RANDOM%${#LIST[*]}))
        #### the extension tells what to do
        case ${LIST[i]} in
            *.avi|*.mpeg)
                mplayer <options for movies> ${LIST[i]}
                ;;
            *.jpg|*.jpeg)
                mplayer <options for files> mf://${LIST[i]} -fps 0.1
                ;;
        esac
        unset LIST[i]
        LIST=("${LIST[@]}")
    done
done




More information about the MPlayer-users mailing list