+ slot->possible_caids.clear();
+ slot->possible_services.clear();
+ slot->possible_providers.clear();
+ int size = PyList_Size(service_list);
+ while(size)
+ {
+ --size;
+ ePyObject refstr = PyList_GET_ITEM(service_list, size);
+ if (!PyString_Check(refstr))
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in service list is not a string.. it is '%s'!!", PyObject_TypeStr(refstr));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ char *tmpstr = PyString_AS_STRING(refstr);
+ eServiceReference ref(tmpstr);
+ if (ref.valid())
+ slot->possible_services.insert(ref);
+ else
+ eDebug("eDVBCIInterfaces::setDescrambleRules '%s' is not a valid service reference... ignore!!", tmpstr);
+ };
+ size = PyList_Size(provider_list);
+ while(size)
+ {
+ --size;
+ ePyObject tuple = PyList_GET_ITEM(provider_list, size);
+ if (!PyTuple_Check(tuple))
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in provider list is not a tuple it is '%s'!!", PyObject_TypeStr(tuple));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ if (PyTuple_Size(tuple) != 2)
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules provider tuple has %d instead of 2 entries!!", PyTuple_Size(tuple));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ if (!PyString_Check(PyTuple_GET_ITEM(tuple, 0)))
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules 1st entry in provider tuple is not a string it is '%s'", PyObject_TypeStr(PyTuple_GET_ITEM(tuple, 0)));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ if (!PyLong_Check(PyTuple_GET_ITEM(tuple, 1)))
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules 2nd entry in provider tuple is not a long it is '%s'", PyObject_TypeStr(PyTuple_GET_ITEM(tuple, 1)));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ char *tmpstr = PyString_AS_STRING(PyTuple_GET_ITEM(tuple, 0));
+ uint32_t orbpos = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(tuple, 1));
+ if (strlen(tmpstr))
+ slot->possible_providers.insert(std::pair<std::string, uint32_t>(tmpstr, orbpos));
+ else
+ eDebug("eDVBCIInterfaces::setDescrambleRules ignore invalid entry in provider tuple (string is empty)!!");
+ };
+ size = PyList_Size(caid_list);
+ while(size)
+ {
+ --size;
+ ePyObject caid = PyList_GET_ITEM(caid_list, size);
+ if (!PyLong_Check(caid))
+ {
+ char buf[255];
+ snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in caid list is not a long it is '%s'!!", PyObject_TypeStr(caid));
+ PyErr_SetString(PyExc_StandardError, buf);
+ return -1;
+ }
+ int tmpcaid = PyLong_AsLong(caid);
+ if (tmpcaid > 0 && tmpcaid < 0x10000)
+ slot->possible_caids.insert(tmpcaid);
+ else
+ eDebug("eDVBCIInterfaces::setDescrambleRules %d is not a valid caid... ignore!!", tmpcaid);
+ };
+ return 0;
+}