summaryrefslogtreecommitdiff
path: root/lib/python.h
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-03-05 16:39:28 +0100
committerhorchi <vdr@jwendel.de>2017-03-05 16:39:28 +0100
commite2a48d8701f91b8e24fbe9e99e91eb72a87bb749 (patch)
tree726f70554b4ca985a09ef6e30a7fdc8df089993c /lib/python.h
downloadvdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.gz
vdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.bz2
git init1.1.103
Diffstat (limited to 'lib/python.h')
-rw-r--r--lib/python.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/python.h b/lib/python.h
new file mode 100644
index 0000000..eb50964
--- /dev/null
+++ b/lib/python.h
@@ -0,0 +1,78 @@
+/*
+ * python.h
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ */
+
+#ifndef __PYTHON_H
+#define __PYTHON_H
+
+#include <Python.h>
+
+#include "db.h"
+
+//***************************************************************************
+// Class Python
+//***************************************************************************
+
+class Python
+{
+ public:
+
+ Python(const char* aFile, const char* aFunction);
+ ~Python();
+
+ int init(const char* modulePath = 0);
+ int exit();
+
+ int execute(cDbTable* eventsDb, int namingmode, const char* tmplExpression);
+
+ const char* getResult() { return result ? result : ""; }
+
+ protected:
+
+ static PyObject* eventTitle(PyObject* self, PyObject* args);
+ static PyObject* eventShortText(PyObject* self, PyObject* args);
+ static PyObject* eventStartTime(PyObject* self, PyObject* args);
+ static PyObject* eventYear(PyObject* self, PyObject* args);
+ static PyObject* eventCategory(PyObject* self, PyObject* args);
+
+ static PyObject* episodeName(PyObject* self, PyObject* args);
+ static PyObject* episodeShortName(PyObject* self, PyObject* args);
+ static PyObject* episodePartName(PyObject* self, PyObject* args);
+ static PyObject* extracol1(PyObject* self, PyObject* args);
+ static PyObject* extracol2(PyObject* self, PyObject* args);
+ static PyObject* extracol3(PyObject* self, PyObject* args);
+ static PyObject* episodeSeason(PyObject* self, PyObject* args);
+ static PyObject* episodePart(PyObject* self, PyObject* args);
+ static PyObject* episodeNumber(PyObject* self, PyObject* args);
+ static PyObject* namingMode(PyObject* self, PyObject* args);
+ static PyObject* tmplExpression(PyObject* self, PyObject* args);
+
+ void showError();
+
+ // data
+
+ PyObject* pModule;
+ PyObject* pFunc;
+
+ char* file;
+ char* function;
+ char* result;
+
+ // static stuff
+
+ static cDbTable* globalEventsDb;
+ static int globalNamingMode;
+ static const char* globalTmplExpression;
+ static PyMethodDef eventMethods[];
+
+#if PY_MAJOR_VERSION >= 3
+ static PyObject* PyInitEvent() { return PyModule_Create(&Python::moduledef); }
+ static PyModuleDef moduledef;
+#endif
+};
+
+//***************************************************************************
+#endif // __PYTHON_H