X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2e2cf81de863a180f7d27dca89e5122e1eb0acaa..a19aef8b3244f753b02e5a06e7d3a185a424949f:/lib/service/servicefs.cpp diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index 1afdd169..8254e63b 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -25,6 +25,7 @@ DEFINE_REF(eStaticServiceFSInformation); RESULT eStaticServiceFSInformation::getName(const eServiceReference &ref, std::string &name) { name = ref.path; + return 0; } // eServiceFactoryFS @@ -95,7 +96,7 @@ eServiceFS::~eServiceFS() { } -RESULT eServiceFS::getContent(std::list &list) +RESULT eServiceFS::getContent(std::list &list, bool sorted) { DIR *d=opendir(path.c_str()); if (!d) @@ -140,6 +141,33 @@ RESULT eServiceFS::getContent(std::list &list) } } closedir(d); + + if (sorted) + list.sort(iListableServiceCompare(this)); + + return 0; +} + +RESULT eServiceFS::getContent(PyObject *list, bool sorted) +{ + if (!list || !PyList_Check(list)) + return -1; + + std::list tmplist; + + getContent(tmplist, sorted); + + if (sorted) + tmplist.sort(iListableServiceCompare(this)); + + for (std::list::iterator it(tmplist.begin()); + it != tmplist.end(); ++it) + { + PyObject *refobj = New_eServiceReference(*it); + PyList_Append(list, refobj); + Py_DECREF(refobj); + } + return 0; }