Changeset b7e834c2032b31dd4d717c05737e992ab878f50d
- Timestamp:
- 09/12/05 14:13:20
(3 years ago)
- Author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr>
- git-committer:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1134134000 +0000
- git-parent:
[3d26787a02dd791304a412c3378a76668ca2fc04]
- git-author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1134134000 +0000
- Message:
python/vlcglue.c: exception-related code fixes
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3d26787 |
rb7e834c |
|
| 50 | 50 | PyPosition_Type.tp_alloc = PyType_GenericAlloc; |
|---|
| 51 | 51 | |
|---|
| | 52 | /* PyEval_InitThreads(); */ |
|---|
| | 53 | |
|---|
| | 54 | /* Have a look at |
|---|
| | 55 | http://base.bel-epa.com/pyapache/Python/MySQL-python/MySQL-python-0.3.0/_mysqlmodule.c */ |
|---|
| | 56 | |
|---|
| | 57 | m = Py_InitModule3( "vlc", vlc_methods, |
|---|
| | 58 | "VLC media player embedding module."); |
|---|
| | 59 | |
|---|
| | 60 | if (! m) |
|---|
| | 61 | return; |
|---|
| | 62 | |
|---|
| 52 | 63 | if (PyType_Ready(&PyPosition_Type) < 0) |
|---|
| 53 | 64 | return; |
|---|
| … | … | |
| 59 | 70 | #endif |
|---|
| 60 | 71 | |
|---|
| 61 | | /* PyEval_InitThreads(); */ |
|---|
| 62 | | |
|---|
| 63 | | /* Have a look at |
|---|
| 64 | | http://base.bel-epa.com/pyapache/Python/MySQL-python/MySQL-python-0.3.0/_mysqlmodule.c */ |
|---|
| 65 | | |
|---|
| 66 | | m = Py_InitModule3( "vlc", vlc_methods, |
|---|
| 67 | | "VLC media player embedding module."); |
|---|
| 68 | | |
|---|
| 69 | 72 | /* Exceptions */ |
|---|
| 70 | 73 | MediaControl_InternalException = |
|---|
| 71 | 74 | PyErr_NewException("vlc.InternalException", NULL, NULL); |
|---|
| | 75 | Py_INCREF(MediaControl_InternalException); |
|---|
| 72 | 76 | PyModule_AddObject(m, "InternalException", MediaControl_InternalException); |
|---|
| 73 | 77 | |
|---|
| 74 | 78 | MediaControl_PositionKeyNotSupported = |
|---|
| 75 | 79 | PyErr_NewException("vlc.PositionKeyNotSupported", NULL, NULL); |
|---|
| | 80 | Py_INCREF(MediaControl_PositionKeyNotSupported); |
|---|
| 76 | 81 | PyModule_AddObject(m, "PositionKeyNotSupported", |
|---|
| 77 | 82 | MediaControl_PositionKeyNotSupported); |
|---|
| … | … | |
| 79 | 84 | MediaControl_PositionOriginNotSupported= |
|---|
| 80 | 85 | PyErr_NewException("vlc.InvalidPosition", NULL, NULL); |
|---|
| | 86 | Py_INCREF(MediaControl_PositionOriginNotSupported); |
|---|
| 81 | 87 | PyModule_AddObject(m, "PositionOriginNotSupported", |
|---|
| 82 | 88 | MediaControl_PositionOriginNotSupported); |
|---|
| … | … | |
| 84 | 90 | MediaControl_InvalidPosition = |
|---|
| 85 | 91 | PyErr_NewException("vlc.InvalidPosition", NULL, NULL); |
|---|
| | 92 | Py_INCREF(MediaControl_InvalidPosition); |
|---|
| 86 | 93 | PyModule_AddObject(m, "InvalidPosition", MediaControl_InvalidPosition); |
|---|
| 87 | 94 | |
|---|
| 88 | 95 | MediaControl_PlaylistException = |
|---|
| 89 | 96 | PyErr_NewException("vlc.PlaylistException", NULL, NULL); |
|---|
| | 97 | Py_INCREF(MediaControl_PlaylistException); |
|---|
| 90 | 98 | PyModule_AddObject(m, "PlaylistException", MediaControl_PlaylistException); |
|---|
| 91 | 99 | |
|---|
| … | … | |
| 93 | 101 | Py_INCREF(&PyPosition_Type); |
|---|
| 94 | 102 | PyModule_AddObject(m, "Position", (PyObject *)&PyPosition_Type); |
|---|
| | 103 | |
|---|
| 95 | 104 | Py_INCREF(&MediaControl_Type); |
|---|
| 96 | 105 | PyModule_AddObject(m, "MediaControl", (PyObject *)&MediaControl_Type); |
|---|
| | 106 | |
|---|
| 97 | 107 | #ifdef VLCOBJECT_SUPPORT |
|---|
| 98 | 108 | Py_INCREF(&vlcObject_Type); |
|---|
| … | … | |
| 285 | 295 | |
|---|
| 286 | 296 | if ( !PyArg_ParseTuple(args, "i", &i_id) ) |
|---|
| 287 | | { |
|---|
| 288 | | PyErr_SetString(PyExc_StandardError, "Error: no id was given.\n"); |
|---|
| 289 | | return Py_None; |
|---|
| 290 | | } |
|---|
| | 297 | return NULL; |
|---|
| 291 | 298 | |
|---|
| 292 | 299 | p_object = (vlc_object_t*)vlc_current_object(i_id); |
|---|
| … | … | |
| 315 | 322 | |
|---|
| 316 | 323 | if ( !PyArg_ParseTuple(args, "s", &psz_name) ) |
|---|
| 317 | | { |
|---|
| 318 | | PyErr_SetString(PyExc_StandardError, "Error: no variable name was given.\n"); |
|---|
| 319 | | Py_INCREF(Py_None); |
|---|
| 320 | | return Py_None; |
|---|
| 321 | | } |
|---|
| | 324 | return NULL; |
|---|
| 322 | 325 | |
|---|
| 323 | 326 | if( var_Get( VLCSELF->p_object, psz_name, &value ) != VLC_SUCCESS ) |
|---|
| 324 | 327 | { |
|---|
| 325 | 328 | PyErr_SetString(PyExc_StandardError, "Error: no variable name was given.\n"); |
|---|
| 326 | | Py_INCREF(Py_None); |
|---|
| 327 | | return Py_None; |
|---|
| | 329 | return NULL; |
|---|
| 328 | 330 | } |
|---|
| 329 | 331 | |
|---|
| … | … | |
| 385 | 387 | |
|---|
| 386 | 388 | if ( !PyArg_ParseTuple(args, "s", &psz_name)) |
|---|
| 387 | | { |
|---|
| 388 | | PyErr_SetString(PyExc_StandardError, "Error: no variable name was given.\n"); |
|---|
| 389 | | Py_INCREF(Py_None); |
|---|
| 390 | | return Py_None; |
|---|
| 391 | | } |
|---|
| | 389 | return NULL; |
|---|
| 392 | 390 | |
|---|
| 393 | 391 | i_type = var_Type(VLCSELF->p_object, psz_name); |
|---|
| … | … | |
| 455 | 453 | |
|---|
| 456 | 454 | if ( !PyArg_ParseTuple(args, "sO", &psz_name, &py_value) ) |
|---|
| 457 | | { |
|---|
| 458 | | PyErr_SetString(PyExc_StandardError, "Error: no variable name was given.\n"); |
|---|
| 459 | | Py_INCREF(Py_None); |
|---|
| 460 | | return Py_None; |
|---|
| 461 | | } |
|---|
| | 455 | return NULL; |
|---|
| 462 | 456 | |
|---|
| 463 | 457 | p_obj = VLCSELF->p_object; |
|---|
| … | … | |
| 538 | 532 | |
|---|
| 539 | 533 | if ( !PyArg_ParseTuple(args, "s", &psz_name) ) |
|---|
| 540 | | { |
|---|
| 541 | | PyErr_SetString(PyExc_StandardError, "Error: no config variable name was given.\n"); |
|---|
| 542 | | Py_INCREF(Py_None); |
|---|
| 543 | | return Py_None; |
|---|
| 544 | | } |
|---|
| | 534 | return NULL; |
|---|
| 545 | 535 | |
|---|
| 546 | 536 | p_config = config_FindConfig( VLCSELF->p_object, psz_name ); |
|---|
| … | … | |
| 601 | 591 | |
|---|
| 602 | 592 | if ( !PyArg_ParseTuple(args, "sO", &psz_name, &py_value) ) |
|---|
| 603 | | { |
|---|
| 604 | | PyErr_SetString(PyExc_StandardError, |
|---|
| 605 | | "Error: no variable name was given.\n"); |
|---|
| 606 | | Py_INCREF(Py_None); |
|---|
| 607 | | return Py_None; |
|---|
| 608 | | } |
|---|
| | 593 | return NULL; |
|---|
| 609 | 594 | |
|---|
| 610 | 595 | p_obj = VLCSELF->p_object; |
|---|
| … | … | |
| 781 | 766 | { |
|---|
| 782 | 767 | /* No arguments were given. Clear the exception raised |
|---|
| 783 | | * by PyArg_ParseTuple. */ |
|---|
| | 768 | by PyArg_ParseTuple. */ |
|---|
| 784 | 769 | PyErr_Clear(); |
|---|
| 785 | 770 | } |
|---|