passing levels and mocks, fixed script classes not calling formatter

This commit is contained in:
Jesse Bannon 2026-03-09 16:00:41 -07:00
parent 6ad0165368
commit a9f9b840ce
4 changed files with 12 additions and 4 deletions

View file

@ -13,7 +13,7 @@
# Override variables globally for all subscriptions
__preset__:
overrides:
music_directory: "/music"
music_directory: "music"
# Supports downloading YouTube /releases tab. Also works for any playlist (or playlist of playlists)
# where each video is a single track.

View file

@ -307,6 +307,6 @@ inspect_parser.add_argument(
InspectArguments.MOCK.short,
InspectArguments.MOCK.long,
metavar="VAR=VALUE",
nargs="+",
action="append",
help="ability to mock one or more variable values, i.e. --mock 'title=Lets Play'",
)

View file

@ -71,11 +71,17 @@ class VariableValidation:
raise ValueError("Invalid resolution level for validation")
if mocks is not None:
for mock_name in mocks.keys():
if mock_name in self.unresolved_variables:
self.unresolved_variables.remove(mock_name)
self.script.add(
variables=mocks,
unresolvable=self.unresolved_variables,
)
self.script = self.script.resolve_partial(
unresolvable=self.unresolved_variables,
output_filter=self._get_resolve_partial_filter(),
@ -182,8 +188,10 @@ class VariableValidation:
resolved_subscription |= validate_formatters(
script=self.script,
unresolved_variables=self.unresolved_variables,
unresolved_runtime_variables=self.unresolved_runtime_variables,
validator=self.overrides,
partial_resolve_formatters=partial_resolve_formatters,
)
assert not self.unresolved_variables
# assert not self.unresolved_variables
return resolved_subscription

View file

@ -293,7 +293,7 @@ def _validate_formatter(
)
if maybe_resolved := parsed.maybe_resolvable:
return formatter_validator.post_process(maybe_resolved)
return formatter_validator.post_process(maybe_resolved.native)
return ScriptUtils.to_native_script(parsed)
except RuntimeException as exc: