Python: captionbob.render
captionbob.render.video_version
One version of a video: the style, the transcript and the plugins.
The dashboard keeps each edit of a video as a new version. A version is one JSON object:
{
"format_version": 1,
"style": {"name": "apex", "settings": {"font_size": 80}},
"transcript": {the JSON of captionbob/transcript/transcript.py},
"plugins": [{"name": "progress_bar", "settings": {}}]
}
The style is an effect of captionbob/effects and a plugin is a plugin of captionbob/plugins, each by the name of its file with no suffix. The settings hold only the values that the user changed. Each other setting keeps its default. The words of the transcript are the words that the effect shows, so an edit of the captions is an edit of the transcript. A plugin can be in a version one time only, because the inner labels of its filter graph start with its name.
Source file: captionbob/render/video_version.py
ChosenPlugin
@dataclass(frozen=True)
class ChosenPlugin
One plugin of a version with its settings.
Args:
entry: The entry of the plugin.settings: The settings of the plugin, an object of its settings class.
VideoVersion
@dataclass(frozen=True)
class VideoVersion
One version of a video, checked.
Args:
effect: The entry of the effect of the style.effect_settings: The settings of the effect, an object of its settings class.transcript: The words of the video with their times.plugins: The plugins in the order in which they are drawn.
version_from_record
def version_from_record(record: Any) -> VideoVersion
Read and check one version from its JSON object.
Args:
record: The JSON object of the version.
Returns:
The version, with the settings objects of its style and plugins.
Raises:
TypeError: When a value has the wrong type.ValueError: When a value is missing, not known or impossible, when the format version is not known, or when a plugin is in the version more than one time.