[ogg-dev] wrappers

Silvia Pfeiffer silvia at silvia-pfeiffer.de
Sat Jun 12 23:15:38 PDT 2010


Sounds good! Though maybe calling it oggz-metadata might make more sense?

Cheers,
Silvia.

On Sun, Jun 13, 2010 at 1:42 PM, VolodyA! V Anarhist
<Volodya at whengendarmesleeps.org> wrote:
> Hi,
>
> I've sent one of these before, but i wasn't subscribed, and i'm unsure if it
> went out. I'm subscribed now and i've written another (i believe) nifty
> wrapper for oggz-tools.
>
> oggz-comments - allows a user to pass the plain text file with each tag on
> their own line
> theoracomment - works like 'vorbiscomment' from VorbisTools package, but
> sets comments for the theora streams inside an Ogg container. The only two
> things that you can't do with theoracomment that you can with vorbis comment
> are: 1. run a command and then enter the tags from console 2. use error
> codes in the same way
>
> If anybody has any suggestions on changes or additions to these scripts, let
> me know. They are GPL3-ed, so you can use them and pass them along if you
> like.
>
>           - Volodya
>
> --
> http://freedom.libsyn.com/     Echo of Freedom, Radical Podcast
>
>  "None of us are free until all of us are free."    ~ Mihail Bakunin
>
> #!/bin/bash
>
> # Name: oggz-comments
> # Version: 0,1a
> # Author: Volodya
> # 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
>
> #!/bin/bash
>
> # Name: theoracomment
> # Version: 0,1a
> # Author: Volodya
> # Year: 2010
> # Licence: GPL 3.0
>
> # this is an theoracomment, wrapper around oggz-comment that changes theora
> comments inside a file
> # it is intended to have the same parameters as vorbiscomment
>
> # the command line should be in the form
> # theoracomment [-a | -w] [-c metadata.txt | -t "name=value"] [-q] input.ogv
> output.ogv
> # or
> # theoracomment [-l] input.ogv
> # theoracomment -h|--help
>
> #if help
> if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
>        echo "theoracomment version 0,1a. written by VolodyA! V Anarhist"
>        echo "The command line should look like this:"
>        echo "theoracomment [-a | -w] [-c metadata.txt | -t "name=value"]
> [-q] input.ogv output.ogv"
>        exit
> fi
>
>
> #go through all the command line a word at a time
> OUTPUT=""
> DELETE="--delete"
> STREAMS="--content-type theora"
> METADATA=""
> INPUT=""
>
> STATE=""
> for COMMAND in "$@"; do
>        if [ ${COMMAND:0:1} = "-" ]; then
>                if [ "$COMMAND" = "-a" ] || [ "$COMMAND" = "--append" ] || [
> "$COMMAND" = "--add" ]; then
>                        DELETE=""
>                        STATE=""
>                elif [ "$COMMAND" = "-w" ] || [ "$COMMAND" = "--write" ] || [
> "$COMMAND" = "--wipe" ]; then
>                        DELETE="--delete"
>                        STATE=""
>                elif [ "$COMMAND" = "-l" ] || [ "$COMMAND" = "--list" ]; then
>                        STATE="--list"
>                elif [ "$COMMAND" = "-c" ] || [ "$COMMAND" = "--comment-file"
> ] || [ "$COMMAND" = "--commentfile" ]; then
>                        STATE="--comment-file"
>                elif [ "$COMMAND" = "-t" ] || [ "$COMMAND" = "--tag" ]; then
>                        STATE="--tag"
>                elif [ "$COMMAND" = "-R" ] || [ "$COMMAND" = "--raw" ]; then
>                        #ignore, is meant to read/write in UTF-8
>                        STATE=""
>                elif [ "$COMMAND" = "-q" ] || [ "$COMMAND" = "--quiet" ];
> then
>                        #ignore, is meant to read/write in UTF-8
>                        STATE=""
>                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" = "--list" ]; then
>                        if [ ! -f "$1" ] || [ ! -r "$1" ]; then
>                                echo "File '$1' doesn't exist or is not
> readable"
>                                exit 2
>                        fi
>                        # h - hold the old line, G - append the old line to
> new
>                        # it's used to capitalise only before ': ', the
> substitution is needed
>                        # but we combine the substitution to change ': ' to
> '='
>                        eval oggz-comment --content-type theora -l "$1" | sed
> ' {
>                                /^[^\t]/d
>                                s/^\t//g
>                                /^Vendor/d
>                                h
>
>  y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
>                                G
>                                s/: .*: /=/
>                        }'
>                        exit 0 #everything is done
>                elif [ "$STATE" = "--tag" ]; then
>                        METADATA="$1"
>                elif [ "$STATE" = "--comment-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 [ -n "$INPUT" ]; then
>                        OUTPUT="--output $1"
>                else
>                        if [ ! -f "$1" ] || [ ! -r "$1" ]; then
>                                echo "File '$1' doesn't exist or is not
> readable"
>                                exit 2
>                        fi
>                        INPUT="$1"
>                fi
>        fi
>        shift
> done
>
> if [ -n "$METADATA" ]; then # need to read metadata from console
>        while read LINE
>        do
>                METADATA="$METADATA \"$LINE\""
>        done
> fi
>
> if [ -n "$OUTPUT" ]; then
>        eval oggz-comment $OUTPUT $DELETE $STREAMS $INPUT $METADATA
> else
>        for i in {1..100}
>        do
>                if [ ! -f "$INPUT~$i~" ] && [ ! -r "$INPUT~$i~" ]; then
>                        eval mv "$INPUT" "$INPUT~$i~"
>                        OUTPUT="--output $INPUT"
>                        INPUT="$INPUT~$i~"
>                        break
>                fi
>        done
>        if [ -n "$OUTPUT" ]; then
>                eval oggz-comment $OUTPUT $DELETE $STREAMS $INPUT $METADATA
>                eval rm $INPUT
>        else
>                echo Unable to create a temporary file name
>        fi
> fi
>
> _______________________________________________
> ogg-dev mailing list
> ogg-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/ogg-dev
>
>


More information about the ogg-dev mailing list