Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

ogg vorbis completion function



Hi,

I've improved the code for _vorbis I've sent yesterday, using _ogg123
from Nikolai Weibull.

-- 
baptiste daroussin <daroussi@xxxxxx>
#compdef oggenc ogg123 ogginfo oggdec 

_advanced_option() {
    _values "options name" \
        'bitrate_average_window[set  the  managed bitrate window to NN seconds.]:number:'\
        'lowpass_frequency[set the lowpass frequency to NN kHz.]:number:'
}
_vorbis (){
    local expl
    case $service in
    oggenc)
        _arguments -C -s \
    {'(--help)-h','(-h)--help'}'[show help]'\
    {'(--raw)-r','(-r)--raw'}'[assume input data is raw little-endian audio data with no header information.]'\
    {'(--raw-bits=)-B','(-B)--raw-bits='}'[sets raw mode input sample size in bits.]:sample size:(8 16)'\
    {'(--raw-chan=)-C','(-C)--raw-chan='}'[sets raw mode input number of channels.]:number of channels:'\
    {'(--raw-rate=)-R','(-R)--raw-rate='}'[sets raw mode input samplerate.]:samplerate:(44100 48000)'\
    '--raw-endianness[sets raw mode endianness]:endianness:(( 0\:big\ endian 1\:little\ endian ))'\
    {'(--quiet)-Q','(-Q)--quiet'}'[quiet mode.]'\
    {'(--bitrate=)-b','(-b)--bitrate='}'[sets encoding to the bitrate closest to n (in kb/s).]:bitrate in kb/s:'\
    {'(--min-bitrate=)-m','(-m)--min-bitrate='}'[sets minimum bitrate to n (in kb/s).]:bitrate in kb/s:'\
    {'(--max-bitrate=)-M','(-M)--max-bitrate='}'[sets maximum bitrate to n (in kb/s).]:bitrate in kb/s:'\
    '--managed[turn  off  the  normal  VBR encoding]'\
    {'(--quality=)-q','(-q)--quality='}'[sets encoding quality.]:quality:(0 1 2 3 4 5 6 7 8 9 10)'\
    '--resample[resample input to the given sample rate (in Hz) before encoding.]:sample rate:'\
    '--downmix[downmix input from stereo to mono.]'\
    '--advanced-encode-option[sets  an  advanced  option.]:option name:_advanced_option'\
    {'(--serial)-s','(-s)--serial'}'[forces a specific serial number in the output  stream.]'\
    {'(--output-file=)-o','(-o)--output-file='}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles'\
    {'(--pattern=)-n','(-n)--pattern='}'[produce filenames as this string]:string:'\
    {'*-c','*--comment'}'[add the string comment as an extra comment.]:comment:'\
    {'*-a','*--artist'}'[set the artist comment field in the comments to artist.]:artist:'\
    {'*-G','*--genre'}'[set the genre comment field in the comments to genre.]:genre:'\
    {'*-d','*--date'}'[sets the date comment field to the given value.]:date:'\
    {'*-N','*--tracknum'}'[sets the track number comment field to the given value.]:track number:'\
    {'*-t','*--title'}'[set the track title comment field to title.]:title:'\
    {'*-l','*--album'}'[set the album comment field to album.]'\
    '*:files:->wavfiles' && return 0
        ;;
    ogg123)
        _arguments -C -s \
        {'(-h)--help','(--help)-h'}'[show help]'\
        {'(--version)-V','(-V)--version'}'[display version information.]'\
        {'(-d)--device','(--device)-d'}'[output device.]:device:((null\:"discards all data" oss\:"Open Sound System" sun\:"Sun Audio" alsa\:"Advanced Linux Sound Architecture" irix\:"IRIX audio" arts\:"aRts Sound Daemon" esd\:"Enlightened Sound Daemon" au\:"Sun audio file" raw\:"Raw sample" wav\:"WAV file"))' \
        {'(--files=)-f','(-f)--files='}'[output filename for a previously specified file device.]:output filename:_files'\
        {'(--skip)-k','(-k)--skip'}'[skip the first '\''n'\'' seconds.]:seconds:'\
        {'(--buffer)-b','(-b)--buffer'}'[size of input buffer.]:kilobytes:'\
        {'(--prebuffer)-p','(-p)--prebuffer'}'[prebuffer percentage.]:percent:'\
        {'(--quiet -q)*-v','(--quiet -q)*--verbose'}'[increase verbosity.]'\
        {'(--verbose -v --quiet)-q','(-q --verbose -v)--quiet'}'[quiet mode.]'\
        {'(--nth)-x','(-x)--nth'}'[block decode intervall.]:number:'\
        {'(--ntimes)-y','(-y)--ntimes'}'[block repeat count.]:number:'\
        {'(--shuffle)-z','(-z)--shuffle'}'[shuffle play.]'\
        {'(--delay=)-l','(-l)--delay='}'[set delay in millisecond.]:milliseconds:'\
        {'(--playlist)-@','(-@)--playlist'}'[Play all of  the  files from a playlist.]:playlist:_files'\
        '--audio-buffer[size of output audio buffer.]:kilobytes:'\
        {'*-o','*--device-option='}'[assign device option values]:devopts:->devopts'\
        '*:files:->oggfiles' && return 0
        ;;
    ogginfo)
        _arguments -C -s \
        '-h[show a help and usage message]'\
        '*-q[quiet  mode.]'\
        '-v[verbose mode.]'\
        '*:files:->oggfiles' && return 0
        ;;
    oggdec)
        _arguments -C -s \
        {'(--quiet)-q','(-q)--quiet'}'[quiet mode.]'\
        {'(--help)-h','(-h)--help'}'[print help message.]'\
        {'(--version)-v','(-v)--version'}'[display version information.]'\
        {'(--bits=)-b','(-b)--bits='}'[bits per sample.]:bits per sample:(8 16)'\
        {'(--endian=)-e','(-e)--endian'}'[set endianness for 16-bit output.]:endianness:(( 0\:\(default\)\ is\ little-endian\ \(Intel\ byte\ order\). 1\:is\ big-endian\ \(sane\ byte\ order\). ))'\
        {'(--raw=)-R','(-R)--raw='}'[output  in  raw format.]'\
        {'(--output=)-o','(-o)--output='}'[write output to specified filename.]:output filename:_files'\
	    {'(--sign=)-s','(-s)--sign='}'[set signedness for output.]:signedness:(( 0\:unsigned 1\:signed\ \(default\) ))'\
        '*:files:->oggfiles' && return 0
        ;;
    esac

    case $state in
    oggfiles)
    _description files expl 'ogg vorbis files'
    _files "$expl[@]" -g '*.ogg'
    ;;
    wavfiles)
    _description files expl 'wav files'
    _files "$expl[@]" -g '*.wav'
    ;;
    devopts)
    _setup devopts
    _tags devopts
    _description devopts expl 'device options'
    compadd "$expl[@]" -S : - dsp dev card buf_size host byteorder
    ;;
    esac
}

_vorbis "$@"


Messages sorted by: Reverse Date, Date, Thread, Author