Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerlin committed Jun 22, 2021
1 parent 6fdbff2 commit 4e84ab6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tools/check_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ def __call__(self, results):
return results


def file_len(file):
with open(file) as f:
for i, _ in enumerate(f, 1):
pass
return i


def _do_check_videos(lock, dataset, output_file, idx):
try:
dataset[idx]
Expand Down Expand Up @@ -150,8 +143,9 @@ def _do_check_videos(lock, dataset, output_file, idx):
pool.join()

if os.path.exists(args.output_file):
num_lines = sum(1 for _ in open(args.output_file))
print(f'Checked {len(dataset)} videos, '
f'{file_len(args.output_file)} are corrupted/missing.')
f'{num_lines} are corrupted/missing.')
if args.remove_corrupted_videos:
print('Start deleting corrupted videos')
cnt = 0
Expand Down

0 comments on commit 4e84ab6

Please sign in to comment.