Skip to content

Commit

Permalink
Add some code to validate hints (specifically flags if a hint refers
Browse files Browse the repository at this point in the history
to a nonexistant track in order to catch picky typo errors.)
  • Loading branch information
clolsonus committed Feb 1, 2021
1 parent 7413f9e commit ff5a986
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,19 @@ def load(path):
else:
log("unknwon hint in hint.txt:", row)
return hints

def validate( hints, audio_tracks, video_tracks ):
log("Validating hints:")
hint_names = set()
for file in audio_tracks + video_tracks:
name = os.path.basename(file)
hint_names.add(name)
errors = False
for name in hints.keys():
if not name in hint_names:
log(" Error: file name in hints.txt file not found in project:", name)
errors = True
if errors:
log("Name mismatches found in hints.txt file")
else:
log("All names in hints.txt file match up ok.")
1 change: 1 addition & 0 deletions sync-tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
for dir in work_dirs:
hint_dict.update( hints.load(dir) )
log("hints:", hint_dict)
hints.validate( hint_dict, all_audio_tracks, all_video_tracks )

# make results directory (if it doesn't exist)
results_dir = os.path.join(args.project, "results")
Expand Down

0 comments on commit ff5a986

Please sign in to comment.