Skip to content

Commit

Permalink
Adding a couple of extra metadata fields for filenaming. (#79)
Browse files Browse the repository at this point in the history
* Adding a couple of extra metadata fields for filenaming.
This helps define exactly how the output filename is defined, which then helps with the log files, and general template generation.

Signed-off-by: [email protected] <[email protected]>

* Update enctests/testframework/encoders/ffmpeg_encoder.py

Fixing return

Co-authored-by: Daniel Flehner Heen <[email protected]>
Signed-off-by: Sam Richards <[email protected]>

* Fixing return values for get-output-filename

Signed-off-by: [email protected] <[email protected]>

* Fixing template.

Signed-off-by: [email protected] <[email protected]>

* Update enctests/testframework/encoders/ffmpeg_encoder.py

Converting the return type to a Tuple

Co-authored-by: Daniel Flehner Heen <[email protected]>
Signed-off-by: Sam Richards <[email protected]>

---------

Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Sam Richards <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Daniel Flehner Heen <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2024
1 parent 32d6cef commit e46adb5
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
13 changes: 8 additions & 5 deletions enctests/testframework/encoders/ffmpeg_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run_wedges(self) -> dict:
for wedge_name, wedge in self.test_config.get('wedges', {}).items():
# Test name is based on main test name and wedge name
test_name = f"{self.test_config.get('name')}-{wedge_name}"
out_file = self.get_output_filename(test_name)
out_file, testbasename = self.get_output_filename(test_name)

# Remove it, so if the new run fails to create anything
# we are not accidently using the old one.
Expand Down Expand Up @@ -101,7 +101,8 @@ def run_wedges(self) -> dict:
test_meta['command'] = cmd
test_meta['encode_arguments'] = wedge
test_meta['description'] = self.test_config.get('description')

test_meta['outputfile'] = str(out_file)
test_meta['testbasename'] = testbasename
result_meta = test_meta.setdefault('results', {})
result_meta['completed_utc'] = \
datetime.now(timezone.utc).isoformat()
Expand Down Expand Up @@ -172,15 +173,17 @@ def get_source_path(self) -> Tuple[pathlib.Path, str]:

return path, symbol

def get_output_filename(self, test_name: str) -> pathlib.Path:
def get_output_filename(self, test_name: str) -> Tuple[pathlib.Path, str]:
source_path, symbol = self.get_source_path()
stem = source_path.stem.replace(symbol, '')
if stem[-1] == ".":
stem = stem[:-1]

testbasename = f"{stem}-{test_name}"

out_file = self.destination.absolute().joinpath(
f"{stem}-{test_name}{self.test_config.get('suffix')}"
f"{testbasename}{self.test_config.get('suffix')}"
)

return out_file
return out_file, testbasename

4 changes: 2 additions & 2 deletions enctests/testframework/templates/basic.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</a></TH>
<td align=right><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}_tests.log">Test {{ enc_info.testresult}}</A> </TD>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</a></TH>
<td align=right><A target="_blank" HREF="{{ enc_info.testbasename|e }}_tests.log">Test {{ enc_info.testresult}}</A> </TD>
<td align=right>{{ enc_info.encode_time}} </TD>
<td align=right>{{ enc_info.filesize}} </TD>
<TD align=right>{{enc_info.vmaf_harmonic_mean |e }}</TD>
Expand Down
6 changes: 3 additions & 3 deletions enctests/testframework/templates/basicmovie.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</a></TH>
<td align=right><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}_tests.log">Result - {{ enc_info.testresult }}</A> </TD>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</a></TH>
<td align=right><A target="_blank" HREF="{{ enc_info.testbasename|e }}_tests.log">Result - {{ enc_info.testresult }}</A> </TD>
<td align=right>{{ enc_info.encode_time}} </TD>
<td align=right>{{ "{:,}".format(enc_info.filesize) }} </TD>
<TD align=right>{{enc_info.vmaf_harmonic_mean |e }}</TD>
Expand Down Expand Up @@ -90,7 +90,7 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</A></TH>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right><video width="500px" controls <source type='video/mp4' src="{{ enc_info.output_media | e }}"/> </video></TD>
<TD>{{enc_info.encode_arguments | e}}</TD>
</TR>
Expand Down
2 changes: 1 addition & 1 deletion enctests/testframework/templates/basicpictures.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</A></TH>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right>{{ enc_info.encode_time}} </TD>
<td align=right>{{ "{:,}".format(enc_info.filesize) }} </TD>
<TD align=right>{{enc_info.vmaf.harmonic_mean |e }}</TD>
Expand Down
4 changes: 2 additions & 2 deletions enctests/testframework/templates/colorweb.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}_tests.log">{{ enc_info.testresult }}</A> </TD>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right><A target="_blank" HREF="{{ enc_info.testbasename|e }}_tests.log">{{ enc_info.testresult }}</A> </TD>
<td align=right>{{ enc_info.mean_error}} </TD>
<td align=right>{{ enc_info.max_error}} </TD>
<td align=right>{{ enc_info.encode_time}} </TD>
Expand Down
6 changes: 3 additions & 3 deletions enctests/testframework/templates/doctests.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
</TR>
{% for enc_info in test.results %}
<TR>
<TH><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}_tests.log">{{ enc_info.testresult}}</A> </TD>
<TH><A target="_blank" HREF="{{ enc_info.testbasename|e }}.log">{{ enc_info.name|e }}</A></TH>
<td align=right><A target="_blank" HREF="{{ enc_info.testbasename|e }}_tests.log">{{ enc_info.testresult}}</A> </TD>
<td align=right>{{ enc_info.mean_error}} </TD>
<td align=right><A target="_blank" HREF="{{ test.default_media.basename }}-{{ enc_info.name|e }}-x20diff.png">{{ enc_info.max_error}} </A></TD>
<td align=right><A target="_blank" HREF="{{ enc_info.testbasename|e }}-x20diff.png">{{ enc_info.max_error}} </A></TD>
<td align=right>{{ enc_info.encode_time}} </TD>
<td align=right>{{ "{:,}".format(enc_info.filesize) }} </TD>
<TD>{{enc_info.command | e}}</TD>
Expand Down
1 change: 1 addition & 0 deletions enctests/testframework/utils/outputTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def processTemplate(config, timeline):
continue
merge_test_info = test_info.metadata['aswf_enctests']['results']
merge_test_info['name'] = ref_name
merge_test_info['testbasename'] = test_info.metadata['aswf_enctests']['testbasename']
merge_test_info['wedge'] = ref_name.replace(track.metadata.get('source_test_name', '')+"-", "")
if 'description' in test_info.metadata['aswf_enctests']:
merge_test_info['test_description'] = test_info.metadata['aswf_enctests']['description']
Expand Down

0 comments on commit e46adb5

Please sign in to comment.