lib/base/console.cpp: fix eConsoleAppContainer write (when called with one string...
[enigma2.git] / lib / dvb / metaparser.cpp
index 24a5ab67b1439e57298460a4c618d6c3c1ff1395..5eff4d9dbf277febc6523cacdb5a88e7a5c1800c 100644 (file)
@@ -17,7 +17,31 @@ int eDVBMetaParser::parseFile(const std::string &basename)
                return 0;
        
                /* otherwise, use recordings.epl */
-       return parseRecordings(basename);
+       if (!parseRecordings(basename))
+               return 0;
+       m_filesize = fileSize(basename);
+       return -1;
+
+}
+
+long long eDVBMetaParser::fileSize(const std::string &basename)
+{
+       long long filesize = 0;
+       char buf[255];
+       struct stat64 s;
+               /* get filesize */
+       if (!stat64(basename.c_str(), &s))
+               filesize = (long long) s.st_size;
+               /* handling for old splitted recordings (enigma 1) */
+       int slice=1;
+       while(true)
+       {
+               snprintf(buf, 255, "%s.%03d", basename.c_str(), slice++);
+               if (stat64(buf, &s) < 0)
+                       break;
+               filesize += (long long) s.st_size;
+       }
+       return filesize;
 }
 
 int eDVBMetaParser::parseMeta(const std::string &tsname)
@@ -124,7 +148,7 @@ int eDVBMetaParser::parseRecordings(const std::string &filename)
                        m_description = "";
                        m_time_create = 0;
                        m_length = 0;
-                       m_filesize = 0;
+                       m_filesize = fileSize(filename);
                                                
                        m_data_ok = 1;
                        fclose(f);