objectionengine2 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. objectionengine2-1.0.0/LICENSE +21 -0
  2. objectionengine2-1.0.0/PKG-INFO +101 -0
  3. objectionengine2-1.0.0/README.md +72 -0
  4. objectionengine2-1.0.0/objectionengine2/MovieKit.py +615 -0
  5. objectionengine2-1.0.0/objectionengine2/__init__.py +3 -0
  6. objectionengine2-1.0.0/objectionengine2/ace_attorney_scene.py +1718 -0
  7. objectionengine2-1.0.0/objectionengine2/beans/comment.py +22 -0
  8. objectionengine2-1.0.0/objectionengine2/beans/text.py +9 -0
  9. objectionengine2-1.0.0/objectionengine2/cache.py +18 -0
  10. objectionengine2-1.0.0/objectionengine2/composers/compose_gavel_slam.py +72 -0
  11. objectionengine2-1.0.0/objectionengine2/composers/compose_verdict.py +56 -0
  12. objectionengine2-1.0.0/objectionengine2/font_constants.py +37 -0
  13. objectionengine2-1.0.0/objectionengine2/font_tools.py +98 -0
  14. objectionengine2-1.0.0/objectionengine2/gavel_slam.py +80 -0
  15. objectionengine2-1.0.0/objectionengine2/judge_verdict.py +179 -0
  16. objectionengine2-1.0.0/objectionengine2/loading.py +253 -0
  17. objectionengine2-1.0.0/objectionengine2/make_movie.py +133 -0
  18. objectionengine2-1.0.0/objectionengine2/math_helpers.py +22 -0
  19. objectionengine2-1.0.0/objectionengine2/parse_tags.py +213 -0
  20. objectionengine2-1.0.0/objectionengine2/renderer.py +1 -0
  21. objectionengine2-1.0.0/objectionengine2/tag_macros.py +25 -0
  22. objectionengine2-1.0.0/objectionengine2/testimony_indicator.py +113 -0
  23. objectionengine2-1.0.0/objectionengine2/utils.py +94 -0
  24. objectionengine2-1.0.0/objectionengine2/xml_parser.py +279 -0
  25. objectionengine2-1.0.0/pyproject.toml +56 -0
  26. objectionengine2-1.0.0/pyproject.toml.orig +52 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Luis Mayo Valbuena
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: objectionengine2
3
+ Version: 1.0.0
4
+ Summary: Independent continuation of Objection Engine for rendering Ace Attorney scenes
5
+ Author: Luis Mayo Valbuena, Malcolm Anderson
6
+ Author-email: Luis Mayo Valbuena <luismayovalbuena@outlook.es>, Malcolm Anderson <malcolminyo@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Dist: pillow>=10.4,<13
10
+ Requires-Dist: pydub>=0.25.1,<0.26
11
+ Requires-Dist: audioop-lts>=0.2.2,<0.3 ; python_full_version >= '3.13'
12
+ Requires-Dist: ffmpeg-python>=0.2,<0.3
13
+ Requires-Dist: spacy>=3.8.16,<3.9
14
+ Requires-Dist: opencv-python-headless>=4.14,<5
15
+ Requires-Dist: fonttools>=4.60,<5
16
+ Requires-Dist: numpy>=2.2,<3
17
+ Requires-Dist: rich>=14,<16
18
+ Requires-Dist: requests>=2.32,<3
19
+ Requires-Dist: platformdirs>=4.4,<5
20
+ Requires-Dist: toml>=0.10.2,<0.11
21
+ Requires-Dist: transformers>=4.55,<6 ; extra == 'sentiment'
22
+ Requires-Dist: torch>=2.8,<3 ; extra == 'sentiment'
23
+ Requires-Dist: sentencepiece>=0.2,<0.3 ; extra == 'sentiment'
24
+ Requires-Dist: protobuf>=5,<7 ; extra == 'sentiment'
25
+ Requires-Python: >=3.10, <3.15
26
+ Project-URL: Original, https://github.com/LuisMayo/objection_engine
27
+ Provides-Extra: sentiment
28
+ Description-Content-Type: text/markdown
29
+
30
+ # objectionengine2
31
+
32
+ objectionengine2 converts comment chains and scripted dialogue into Ace Attorney style videos. It is an independent continuation of [Objection Engine](https://github.com/LuisMayo/objection_engine), originally created by Luis Mayo Valbuena. The original copyright and MIT license are preserved in `LICENSE`.
33
+
34
+ The distribution, repository, and Python import are all named `objectionengine2`. Update existing `objection_engine` imports when migrating scripts.
35
+
36
+ ## Requirements
37
+
38
+ - Python 3.10 through 3.14
39
+ - FFmpeg and `ffprobe` on `PATH`
40
+ - The Objection Engine asset pack. The renderer downloads it on first use into
41
+ the user cache directory selected by `platformdirs` for `objectionengine2`.
42
+ An existing complete `./assets/` pack is copied there on first use.
43
+
44
+ ## Install
45
+
46
+ From a clone, sync the locked environment with `uv`:
47
+
48
+ ```bash
49
+ uv sync --python 3.14 --locked
50
+ ```
51
+
52
+ The package supports Python 3.10–3.14; `.python-version` selects 3.14 by default. To enable Hugging Face sentiment, add `--extra sentiment` to the run command, for example `uv run --locked --extra sentiment python examples/example_easy.py`. This downloads a model on first use into the same user cache under `models/`. The base installation does not need a model. Find the cache location with `uv run python -c 'from objectionengine2.cache import cache_path; print(cache_path())'`.
53
+
54
+ ## Render comments
55
+
56
+ ```python
57
+ from objectionengine2.beans.comment import Comment
58
+ from objectionengine2.renderer import render_comment_list
59
+
60
+ comments = [
61
+ Comment(user_name="Phoenix", text_content="The defense is ready."),
62
+ Comment(user_name="Edgeworth", text_content="The prosecution is ready."),
63
+ ]
64
+ render_comment_list(comments, output_filename="outputs/output.mp4")
65
+ ```
66
+
67
+ Run `uv run python examples/example_easy.py` from the repository root for a complete example. Additional scene, XML, and casting examples are in `examples/`; reference documentation is in `docs/`. Pass an `output_filename` in an existing directory. Scripts with literal `assets/...` paths still need a local asset directory; generated comment dialogue uses the user cache.
68
+
69
+ ## Sentiment settings
70
+
71
+ By default, dialogue uses neutral sentiment and needs no machine learning dependency. Explicit `Comment(score=...)` values still select positive or negative sprites. Set `oe_sentiment_model=hf` after installing the `sentiment` extra to use the Hugging Face model. Setting `oe_bypass_sentiment` to a nonempty value forces neutral sentiment. The former Polyglot mode is no longer supported; an unsupported `oe_sentiment_model` value raises a clear error.
72
+
73
+ Set `OE_DIRECT_H264_ENCODING=true` only if your OpenCV build provides an H.264 encoder. The default path encodes the intermediate video with OpenCV and creates the final H.264/AAC MP4 with FFmpeg.
74
+
75
+ ## Container (Podman)
76
+
77
+ The Docker image uses Python 3.14 and includes FFmpeg. Build and run the included example from the repository root:
78
+
79
+ ```bash
80
+ podman build -t objectionengine2 .
81
+ podman volume create objectionengine2-cache
82
+ podman run --rm \
83
+ --mount type=volume,src=objectionengine2-cache,dst=/root/.cache/objectionengine2 \
84
+ --mount type=bind,src="$(pwd)/outputs",dst=/app/outputs \
85
+ objectionengine2
86
+ ```
87
+
88
+ The result is `outputs/output.mp4`. Ensure `outputs/` exists before running;
89
+ the image saves downloaded assets and models in the mounted cache volume.
90
+ To run your own script, mount it at `/app/render.py` and add `render.py` after
91
+ the image name. Have the script write into `outputs/`.
92
+
93
+ ## Tests
94
+
95
+ `uv sync --locked` installs the default `dev` group, including pytest. Run `uv run --locked pytest -q` for offline tests. They generate their own small media inputs and require FFmpeg and `ffprobe` but do not download assets or models.
96
+
97
+ For a complete courtroom smoke test, run `uv run --locked pytest -q -m asset_integration`. The test calls `ensure_assets_are_available()` from `objectionengine2.utils` first, which populates the platform cache if needed. Keep that cache to avoid downloading the pack again.
98
+
99
+ ## Contributing
100
+
101
+ Changes and fixes are welcome. Please run the offline suite before opening a pull request.
@@ -0,0 +1,72 @@
1
+ # objectionengine2
2
+
3
+ objectionengine2 converts comment chains and scripted dialogue into Ace Attorney style videos. It is an independent continuation of [Objection Engine](https://github.com/LuisMayo/objection_engine), originally created by Luis Mayo Valbuena. The original copyright and MIT license are preserved in `LICENSE`.
4
+
5
+ The distribution, repository, and Python import are all named `objectionengine2`. Update existing `objection_engine` imports when migrating scripts.
6
+
7
+ ## Requirements
8
+
9
+ - Python 3.10 through 3.14
10
+ - FFmpeg and `ffprobe` on `PATH`
11
+ - The Objection Engine asset pack. The renderer downloads it on first use into
12
+ the user cache directory selected by `platformdirs` for `objectionengine2`.
13
+ An existing complete `./assets/` pack is copied there on first use.
14
+
15
+ ## Install
16
+
17
+ From a clone, sync the locked environment with `uv`:
18
+
19
+ ```bash
20
+ uv sync --python 3.14 --locked
21
+ ```
22
+
23
+ The package supports Python 3.10–3.14; `.python-version` selects 3.14 by default. To enable Hugging Face sentiment, add `--extra sentiment` to the run command, for example `uv run --locked --extra sentiment python examples/example_easy.py`. This downloads a model on first use into the same user cache under `models/`. The base installation does not need a model. Find the cache location with `uv run python -c 'from objectionengine2.cache import cache_path; print(cache_path())'`.
24
+
25
+ ## Render comments
26
+
27
+ ```python
28
+ from objectionengine2.beans.comment import Comment
29
+ from objectionengine2.renderer import render_comment_list
30
+
31
+ comments = [
32
+ Comment(user_name="Phoenix", text_content="The defense is ready."),
33
+ Comment(user_name="Edgeworth", text_content="The prosecution is ready."),
34
+ ]
35
+ render_comment_list(comments, output_filename="outputs/output.mp4")
36
+ ```
37
+
38
+ Run `uv run python examples/example_easy.py` from the repository root for a complete example. Additional scene, XML, and casting examples are in `examples/`; reference documentation is in `docs/`. Pass an `output_filename` in an existing directory. Scripts with literal `assets/...` paths still need a local asset directory; generated comment dialogue uses the user cache.
39
+
40
+ ## Sentiment settings
41
+
42
+ By default, dialogue uses neutral sentiment and needs no machine learning dependency. Explicit `Comment(score=...)` values still select positive or negative sprites. Set `oe_sentiment_model=hf` after installing the `sentiment` extra to use the Hugging Face model. Setting `oe_bypass_sentiment` to a nonempty value forces neutral sentiment. The former Polyglot mode is no longer supported; an unsupported `oe_sentiment_model` value raises a clear error.
43
+
44
+ Set `OE_DIRECT_H264_ENCODING=true` only if your OpenCV build provides an H.264 encoder. The default path encodes the intermediate video with OpenCV and creates the final H.264/AAC MP4 with FFmpeg.
45
+
46
+ ## Container (Podman)
47
+
48
+ The Docker image uses Python 3.14 and includes FFmpeg. Build and run the included example from the repository root:
49
+
50
+ ```bash
51
+ podman build -t objectionengine2 .
52
+ podman volume create objectionengine2-cache
53
+ podman run --rm \
54
+ --mount type=volume,src=objectionengine2-cache,dst=/root/.cache/objectionengine2 \
55
+ --mount type=bind,src="$(pwd)/outputs",dst=/app/outputs \
56
+ objectionengine2
57
+ ```
58
+
59
+ The result is `outputs/output.mp4`. Ensure `outputs/` exists before running;
60
+ the image saves downloaded assets and models in the mounted cache volume.
61
+ To run your own script, mount it at `/app/render.py` and add `render.py` after
62
+ the image name. Have the script write into `outputs/`.
63
+
64
+ ## Tests
65
+
66
+ `uv sync --locked` installs the default `dev` group, including pytest. Run `uv run --locked pytest -q` for offline tests. They generate their own small media inputs and require FFmpeg and `ffprobe` but do not download assets or models.
67
+
68
+ For a complete courtroom smoke test, run `uv run --locked pytest -q -m asset_integration`. The test calls `ensure_assets_are_available()` from `objectionengine2.utils` first, which populates the platform cache if needed. Keep that cache to avoid downloading the pack again.
69
+
70
+ ## Contributing
71
+
72
+ Changes and fixes are welcome. Please run the offline suite before opening a pull request.