<commit_before>#!/usr/bin/env python3
import json
import glob
import sys

def _in_sec(length):
    parts = [int(x) for x in length.split(':')]
    sec = 0
    #print(parts)
    while len(parts) > 0:
        sec *= 60
        sec += parts.pop(0)
    return sec

def main():
    if len(sys.argv) == 2:
        max_length = _in_sec(sys.argv[1])
        min_length = 0;
    elif len(sys.argv) == 3:
        min_length = _in_sec(sys.argv[1])
        max_length = _in_sec(sys.argv[2])
    else:
        exit("{} MM::SS [MM::SS]".format(sys.argv[0]))

    videos = []
    for video_file in glob.glob("data/videos/*/*.json"):
        with open(video_file) as fh:
            video = json.load(fh)
            if 'featured' in video:
                continue
            if 'skipped' in video:
                continue
            if 'length' in video:<commit_msg>show only talks with speakers<commit_after>#!/usr/bin/env python3
import json
import glob
import sys

# TODO: allow me to list only videos with speakers and/or only videos without speaker

def _in_sec(length):
    parts = [int(x) for x in length.split(':')]
    sec = 0
    #print(parts)
    while len(parts) > 0:
        sec *= 60
        sec += parts.pop(0)
    return sec

def main():
    if len(sys.argv) == 2:
        max_length = _in_sec(sys.argv[1])
        min_length = 0;
    elif len(sys.argv) == 3:
        min_length = _in_sec(sys.argv[1])
        max_length = _in_sec(sys.argv[2])
    else:
        exit("{} MM::SS [MM::SS]".format(sys.argv[0]))

    videos = []
    for video_file in glob.glob("data/videos/*/*.json"):
        with open(video_file) as fh:
            video = json.load(fh)
            if 'featured' in video:
                continue
            if 'skipped' in video:
                continue

            # show only videos with people?
            if not video['speakers']:
                continue

            if 'length' in video:
{'fraction_non_alphanumeric': 0.13215400624349635, 'fraction_numerical': 0.013527575442247659, 'mean_word_length': 1.9314024390243902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1720032', 'n_tokens_mistral': 664, 'n_tokens_neox': 636, 'n_words': 172}