- return Py_BuildValue( "i", libvlc_get_vlc_id( LIBVLC_INSTANCE->p_instance ) );
-}
-
-/* Set loop variable */
-static PyObject *
-vlcInstance_playlist_loop( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_loop = 0;
-
- if( !PyArg_ParseTuple( args, "i", &i_loop ) )
- return NULL;
-
- LIBVLC_TRY;
- libvlc_playlist_loop( LIBVLC_INSTANCE->p_instance, i_loop, &ex );
- LIBVLC_EXCEPT;
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/* Playlist play. 2 parameters: i_id, the id to play
- l_options: a list of options */
-static PyObject *
-vlcInstance_playlist_play( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_id = -1;
- PyObject *py_options = NULL;
- int i_size = 0;
- char** ppsz_args = NULL;
-
- if( !PyArg_ParseTuple( args, "|iO", &i_id, &py_options ) )
- return NULL;
-
- if( py_options )
- {
- i_size = pyoptions_to_args( py_options, &ppsz_args );
- }
-
- LIBVLC_TRY;
- libvlc_playlist_play( LIBVLC_INSTANCE->p_instance, i_id, i_size, ppsz_args, &ex );
- free_args( i_size, ppsz_args );
- LIBVLC_EXCEPT;
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_playlist_pause( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- LIBVLC_TRY;
- libvlc_playlist_pause( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_playlist_isplaying( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_ret;
-
- LIBVLC_TRY;
- i_ret = libvlc_playlist_isplaying( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- return Py_BuildValue( "i", i_ret );
-}
-
-static PyObject *
-vlcInstance_playlist_items_count( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_ret;
-
- LIBVLC_TRY;
- i_ret = libvlc_playlist_items_count( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- return Py_BuildValue( "i", i_ret );
-}
-
-static PyObject *
-vlcInstance_playlist_stop( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- LIBVLC_TRY;
- libvlc_playlist_stop( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_playlist_next( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- LIBVLC_TRY;
- libvlc_playlist_next( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_playlist_prev( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- LIBVLC_TRY;
- libvlc_playlist_prev( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_playlist_clear( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- LIBVLC_TRY;
- libvlc_playlist_clear( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/* Add a playlist item. Main parameter: URI.
- Optional parameters: name, options */
-static PyObject *
-vlcInstance_playlist_add( PyObject *self, PyObject *args)
-{
- libvlc_exception_t ex;
- int i_ret;
- char* psz_uri = NULL;
- char* psz_name = NULL;
- PyObject *py_options = NULL;
- int i_size = 0;
- char** ppsz_args = NULL;
-
- if( !PyArg_ParseTuple( args, "s|sO", &psz_uri, &psz_name, &py_options ) )
- return NULL;
-
- if( !psz_name )
- {
- /* Set a default name */
- psz_name = strdup( psz_uri );
- }
-
- if( py_options )
- {
- i_size = pyoptions_to_args( py_options, &ppsz_args );
- }
-
- LIBVLC_TRY;
- if( ppsz_args )
- {
- i_ret = libvlc_playlist_add_extended( LIBVLC_INSTANCE->p_instance,
- psz_uri,
- psz_name,
- i_size,
- ppsz_args,
- &ex );
- free_args( i_size, ppsz_args );
- }
- else
- {
- i_ret = libvlc_playlist_add( LIBVLC_INSTANCE->p_instance,
- psz_uri,
- psz_name,
- &ex );
- }
- LIBVLC_EXCEPT;
-
- return Py_BuildValue( "i", i_ret );
-}
-
-static PyObject *
-vlcInstance_playlist_delete_item( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_id;
- int i_ret;
-
- if( !PyArg_ParseTuple( args, "i", &i_id ) )
- return NULL;
-
- LIBVLC_TRY;
- i_ret = libvlc_playlist_delete_item( LIBVLC_INSTANCE->p_instance, i_id, &ex );
- LIBVLC_EXCEPT;
-
- return Py_BuildValue( "i", i_ret );