return Py_False;
}
int tmp, *dest = NULL,
- modulation, system, freq, sr, pol, fec, inv, pilot, rolloff;
+ modulation, system, freq, sr, pol, fec, inv, pilot, rolloff, tsid, onid;
char *end_ptr;
const Attribute *at;
std::string name;
inv = 2; // AUTO default
pilot = 2; // AUTO default
rolloff = 0; // alpha 0.35
+ tsid = -1;
+ onid = -1;
+
for (AttributeConstIterator it(tp_attributes.begin()); it != end; ++it)
{
-// eDebug("\t\tattr: %s", at->name().c_str());
+ //eDebug("\t\tattr: %s", at->name().c_str());
at = *it;
name = at->name();
if (name == "modulation") dest = &modulation;
else if (name == "inversion") dest = &inv;
else if (name == "rolloff") dest = &rolloff;
else if (name == "pilot") dest = &pilot;
+ else if (name == "tsid") dest = &tsid;
+ else if (name == "onid") dest = &onid;
if (dest)
{
tmp = strtol(at->value().c_str(), &end_ptr, 10);
}
if (freq && sr && pol != -1)
{
- tuple = PyTuple_New(10);
+ tuple = PyTuple_New(12);
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0));
PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(freq));
PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(sr));
PyTuple_SET_ITEM(tuple, 7, PyInt_FromLong(inv));
PyTuple_SET_ITEM(tuple, 8, PyInt_FromLong(rolloff));
PyTuple_SET_ITEM(tuple, 9, PyInt_FromLong(pilot));
+ PyTuple_SET_ITEM(tuple, 10, PyInt_FromLong(tsid));
+ PyTuple_SET_ITEM(tuple, 11, PyInt_FromLong(onid));
PyList_Append(tplist, tuple);
Py_DECREF(tuple);
}
{
ePtr<eDVBService> a_service, b_service;
int sortmode = m_query ? m_query->m_sort : eDVBChannelQuery::tName;
-
+
if ((sortmode == eDVBChannelQuery::tName) || (sortmode == eDVBChannelQuery::tProvider))
{
if (a.name.empty() && m_db->getService(a, a_service))
if (b.name.empty() && m_db->getService(b, b_service))
return 1;
}
-
+
switch (sortmode)
{
case eDVBChannelQuery::tName:
RESULT parseExpression(ePtr<eDVBChannelQuery> &res, std::list<std::string>::const_iterator begin, std::list<std::string>::const_iterator end)
{
std::list<std::string>::const_iterator end_of_exp;
-
+
if (begin == end)
return 0;
-
+
if (*begin == "(")
{
end_of_exp = begin;
break;
else
++end_of_exp;
-
+
if (end_of_exp == end)
{
eDebug("expression parse: end of expression while searching for closing brace");
return -1;
}
-
+
++begin;
// begin..end_of_exp
int r = parseExpression(res, begin, end_of_exp);
if (r)
return r;
++end_of_exp;
-
+
/* we had only one sub expression */
if (end_of_exp == end)
{
// eDebug("only one sub expression");
return 0;
}
-
+
/* otherwise we have an operator here.. */
-
+
ePtr<eDVBChannelQuery> r2 = res;
res = new eDVBChannelQuery();
res->m_sort = 0;
res->m_p1 = r2;
res->m_inverse = 0;
r2 = 0;
-
+
if (*end_of_exp == "||")
res->m_type = eDVBChannelQuery::tOR;
else if (*end_of_exp == "&&")
res = 0;
return 1;
}
-
+
++end_of_exp;
-
+
return parseExpression(res->m_p2, end_of_exp, end);
}
-
+
// "begin" <op> "end"
std::string type, op, val;
-
+
res = new eDVBChannelQuery();
res->m_sort = 0;
-
+
int cnt = 0;
while (begin != end)
{
++begin;
++cnt;
}
-
+
if (cnt != 3)
{
eDebug("malformed query: missing stuff");
res = 0;
return 1;
}
-
+
res->m_type = decodeType(type);
-
+
if (res->m_type == -1)
{
eDebug("malformed query: invalid type %s", type.c_str());
res = 0;
return 1;
}
-
+
if (op == "==")
res->m_inverse = 0;
else if (op == "!=")
res = 0;
return 1;
}
-
+
res->m_string = val;
if (res->m_type == eDVBChannelQuery::tChannelID)
RESULT eDVBChannelQuery::compile(ePtr<eDVBChannelQuery> &res, std::string query)
{
std::list<std::string> tokens;
-
+
std::string current_token;
std::string bouquet_name;
{
int c = (i < query.size()) ? query[i] : ' ';
++i;
-
+
int issplit = !!strchr(splitchars, c);
int isaln = isalnum(c);
int iswhite = c == ' ';
int isquot = c == '\"';
-
+
if (quotemode)
{
iswhite = issplit = 0;
isaln = lastalnum;
}
-
+
if (issplit || iswhite || isquot || lastsplit || (lastalnum != isaln))
{
if (current_token.size())
tokens.push_back(current_token);
current_token.clear();
}
-
+
if (!(iswhite || isquot))
current_token += c;
-
+
if (isquot)
quotemode = !quotemode;
lastsplit = issplit;
lastalnum = isaln;
}
-
+
// for (std::list<std::string>::const_iterator a(tokens.begin()); a != tokens.end(); ++a)
// {
// printf("%s\n", a->c_str());
res = 0;
return -1;
}
-
+
// eDebug("sort by %d", sort);
-
+
/* now we recursivly parse that. */
int r = parseExpression(res, tokens.begin(), tokens.end());
-
+
/* we have an empty (but valid!) expression */
if (!r && !res)
{
res->m_inverse = 0;
res->m_type = eDVBChannelQuery::tAny;
}
-
+
if (res)
{
res->m_sort = sort;