From 97909d42012ca026c51d2e7b882ce55eb0acffab Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Thu, 15 Jan 2009 00:49:09 +0100 Subject: cache movie filelengths in .meta file, by luke_s --- lib/service/servicedvb.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/service/servicedvb.cpp') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 90195d9b..dcd7017c 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -536,14 +536,25 @@ int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref) eDVBTSTools tstools; + struct stat s; + stat(ref.path.c_str(), &s); + if (tstools.openFile(ref.path.c_str())) return 0; + /* check if cached data is still valid */ + if (m_parser.m_data_ok && (s.st_size == m_parser.m_filesize) && (m_parser.m_length)) + return m_parser.m_length / 90000; + + /* otherwise, re-calc length and update meta file */ pts_t len; if (tstools.calcLen(len)) return 0; - return len / 90000; + m_parser.m_length = len; + m_parser.m_filesize = s.st_size; + m_parser.updateMeta(ref.path); + return m_parser.m_length / 90000; } int eStaticServiceDVBPVRInformation::getInfo(const eServiceReference &ref, int w) -- cgit v1.2.3