Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: CI

on:
push:
branches: main
pull_request:
on: [push, pull_request, workflow_dispatch]

env:
FORCE_COLOR: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.12
python-version: 3.x

- name: Install
run: make install-deps
Expand Down
1 change: 0 additions & 1 deletion .schemas/pathschema
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ tools/

.gitignore
.editorconfig
.travis.yml
CONTRIBUTING.rst
CONTRIBUTORS_WITHOUT_COMMITS.rst
LICENSE
Expand Down
1 change: 1 addition & 0 deletions .tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ jinja2
jsonschema
pathschema
pygments
termcolor
unidecode
50 changes: 50 additions & 0 deletions .tests/speaker_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import argparse
import json
import sys

from termcolor import colored, cprint

from tools.utils import get_json_files


def check_speaker_names(data_root, verbose=False):
_, video_paths = get_json_files(data_root)

invalid_names = []
# Map of disallowed speaker names to their correct replacements
replacements = {
"Glyph Lefkowitz": "Glyph",
}

for video_path in video_paths:
with open(video_path, encoding="UTF-8") as fp:
video_blob = json.load(fp)
speakers = video_blob.get("speakers", [])

for speaker in speakers:
if speaker in replacements:
invalid_names.append((video_path, speaker, replacements[speaker]))

if invalid_names:
cprint("Disallowed speaker names found:", "red")
for path, speaker, replacement in invalid_names:
speaker = colored(speaker, "red")
print(f"\t{path}: {speaker}")
print(f"\t\tUse {colored(replacement, 'green')} instead of {speaker}")
sys.exit(1)


def main():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--data-root",
help="directory to search for JSON files")
parser.add_argument("-v", "--verbose",
type=int,
help="increase output verbosity")
args = parser.parse_args()

check_speaker_names(args.data_root, verbose=args.verbose)


if __name__ == '__main__':
main()
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ help:
@echo ' '

.venv:
python3 -m venv $(VENV)
python3 -m venv $(VENV) --upgrade-deps

install-deps: .venv
$(BIN)/pip install -r $(TESTSDIR)/requirements.txt
Expand Down Expand Up @@ -54,6 +54,9 @@ test-languages: install-deps
test-filename-length: install-deps
$(PYTHON) $(TESTSDIR)/filename_length.py -d $(BASEDIR) -v $(VERBOSE)

test: test-directory-schemas test-schemas test-ids-unique test-slugs-unique test-render-rest test-languages test-filename-length
test-speaker-names: install-deps
$(PYTHON) $(TESTSDIR)/speaker_names.py -d $(BASEDIR) -v $(VERBOSE)

.PHONY: help test test-directory-schemas test-schemas test-ids-unique test-slugs-unique test-render-rest test-shape test-languages
test: test-directory-schemas test-schemas test-ids-unique test-slugs-unique test-render-rest test-languages test-filename-length test-speaker-names

.PHONY: help test test-directory-schemas test-schemas test-ids-unique test-slugs-unique test-render-rest test-shape test-languages test-speaker-names