|
a/src/python/recoll/pyrclextract.cpp |
|
b/src/python/recoll/pyrclextract.cpp |
|
... |
|
... |
41 |
/// Extractor object code
|
41 |
/// Extractor object code
|
42 |
typedef struct {
|
42 |
typedef struct {
|
43 |
PyObject_HEAD
|
43 |
PyObject_HEAD
|
44 |
/* Type-specific fields go here. */
|
44 |
/* Type-specific fields go here. */
|
45 |
FileInterner *xtr;
|
45 |
FileInterner *xtr;
|
46 |
TempDir *tmpdir;
|
|
|
47 |
RclConfig *rclconfig;
|
46 |
RclConfig *rclconfig;
|
48 |
} rclx_ExtractorObject;
|
47 |
} rclx_ExtractorObject;
|
49 |
|
48 |
|
50 |
static void
|
49 |
static void
|
51 |
Extractor_dealloc(rclx_ExtractorObject *self)
|
50 |
Extractor_dealloc(rclx_ExtractorObject *self)
|
52 |
{
|
51 |
{
|
53 |
LOGDEB(("Extractor_dealloc\n"));
|
52 |
LOGDEB(("Extractor_dealloc\n"));
|
54 |
delete self->xtr;
|
53 |
delete self->xtr;
|
55 |
delete self->tmpdir;
|
|
|
56 |
self->ob_type->tp_free((PyObject*)self);
|
54 |
self->ob_type->tp_free((PyObject*)self);
|
57 |
}
|
55 |
}
|
58 |
|
56 |
|
59 |
static PyObject *
|
57 |
static PyObject *
|
60 |
Extractor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
58 |
Extractor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|
... |
|
... |
63 |
rclx_ExtractorObject *self =
|
61 |
rclx_ExtractorObject *self =
|
64 |
(rclx_ExtractorObject *)type->tp_alloc(type, 0);
|
62 |
(rclx_ExtractorObject *)type->tp_alloc(type, 0);
|
65 |
if (self == 0)
|
63 |
if (self == 0)
|
66 |
return 0;
|
64 |
return 0;
|
67 |
self->xtr = 0;
|
65 |
self->xtr = 0;
|
68 |
self->tmpdir = 0;
|
|
|
69 |
self->rclconfig = 0;
|
66 |
self->rclconfig = 0;
|
70 |
return (PyObject *)self;
|
67 |
return (PyObject *)self;
|
71 |
}
|
68 |
}
|
72 |
|
69 |
|
73 |
static int
|
70 |
static int
|
|
... |
|
... |
79 |
|
76 |
|
80 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!", (char**)kwlist,
|
77 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!", (char**)kwlist,
|
81 |
recoll_DocType, &pdobj))
|
78 |
recoll_DocType, &pdobj))
|
82 |
return -1;
|
79 |
return -1;
|
83 |
recoll_DocObject *dobj = (recoll_DocObject *)pdobj;
|
80 |
recoll_DocObject *dobj = (recoll_DocObject *)pdobj;
|
84 |
self->tmpdir = new TempDir;
|
|
|
85 |
if (dobj->doc == 0) {
|
81 |
if (dobj->doc == 0) {
|
86 |
PyErr_SetString(PyExc_AttributeError, "Null Doc ?");
|
82 |
PyErr_SetString(PyExc_AttributeError, "Null Doc ?");
|
87 |
return -1;
|
83 |
return -1;
|
88 |
}
|
84 |
}
|
89 |
self->rclconfig = dobj->rclconfig;
|
85 |
self->rclconfig = dobj->rclconfig;
|
90 |
self->xtr = new FileInterner(*dobj->doc, self->rclconfig, *self->tmpdir,
|
86 |
self->xtr = new FileInterner(*dobj->doc, self->rclconfig,
|
91 |
FileInterner::FIF_forPreview);
|
87 |
FileInterner::FIF_forPreview);
|
92 |
return 0;
|
88 |
return 0;
|
93 |
}
|
89 |
}
|
94 |
|
90 |
|
95 |
PyDoc_STRVAR(doc_Extractor_textextract,
|
91 |
PyDoc_STRVAR(doc_Extractor_textextract,
|