---
plugins/python/nbdkit-python-plugin.pod | 6 ++++++
plugins/python/python.c | 21 +++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/plugins/python/nbdkit-python-plugin.pod
b/plugins/python/nbdkit-python-plugin.pod
index 4065ec75..454a17ca 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -152,6 +152,12 @@ There are no arguments or return value.
There are no arguments or return value.
+=item C<get_ready>
+
+(Optional)
+
+There are no arguments or return value.
+
=item C<open>
(Required)
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 5e2e5269..72f37dd7 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -436,6 +436,25 @@ py_config_complete (void)
return 0;
}
+static int
+py_get_ready (void)
+{
+ PyObject *fn;
+ PyObject *r;
+
+ if (callback_defined ("get_ready", &fn)) {
+ PyErr_Clear ();
+
+ r = PyObject_CallObject (fn, NULL);
+ Py_DECREF (fn);
+ if (check_python_failure ("get_ready") == -1)
+ return -1;
+ Py_DECREF (r);
+ }
+
+ return 0;
+}
+
static void *
py_open (int readonly)
{
@@ -889,6 +908,8 @@ static struct nbdkit_plugin plugin = {
.config_complete = py_config_complete,
.config_help = py_config_help,
+ .get_ready = py_get_ready,
+
.open = py_open,
.close = py_close,
--
2.25.0