19 lines
652 B
Python
19 lines
652 B
Python
"""Write an ANSI/CP437 conversion to a ``.ANS`` file."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
|
|
def export_ans(conv, path, source_path=None, display="key", seconds=0,
|
|
video="pal", layout="unified"):
|
|
"""Write the conversion's ANSI byte stream to ``path`` (forcing a .ans suffix).
|
|
|
|
The extra keyword arguments (display / seconds / video / layout) exist only so
|
|
ANSI shares the platform export interface; a static text file ignores them.
|
|
"""
|
|
if not str(path).lower().endswith(".ans"):
|
|
path = os.path.splitext(path)[0] + ".ans"
|
|
with open(path, "wb") as f:
|
|
f.write(conv.data)
|
|
return path
|