From 2b5629b6f4920f02b2bbb62683f7ad2d7d386c9e Mon Sep 17 00:00:00 2001 From: Olivier Aubert Date: Mon, 2 Apr 2007 17:55:13 +0000 Subject: [PATCH] bindings/python/vlc_internal: implement vlc_object_find_name support --- bindings/python/vlc_internal.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bindings/python/vlc_internal.c b/bindings/python/vlc_internal.c index f19d6e3c81..53c8d34358 100644 --- a/bindings/python/vlc_internal.c +++ b/bindings/python/vlc_internal.c @@ -253,6 +253,32 @@ vlcObject_find_object( PyObject *self, PyObject *args ) return ( PyObject * )p_retval; } +static PyObject * +vlcObject_find_name( PyObject *self, PyObject *args ) +{ + vlcObject *p_retval; + vlc_object_t *p_obj; + char *psz_name; + int i_object_type; + + if( !PyArg_ParseTuple( args, "s", &psz_name ) ) + return NULL; + + p_obj = vlc_object_find_name( VLCSELF->p_object, psz_name, FIND_ANYWHERE ); + + if( !p_obj ) + { + Py_INCREF( Py_None ); + return Py_None; + } + + p_retval = PyObject_New( vlcObject, &vlcObject_Type ); + + p_retval->p_object = p_obj; + + return ( PyObject * )p_retval; +} + static PyObject * vlcObject_info( PyObject *self, PyObject *args ) { @@ -657,6 +683,8 @@ static PyMethodDef vlcObject_methods[] = "find_object( str ) -> Object Find the object of a given type.\n\nAvailable types are : aout, decoder, input, httpd, intf, playlist, root, vlc, vout"}, { "find_id", vlcObject_find_id, METH_VARARGS, "find_id( int ) -> Object Find an object by id" }, + { "find_name", vlcObject_find_name, METH_VARARGS, + "find_name( str ) -> Object Find an object by name" }, { "info", vlcObject_info, METH_NOARGS, "info( ) -> dict Return information about the object" }, { "release", vlcObject_release, METH_NOARGS, -- 2.39.2