X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6347d817582886ab7c7535b44601538749d06d5b..56ac7a4a764a4251a851778df09967405aa9a930:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 6c1e46f7..7a779e0c 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -31,8 +31,6 @@ #error no byte order defined! #endif -#define TSPATH "/media/hdd" - class eStaticServiceDVBInformation: public iStaticServiceInformation { DECLARE_REF(eStaticServiceDVBInformation); @@ -98,7 +96,7 @@ int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const 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) @@ -111,15 +109,17 @@ static void PutToDict(ePyObject &dict, const char*key, long value) 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; @@ -191,7 +191,7 @@ void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &fe 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) { @@ -275,8 +275,8 @@ void PutCableDataToDict(ePyObject &dict, eDVBFrontendParametersCable &feparm) { 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; @@ -1494,9 +1494,16 @@ RESULT eDVBServicePlay::timeshift(ePtr &ptr) { if (!m_timeshift_enabled) { - /* we need enough diskspace */ + /* query config path */ + std::string tspath; + if(ePythonConfigQuery::getConfigValue("config.usage.timeshift_path", tspath) == -1){ + eDebug("could not query ts path from config"); + return -4; + } + tspath.append("/"); + /* we need enough diskspace */ struct statfs fs; - if (statfs(TSPATH "/.", &fs) < 0) + if (statfs(tspath.c_str(), &fs) < 0) { eDebug("statfs failed!"); return -2; @@ -2035,8 +2042,6 @@ PyObject *eDVBServiceBase::getTransponderData(bool original) 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) @@ -2114,12 +2119,23 @@ RESULT eDVBServicePlay::startTimeshift() if (!m_record) return -3; - char templ[]=TSPATH "/timeshift.XXXXXX"; + std::string tspath; + if(ePythonConfigQuery::getConfigValue("config.usage.timeshift_path", tspath) == -1){ + eDebug("could not query ts path"); + return -5; + } + tspath.append("/timeshift.XXXXXX"); + char* templ; + templ = new char[tspath.length() + 1]; + strcpy(templ, tspath.c_str()); + m_timeshift_fd = mkstemp(templ); - m_timeshift_file = templ; - + m_timeshift_file = std::string(templ); + eDebug("recording to %s", templ); - + + delete [] templ; + if (m_timeshift_fd < 0) { m_record = 0; @@ -2181,8 +2197,8 @@ PyObject *eDVBServicePlay::getCutList() for (std::multiset::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); } @@ -3009,18 +3025,16 @@ PyObject *eDVBServicePlay::getStreamingData() 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 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;