From: Felix Domke Date: Mon, 5 Jun 2006 21:21:31 +0000 (+0000) Subject: add subtitle list X-Git-Tag: 2.6.0~3355 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/c389119db9c2134103d5845dca1387ad7d8367da add subtitle list --- diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index de4f84ee..826c29aa 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1843,7 +1843,7 @@ void eDVBServicePlay::cutlistToCuesheet() m_cue->commitSpans(); } -RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, int index) +RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *entry) { if (m_subtitle_widget) disableSubtitles(parent); @@ -1861,9 +1861,27 @@ RESULT eDVBServicePlay::disableSubtitles(eWidget *parent) return 0; } -RESULT eDVBServicePlay::getSubtitleList(PyList *list) +PyObject *eDVBServicePlay::getSubtitleList() { - return -1; + if (!m_teletext_parser) + { + Py_INCREF(Py_None); + return Py_None; + } + + PyObject *l = PyList_New(0); + + for (std::set::iterator i(m_teletext_parser->m_found_subtitle_pages.begin()); i != m_teletext_parser->m_found_subtitle_pages.end(); ++i) + { + PyObject *tuple = PyTuple_New(2); + char desc[20]; + sprintf(desc, "Page %x", *i); + PyTuple_SetItem(tuple, 0, PyString_FromString(desc)); + PyTuple_SetItem(tuple, 1, PyInt_FromLong(*i)); + PyList_Append(l, tuple); + } + + return l; } void eDVBServicePlay::newSubtitlePage(const eDVBTeletextSubtitlePage &page) diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 85653caa..00aba963 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -142,9 +142,9 @@ public: void setCutListEnable(int enable); // iSubtitleOutput - RESULT enableSubtitles(eWidget *parent, int index); + RESULT enableSubtitles(eWidget *parent, PyObject *entry); RESULT disableSubtitles(eWidget *parent); - SWIG_VOID(RESULT) getSubtitleList(PyList *list); + PyObject *getSubtitleList(); private: friend class eServiceFactoryDVB;