X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b3135c06dd527e0ed65b6ffa921f830132f7d8b9..f27bd5e1b2c49b0db87dbac70298ad33d2e4d537:/lib/dvb/metaparser.cpp diff --git a/lib/dvb/metaparser.cpp b/lib/dvb/metaparser.cpp index 175c7cdb..5eff4d9d 100644 --- a/lib/dvb/metaparser.cpp +++ b/lib/dvb/metaparser.cpp @@ -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) @@ -67,6 +91,9 @@ int eDVBMetaParser::parseMeta(const std::string &tsname) case 6: m_filesize = atoll(line); break; + case 7: + m_service_data = line; + break; default: break; } @@ -121,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); @@ -145,7 +172,7 @@ int eDVBMetaParser::updateMeta(const std::string &tsname) FILE *f = fopen(filename.c_str(), "w"); if (!f) return -ENOENT; - fprintf(f, "%s\n%s\n%s\n%d\n%s\n%d\n%lld\n", ref.toString().c_str(), m_name.c_str(), m_description.c_str(), m_time_create, m_tags.c_str(), m_length, m_filesize ); + fprintf(f, "%s\n%s\n%s\n%d\n%s\n%d\n%lld\n%s\n", ref.toString().c_str(), m_name.c_str(), m_description.c_str(), m_time_create, m_tags.c_str(), m_length, m_filesize, m_service_data.c_str() ); fclose(f); return 0; }