ccextractor/api/recursive_tester.py
Diptanshu Jamgade 47c5a6e73b Cleaning up the codebase and additional changes in Python SRT generator. (#771)
* Removed all extractors except the grid extractor.
Removed the call to transcript extractor in ccx_encoders_transcript.c

* Removed unnecessary array appening statements in python_grid_extractor.
WIP: switch in extractor.

* Added switch in g608 grid extractor.

* Deleted comments from wrappers.

* Refactored code in ccextractor.c and .h files.
Removed all the commented part.
Made proper changes according to the coding conventions.

* Removed calls to extractor from all the encoders.
The only call made to extractor is from ccx_encoders_python.c.

* Removed a comment from wrapper.c.
In init_write function of output.c added a call to free the output string returned by asprintf in case of
sending filename to callback function.

* Added calls to free the char* which is malloced by asprintf in
extractor.c
WIP: Free the global variable elements.

* Sample testing correctly for italics tag.
Also added a hack to print only 32 characters when unicode fails.
WIP: Font tag.

* Added support for handling font and italics in Python SRT generator.

* modified the font generator.
Also, added count method for checking blank strings in
python_srt_generator.

* Added free statements for avoiding memory leaks.

* added return code for failure of asprintf calls.

* Removing unnecessary code from api_testing.py

* Made modifications to Makefile and build script.

* Added recursive_tester.py
Autoconf builds successfully.

* BUG: Made change to get_line_encoded to encode the last \0 character in a
line. Otherwise the EOL characted is absent causing garbage value to be
present in SRT.

* Exporting the encoding of the captions from CCExtractor to Python so
that the python SRT generator can generate proper SRT files.

* Modified the include statement in extractor.h
2017-08-25 11:03:00 -07:00

26 lines
752 B
Python

import sys
import os
import subprocess
output_formats = ['.srt','.ass','.ssa','.webvtt','.sami','.txt','.original','.python','.py']
args_list = sys.argv[1:]
args_count = len(args_list)
if args_count>1:
print "wrong usage"
exit(0)
directory = args_list[0]
if not os.path.isdir(directory):
print "error: path given is not a directory"
exit(0)
files = []
for item in os.listdir(directory):
ext = os.path.splitext(item)[1]
if ext not in output_formats:
files.append(os.path.join(directory,item))
for sample in files:
print "Processing file: "+sample
#command=['../linux/ccextractor',sample]
command = ['python','api_testing.py',sample]
subprocess.call(command)
print "Finished processing file: "+sample