epgcache: add possibility to change the default epg cache read/write path
[enigma2.git] / lib / service / service.cpp
index a044c66a0ec3480edcad4dd174c7b57120ed30ef..eb2757abae058edea84c404cde47d1742f72a7c6 100644 (file)
@@ -41,8 +41,8 @@ static std::string decode(const std::string s)
                        i += 2;
                        if (i >= len)
                                break;
-                       char s[3] = {s[i - 1], s[i], 0};
-                       unsigned char r = strtoul(s, 0, 0x10);
+                       char t[3] = {s[i - 1], s[i], 0};
+                       unsigned char r = strtoul(t, 0, 0x10);
                        if (r)
                                res += r;
                }
@@ -187,18 +187,38 @@ RESULT eServiceCenter::offlineOperations(const eServiceReference &ref, ePtr<iSer
        return i->second->offlineOperations(ref, ptr);
 }
 
-RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd)
+RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd, std::list<std::string> &extensions)
 {
        handler.insert(std::pair<int,ePtr<iServiceHandler> >(id, hnd));
+       this->extensions[id]=extensions;
        return 0;
 }
 
 RESULT eServiceCenter::removeServiceFactory(int id)
 {
        handler.erase(id);
+       extensions.erase(id);
        return 0;
 }
 
+int eServiceCenter::getServiceTypeForExtension(const char *str)
+{
+       for (std::map<int, std::list<std::string> >::iterator sit(extensions.begin()); sit != extensions.end(); ++sit)
+       {
+               for (std::list<std::string>::iterator eit(sit->second.begin()); eit != sit->second.end(); ++eit)
+               {
+                       if (*eit == str)
+                               return sit->first;
+               }
+       }
+       return -1;
+}
+
+int eServiceCenter::getServiceTypeForExtension(const std::string &str)
+{
+       return getServiceTypeForExtension(str.c_str());
+}
+
        /* default handlers */
 RESULT iServiceHandler::info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr)
 {
@@ -219,7 +239,7 @@ int iStaticServiceInformation::getLength(const eServiceReference &ref)
        return -1;
 }
 
-int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore)
+int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate)
 {
        return 0;
 }