enable http automatic redirects (requires very recent neonhttpsrc). (mpeg-1 podcasts...
[enigma2.git] / lib / service / service.cpp
index a490c3d7ba099d7177328435532d240c5d0ca81f..73544991419cfe6cae1167b2815898182340d77f 100644 (file)
@@ -1,19 +1,24 @@
 #include <lib/base/eerror.h>
 #include <lib/base/estring.h>
+#include <lib/python/python.h>
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
+#include <lib/python/python.h>
 
 eServiceReference::eServiceReference(const std::string &string)
 {
        const char *c=string.c_str();
        int pathl=0;
 
-       if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7], &pathl) < 8 )
+       if (!string.length())
+               type = idInvalid;
+       else if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7], &pathl) < 8 )
        {
                memset( data, 0, sizeof(data) );
                eDebug("find old format eServiceReference string");
-               sscanf(c, "%d:%d:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &pathl);
+               if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &pathl) < 2 )
+                       type = idInvalid;
        }
 
        if (pathl)
@@ -40,12 +45,22 @@ std::string eServiceReference::toString() const
        ret += getNum(flags);
        for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
                ret+=":"+ getNum(data[i], 0x10);
-       ret+=":"+path;
+       ret+=":"+path; /* we absolutely have a problem when the path contains a ':' (for example: http://). we need an encoding here. */
        if (name.length())
                ret+=":"+name;
        return ret;
 }
 
+std::string eServiceReference::toCompareString() const
+{
+       std::string ret;
+       ret += getNum(type);
+       ret += ":0";
+       for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
+               ret+=":"+getNum(data[i], 0x10);
+       ret+=":"+path;
+       return ret;
+}
 
 eServiceCenter *eServiceCenter::instance;
 
@@ -156,9 +171,9 @@ int iStaticServiceInformation::getLength(const eServiceReference &ref)
        return -1;
 }
 
-bool iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore)
+int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore)
 {
-       return true;
+       return 0;
 }
 
 RESULT iServiceInformation::getEvent(ePtr<eServiceEvent> &evt, int m_nownext)
@@ -187,4 +202,30 @@ std::string iServiceInformation::getInfoString(int w)
        return "";
 }
 
+PyObject* iServiceInformation::getInfoObject(int w)
+{
+       Py_INCREF(Py_None);
+       return Py_None;
+}
+
+int iStaticServiceInformation::setInfo(const eServiceReference &ref, int w, int v)
+{
+       return -1;
+}
+
+int iStaticServiceInformation::setInfoString(const eServiceReference &ref, int w, const char *v)
+{
+       return -1;
+}
+
+int iServiceInformation::setInfo(int w, int v)
+{
+       return -1;
+}
+
+int iServiceInformation::setInfoString(int w, const char *v)
+{
+       return -1;
+}
+
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");