private IEnumerable <MediaFileInfo> GetFilteredFileData(ComponentRole role) { // SP-2171: i.MediaFilePath will be empty if the file is zero length (see MediaFileInfo.GetInfo()). This happens often with the generated oral annotation file. return(_backgroundStatisticsGather.GetAllFileData() .Where(i => !string.IsNullOrEmpty(i.MediaFilePath) && !i.MediaFilePath.EndsWith(Settings.Default.OralAnnotationGeneratedFileSuffix) && role.IsMatch(i.MediaFilePath))); }
/// ------------------------------------------------------------------------------------ public TimeSpan GetRecordingDurations(ComponentRole role) { var total = _backgroundStatisticsGather.GetAllFileData() .Where(info => role.IsMatch(info.MediaFilePath)) .Aggregate(TimeSpan.Zero, (current, info) => current + info.Duration); // Trim off the milliseconds so it doesn't get too geeky return(new TimeSpan(total.Hours, total.Minutes, total.Seconds)); }
/// ------------------------------------------------------------------------------------ private long GetTotalComponentRoleFileSizes(ComponentRole role) { long bytes = 0; foreach (var info in _backgroundStatisticsGather.GetAllFileData()) { if (role.IsMatch(info.MediaFilePath)) { bytes += info.LengthInBytes; } } return(bytes); }