Skip to content

Commit

Permalink
[eDVBDB]
Browse files Browse the repository at this point in the history
* add getAllServicesRaw
  • Loading branch information
jbleyel committed Sep 17, 2024
1 parent c19e5b9 commit 0dc1dcb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/dvb/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,33 @@ void eDVBDB::searchAllReferences(std::vector<eServiceReference> &result, int tsi
}
}

PyObject *eDVBDB::getAllServicesRaw()
{

ePyObject serviceList = PyDict_New();
if (serviceList)
{
for (std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator sit(m_services.begin());
sit != m_services.end(); ++sit)
{
ePyObject tuple = PyTuple_New(5);
ePtr<eDVBService> service = sit->second;
PyTuple_SET_ITEM(tuple, 0, PyUnicode_FromString(service->m_service_name.c_str()));
PyTuple_SET_ITEM(tuple, 1, PyUnicode_FromString(!service->m_service_display_name.empty() ? service->m_service_display_name.c_str() : service->m_service_name.c_str()));
PyTuple_SET_ITEM(tuple, 2, PyUnicode_FromString(service->m_provider_name.c_str()));
PyTuple_SET_ITEM(tuple, 3, PyUnicode_FromString(service->m_provider_display_name.c_str()));
PyTuple_SET_ITEM(tuple, 4, PyLong_FromLongLong(service->m_flags));
PyDict_SetItemString(serviceList, sit->first.toReferenceString().c_str(), tuple);
Py_DECREF(tuple);
}

}
else
Py_RETURN_NONE;
return serviceList;
}


DEFINE_REF(eDVBDBQueryBase);

eDVBDBQueryBase::eDVBDBQueryBase(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query)
Expand Down
1 change: 1 addition & 0 deletions lib/dvb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class eDVBDB: public iDVBChannelList
bool isValidService(int tsid, int onid, int sid);
void parseServiceData(ePtr<eDVBService> s, std::string str);
int getMaxNumber() const { return m_max_number; }
PyObject *getAllServicesRaw();
};

#ifndef SWIG
Expand Down

0 comments on commit 0dc1dcb

Please sign in to comment.