X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ab721417dda75931b7463fe2bbcaaca1fbad796b..d1de2263e4fff409a8fa16fc0069a923b4eff14d:/lib/service/servicefs.cpp diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index cf3f31f6..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; } @@ -176,4 +204,10 @@ int eServiceFS::compareLessEqual(const eServiceReference &a, const eServiceRefer return a.path < b.path; } +RESULT eServiceFS::startEdit(ePtr &res) +{ + res = 0; + return -1; +} + eAutoInitPtr init_eServiceFactoryFS(eAutoInitNumbers::service+1, "eServiceFactoryFS");