|
2 | 2 |
|
3 | 3 | from typing import TYPE_CHECKING
|
4 | 4 |
|
| 5 | +import av |
| 6 | + |
5 | 7 | from auto_editor.analyze import mut_remove_large, mut_remove_small
|
6 | 8 | from auto_editor.lib.contracts import *
|
7 | 9 | from auto_editor.lib.data_structs import *
|
@@ -749,6 +751,13 @@ def attr(env: Env, node: Node) -> Any:
|
749 | 751 | raise MyError("@r: attribute must be an identifier")
|
750 | 752 |
|
751 | 753 | base = my_eval(env, node[1])
|
| 754 | + |
| 755 | + if hasattr(base, "__pyx_vtable__"): |
| 756 | + try: |
| 757 | + return getattr(base, node[2].val) |
| 758 | + except AttributeError as e: |
| 759 | + raise MyError(e) |
| 760 | + |
752 | 761 | if type(base) is PaletClass:
|
753 | 762 | if type(name := node[2]) is not Sym:
|
754 | 763 | raise MyError("@r: class attribute must be an identifier")
|
@@ -1171,6 +1180,9 @@ def change_file_ext(a, ext) -> str:
|
1171 | 1180 | "string->vector", lambda s: [Char(c) for c in s], (1, 1), is_str
|
1172 | 1181 | ),
|
1173 | 1182 | "range->vector": Proc("range->vector", list, (1, 1), is_range),
|
| 1183 | + # av |
| 1184 | + "encoder": Proc("encoder", lambda x: av.Codec(x, "w"), (1, 1), is_str), |
| 1185 | + "decoder": Proc("decoder", lambda x: av.Codec(x), (1, 1), is_str), |
1174 | 1186 | # reflexion
|
1175 | 1187 | "var-exists?": Proc("var-exists?", lambda sym: sym.val in env, (1, 1), is_symbol),
|
1176 | 1188 | "rename": Syntax(syn_rename),
|
|
0 commit comments