return false;
}
-static void PutToDict(ePyObject &dict, const char*key, long value)
+static void PutToDictAsStr(ePyObject &dict, const char*key, long value)
{
ePyObject item = PyString_FromFormat("%d", value);
if (item)
eDebug("could not create PyObject for %s", key);
}
-extern void PutToDict(ePyObject &dict, const char*key, const char *value);
+extern void PutToDict(ePyObject &dict, const char*key, long value); // defined in dvb/frontend.cpp
+extern void PutToDict(ePyObject &dict, const char*key, ePyObject item); // defined in dvb/frontend.cpp
+extern void PutToDict(ePyObject &dict, const char*key, const char *value); // defined in dvb/frontend.cpp
void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &feparm)
{
const char *tmp=0;
PutToDict(dict, "type", "Satellite");
- PutToDict(dict, "frequency", feparm.frequency);
- PutToDict(dict, "symbolrate", feparm.symbol_rate);
- PutToDict(dict, "orbital position", feparm.orbital_position);
+ PutToDictAsStr(dict, "frequency", feparm.frequency);
+ PutToDictAsStr(dict, "symbolrate", feparm.symbol_rate);
+ PutToDictAsStr(dict, "orbital position", feparm.orbital_position);
switch (feparm.inversion)
{
case eDVBFrontendParametersSatellite::Inversion::On: tmp="ON"; break;
void PutTerrestrialDataToDict(ePyObject &dict, eDVBFrontendParametersTerrestrial &feparm)
{
PutToDict(dict, "type", "Terrestrial");
- PutToDict(dict, "frequency", feparm.frequency);
+ PutToDictAsStr(dict, "frequency", feparm.frequency);
const char *tmp=0;
switch (feparm.bandwidth)
{
{
const char *tmp=0;
PutToDict(dict, "type", "Cable");
- PutToDict(dict, "frequency", feparm.frequency);
- PutToDict(dict, "symbolrate", feparm.symbol_rate);
+ PutToDictAsStr(dict, "frequency", feparm.frequency);
+ PutToDictAsStr(dict, "symbolrate", feparm.symbol_rate);
switch (feparm.modulation)
{
case eDVBFrontendParametersCable::Modulation::QAM16: tmp="QAM16"; break;
eDVBFrontendParametersSatellite osat;
if (!feparm->getDVBS(osat))
{
- void PutToDict(ePyObject &, const char*, long);
- void PutToDict(ePyObject &, const char*, const char*);
PutToDict(ret, "orbital_position", osat.orbital_position);
const char *tmp = "UNKNOWN";
switch(osat.polarisation)
for (std::multiset<struct cueEntry>::iterator i(m_cue_entries.begin()); i != m_cue_entries.end(); ++i)
{
ePyObject tuple = PyTuple_New(2);
- PyTuple_SetItem(tuple, 0, PyLong_FromLongLong(i->where));
- PyTuple_SetItem(tuple, 1, PyInt_FromLong(i->what));
+ PyTuple_SET_ITEM(tuple, 0, PyLong_FromLongLong(i->where));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(i->what));
PyList_Append(list, tuple);
Py_DECREF(tuple);
}
eDVBServicePMTHandler::program program;
if (m_service_handler.getProgramInfo(program))
{
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
- PyObject *r = program.createPythonObject();
+ ePyObject r = program.createPythonObject();
ePtr<iDVBDemux> demux;
if (!m_service_handler.getDataDemux(demux))
{
uint8_t demux_id;
- demux->getCADemuxID(demux_id);
-
- PyDict_SetItemString(r, "demux", PyInt_FromLong(demux_id));
+ if (!demux->getCADemuxID(demux_id))
+ PutToDict(r, "demux", demux_id);
}
return r;