gstreamer/examples/option-parser.py
Johan Dahlin 5b5311a64f Add a new module, gstoption which allows you to fetch the
Original commit message from CVS:
2007-11-05  Johan Dahlin  <johan@gnome.org>

* gstoptionmodule.c:
* Makefile.am:
* configure.ac:
Add a new module, gstoption which allows you to fetch the
GOptionGroup from gstreamer without initializing and parsing
the command line arguments. Requires PyGObject 2.15.0
Fixes #425847

* examples/option-parser.py (main): Example
2007-11-08 10:51:07 +00:00

43 lines
1,022 B
Python

#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
import sys
import pygtk
pygtk.require('2.0')
from gobject.option import OptionParser, OptionGroup
import pygst
pygst.require('0.10')
import gstoption
def main(args):
parser = OptionParser()
group = OptionGroup('flumotion', 'Flumotion options',
option_list=[])
group.add_option('-v', '--verbose',
action="store_true", dest="verbose",
help="be verbose")
group.add_option('', '--version',
action="store_true", dest="version",
default=False,
help="show version information")
parser.add_option_group(group)
parser.add_option_group(gstoption.get_group())
options, args = parser.parse_args(args)
if options.verbose:
print 'Verbose mode'
import gst
if options.version:
print sys.version, gst.version
if __name__ == '__main__':
sys.exit(main(sys.argv))