#!/usr/bin/env bash
# Decentralized Media
#
# Douglas Thrift
#
# $Id$
declare -a EXTENSIONS LOCALS
for ARG in "$@"; do
case $ARG in
-extension=*)
EXTENSIONS[${#EXTENSIONS[*]}]=`echo "$ARG" | sed -e "s/^-extension=\(.*\)$/\1/"`
;;
-local=*)
LOCALS[${#LOCALS[*]}]=`echo "$ARG" | sed -e "s/^-local=\(.*\)$/\1/"`
;;
esac;
done
MENES=`dirname $0`/../menes
source $MENES/config/menes.sh
MENES=`$CFG_GNU_READLINK -f $MENES`
INFO=`$CFG_GNU_READLINK -f $(dirname $0)/info`
IFS="
"
function media()
{
echo "
$1"
pushd $1 > /dev/null
for FOLDER in `find . -depth 1 -type d | sed -e "s|^\./||"`; do
media "$FOLDER";
done
for ((EXTENSION = 0; EXTENSION != ${#EXTENSIONS[*]}; ++EXTENSION)); do
for FILE in `find . -depth 1 -iname "*.${EXTENSIONS[$EXTENSION]}" | sed -e "s|^\./||"`; do
$INFO "$FILE" | $MENES/menes/waf/simplify.sh
done;
done
popd > /dev/null
echo ""
}
echo "
"
for ((LOCAL = 0; LOCAL != ${#LOCALS[*]}; ++LOCAL)); do
media "${LOCALS[$LOCAL]}";
done
echo ""