[prev in list] [next in list] [prev in thread] [next in thread]
List: ogg-dev
Subject: [ogg-dev] oggz-comment wrapper
From: "VolodyA! V Anarhist" <Volodya () WhenGendarmeSleeps ! org>
Date: 2010-06-10 9:16:41
Message-ID: 4C10AD79.2030801 () WhenGendarmeSleeps ! org
[Download RAW message or body]
Hello,
Due to the fact that oggz-comment demands that all the metadata is present on
the command line i've written a bash scrip wrapper that passes through all the
configuration, but reads the metadata one line at the time and puts it in the
correct place. Please use it however you want.
- Volodya
--
http://freedom.libsyn.com/ Echo of Freedom, Radical Podcast
"None of us are free until all of us are free." ~ Mihail Bakunin
["oggz-comments" (text/plain)]
#!/bin/bash
# Name: oggz-comments
# Version: 0,1a
# Author: VolodyA! V Anarhist
# Year: 2010
# Licence: GPL 3.0
# this is an oggz-comment wrapper
# the command line should be in the form
# oggz-comments [-o output.ogg | --output output.ogg] [-d | --delete] [-a | -all] [-s \
serialno | --serialno serialno] [-c content-type | --content-type content-type] \
[-m metadata.txt | --metadata-file metadata.txt] input.ogg # or
# oggz-comments -h|--help
#if help
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "oggz-commenta version 0,1a. written by VolodyA! V Anarhist"
echo "The command line should look like this:"
echo "oggz-comments [-o output.ogg | --output output.ogg] [-d | --delete] [-a | \
-all] [-s serialno | --serialno serialno] [-c content-type | --content-type \
content-type] [-m metadata.txt | --metadata-file metadata.txt] input.ogg" exit
fi
#go through all the command line a word at a time
OUTPUT=""
DELETE=""
STREAMS=""
METADATA=""
INPUT=""
STATE=""
for COMMAND in "$@"; do
if [ ${COMMAND:0:1} = "-" ]; then
if [ "$COMMAND" = "-o" ] || [ "$COMMAND" = "--output" ]; then
STATE="--output"
elif [ "$COMMAND" = "-d" ] || [ "$COMMAND" = "--delete" ]; then
DELETE="--delete"
STATE=""
elif [ "$COMMAND" = "-a" ] || [ "$COMMAND" = "--all" ]; then
STREAMS="$STREAMS --all"
elif [ "$COMMAND" = "-s" ] || [ "$COMMAND" = "--serialno" ]; then
STATE="--serialno"
elif [ "$COMMAND" = "-c" ] || [ "$COMMAND" = "--content-type" ]; then
STATE="--content-type"
elif [ "$COMMAND" = "-m" ] || [ "$COMMAND" = "--metadata-file" ]; then
STATE="--metadata-file"
else
echo "Wrong command command '$COMMAND'"
echo "Use oggz-comments --help for useage information."
exit 1
fi
elif [ -n "$STATE" ]; then # if the STATE is not zero-length
if [ "$STATE" = "--output" ]; then
OUTPUT="--output $1"
elif [ "$STATE" = "--serialno" ]; then
STREAMS="$STREAMS --serialno $1"
elif [ "$STATE" = "--content-type" ]; then
STREAMS="$STREAMS --content-type $1"
elif [ "$STATE" = "--metadata-file" ]; then
if [ ! -f "$1" ] || [ ! -r "$1" ]; then
echo "File '$1' doesn't exist or is not readable"
exit 2
fi
while read LINE
do
METADATA="$METADATA \"$LINE\""
done < "$1"
fi
STATE=""
else
if [ ! -f "$1" ] || [ ! -r "$1" ]; then
echo "File '$1' doesn't exist or is not readable"
exit 2
fi
INPUT="$1"
fi
shift
done
eval oggz-comment $OUTPUT $DELETE $STREAMS $INPUT $METADATA
_______________________________________________
ogg-dev mailing list
ogg-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/ogg-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic