Patch by Moritz Venn:
authorFelix Domke <felix.domke@multimedia-labs.de>
Wed, 23 Dec 2009 11:57:45 +0000 (12:57 +0100)
committerFelix Domke <felix.domke@multimedia-labs.de>
Wed, 23 Dec 2009 11:57:45 +0000 (12:57 +0100)
"I've been annoyed by the incomplete "sort by date" for a long time - it only works for recorded movies.
Not much to say, I added a simple stat call in service.cpp and return the mtime for sTimeCreate so the list is as properly sorted as the dreambox can ;-)"

Minor changes so that it is implemented in servicemp3.cpp, since a service reference "path" is specific to the actual service.

lib/service/servicemp3.cpp
lib/service/servicemp3.h

index d3eaa262874ec7cf6144e9c3ef82a66b49b88875..47511f781142876fcd14993d57e076a81e8d5216 100644 (file)
@@ -189,6 +189,25 @@ int eStaticServiceMP3Info::getLength(const eServiceReference &ref)
        return -1;
 }
 
+int eStaticServiceMP3Info::getInfo(const eServiceReference &ref, int w)
+{
+       switch (w)
+       {
+       case iServiceInformation::sTimeCreate:
+       {
+               struct stat s;
+               if(stat(ref.path.c_str(), &s) == 0)
+               {
+                 return s.st_mtime;
+               }
+               return iServiceInformation::resNA;
+       }
+       default: break;
+       }
+       return iServiceInformation::resNA;
+}
+
 // eServiceMP3
 int eServiceMP3::ac3_delay,
     eServiceMP3::pcm_delay;
index 985179f65642143902bb0a9a5ef7df6bef8fd762..56a068b9e33b2c23db2f2eae805892c12a847270 100644 (file)
@@ -41,6 +41,7 @@ class eStaticServiceMP3Info: public iStaticServiceInformation
 public:
        RESULT getName(const eServiceReference &ref, std::string &name);
        int getLength(const eServiceReference &ref);
+       int getInfo(const eServiceReference &ref, int w);
 };
 
 typedef struct _GstElement GstElement;