File size: 1,508 Bytes
911e360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent
MAX_DURATION = 20.0

total = 0
files_with_long_sections = 0

for path in sorted(BASE_DIR.rglob("*.json")):
    try:
        data = json.loads(path.read_text(encoding="utf-8"))
    except Exception as e:
        print(f"ERROR: {path.relative_to(BASE_DIR)}: {e}")
        continue

    # ONLY process the "sections" array
    if not isinstance(data, dict):
        continue

    sections = data.get("sections")

    if not isinstance(sections, list):
        continue

    file_count = 0

    for section in sections:
        if not isinstance(section, dict):
            continue

        try:
            start = float(section["start_time"])
            end = float(section["end_time"])
        except (KeyError, TypeError, ValueError):
            continue

        duration = end - start

        if duration > MAX_DURATION:
            total += 1
            file_count += 1

            print(f"\n{path.relative_to(BASE_DIR)}")
            print(f"  section_id: {section.get('section_id', '?')}")
            print(f"  duration:   {duration:.3f}s")
            print(f"  start:      {start}")
            print(f"  end:        {end}")
            print(f"  transcript: {section.get('transcript', '')}")

    if file_count:
        files_with_long_sections += 1


print(f"\n{'=' * 60}")
print(f"Files with sections > {MAX_DURATION:g}s: {files_with_long_sections}")
print(f"Sections over {MAX_DURATION:g}s:          {total}")