dont show the infobar when close the last open screen
[enigma2.git] / lib / service / servicefs.cpp
index 8e5b729bafe2a36eabc8a0c0cc87080d2b2d2cfe..f2772192bc45887949b9a711068e83f3d712c526 100644 (file)
@@ -96,6 +96,11 @@ eServiceFS::~eServiceFS()
 {
 }
 
+int lower(char c)
+{
+       return std::tolower(static_cast<unsigned char>(c));
+}
+
 RESULT eServiceFS::getContent(std::list<eServiceReference> &list, bool sorted)
 {
        DIR *d=opendir(path.c_str());
@@ -131,6 +136,7 @@ RESULT eServiceFS::getContent(std::list<eServiceReference> &list, bool sorted)
                {
                        size_t e = filename.rfind('.');
                        std::string extension = (e != std::string::npos) ? filename.substr(e) : "";
+                       std::transform(extension.begin(), extension.end(), extension.begin(), lower);
                        int type = -1;
                        
                        if (extension == ".ts")
@@ -171,6 +177,7 @@ RESULT eServiceFS::getContent(std::list<eServiceReference> &list, bool sorted)
 //   useable format options are
 //   R = Service Reference (as swig object .. this is very slow)
 //   S = Service Reference (as python string object .. same as ref.toString())
+//   C = Service Reference (as python string object .. same as ref.toCompareString())
 //   N = Service Name (as python string object)
 //   when exactly one return value per service is selected in the format string,
 //   then each value is directly a list entry
@@ -179,7 +186,7 @@ RESULT eServiceFS::getContent(std::list<eServiceReference> &list, bool sorted)
 //   unknown format string chars are returned as python None values !
 PyObject *eServiceFS::getContent(const char* format, bool sorted)
 {
-       PyObject *ret=0;
+       ePyObject ret;
        std::list<eServiceReference> tmplist;
        int retcount=1;
 
@@ -201,14 +208,17 @@ PyObject *eServiceFS::getContent(const char* format, bool sorted)
                for (int cnt=0; cnt < services; ++cnt)
                {
                        eServiceReference &ref=*it++;
-                       PyObject *tuple = retcount > 1 ? PyTuple_New(retcount) : 0;
+                       ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : ePyObject();
                        for (int i=0; i < retcount; ++i)
                        {
-                               PyObject *tmp=0;
+                               ePyObject tmp;
                                switch(format[i])
                                {
                                case 'R':  // service reference (swig)object
-                                       tmp = New_eServiceReference(ref);
+                                       tmp = NEW_eServiceReference(ref);
+                                       break;
+                               case 'C':  // service reference compare string
+                                       tmp = PyString_FromString(ref.toCompareString().c_str());
                                        break;
                                case 'S':  // service reference string
                                        tmp = PyString_FromString(ref.toString().c_str());
@@ -248,7 +258,7 @@ PyObject *eServiceFS::getContent(const char* format, bool sorted)
                                PyList_SET_ITEM(ret, cnt, tuple);
                }
        }
-       return ret ? ret : PyList_New(0);
+       return ret ? (PyObject*)ret : (PyObject*)PyList_New(0);
 }
 
 RESULT eServiceFS::getNext(eServiceReference &ptr)