From 3207dd687838f16b110d610a0b2e7bccd11ce257 Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Wed, 30 Oct 2019 01:06:31 +0000 Subject: [PATCH] Fixed temporary segments crashing segment coverage --- segment_coverage/segment_coverage/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/segment_coverage/segment_coverage/main.py b/segment_coverage/segment_coverage/main.py index 49df167..345b979 100644 --- a/segment_coverage/segment_coverage/main.py +++ b/segment_coverage/segment_coverage/main.py @@ -259,13 +259,16 @@ class CoverageChecker(object): for segment in partial_segments: partial_overlaps += 1 partial_overlap_duration += segment.duration - else: + elif partial_segments: partial_segments.sort(key=lambda segment: os.stat(segment.path).st_size) best_segment = partial_segments[-1] only_partials.append((best_segment.start, best_segment.start + best_segment.duration)) for segment in partial_segments[:-1]: partial_overlaps += 1 partial_overlap_duration += segment.duration + else: + # ignore any start times with only temporary segments + continue self.logger.debug(best_segment.path.split('/')[-1]) best_segments.append(best_segment)