passing levels and mocks, fixed script classes not calling formatter
This commit is contained in:
parent
6ad0165368
commit
a9f9b840ce
4 changed files with 12 additions and 4 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
# Override variables globally for all subscriptions
|
# Override variables globally for all subscriptions
|
||||||
__preset__:
|
__preset__:
|
||||||
overrides:
|
overrides:
|
||||||
music_directory: "/music"
|
music_directory: "music"
|
||||||
|
|
||||||
# Supports downloading YouTube /releases tab. Also works for any playlist (or playlist of playlists)
|
# Supports downloading YouTube /releases tab. Also works for any playlist (or playlist of playlists)
|
||||||
# where each video is a single track.
|
# where each video is a single track.
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,6 @@ inspect_parser.add_argument(
|
||||||
InspectArguments.MOCK.short,
|
InspectArguments.MOCK.short,
|
||||||
InspectArguments.MOCK.long,
|
InspectArguments.MOCK.long,
|
||||||
metavar="VAR=VALUE",
|
metavar="VAR=VALUE",
|
||||||
nargs="+",
|
action="append",
|
||||||
help="ability to mock one or more variable values, i.e. --mock 'title=Lets Play'",
|
help="ability to mock one or more variable values, i.e. --mock 'title=Lets Play'",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,17 @@ class VariableValidation:
|
||||||
raise ValueError("Invalid resolution level for validation")
|
raise ValueError("Invalid resolution level for validation")
|
||||||
|
|
||||||
if mocks is not None:
|
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(
|
self.script.add(
|
||||||
variables=mocks,
|
variables=mocks,
|
||||||
unresolvable=self.unresolved_variables,
|
unresolvable=self.unresolved_variables,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.script = self.script.resolve_partial(
|
self.script = self.script.resolve_partial(
|
||||||
unresolvable=self.unresolved_variables,
|
unresolvable=self.unresolved_variables,
|
||||||
output_filter=self._get_resolve_partial_filter(),
|
output_filter=self._get_resolve_partial_filter(),
|
||||||
|
|
@ -182,8 +188,10 @@ class VariableValidation:
|
||||||
resolved_subscription |= validate_formatters(
|
resolved_subscription |= validate_formatters(
|
||||||
script=self.script,
|
script=self.script,
|
||||||
unresolved_variables=self.unresolved_variables,
|
unresolved_variables=self.unresolved_variables,
|
||||||
|
unresolved_runtime_variables=self.unresolved_runtime_variables,
|
||||||
validator=self.overrides,
|
validator=self.overrides,
|
||||||
|
partial_resolve_formatters=partial_resolve_formatters,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert not self.unresolved_variables
|
# assert not self.unresolved_variables
|
||||||
return resolved_subscription
|
return resolved_subscription
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ def _validate_formatter(
|
||||||
)
|
)
|
||||||
|
|
||||||
if maybe_resolved := parsed.maybe_resolvable:
|
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)
|
return ScriptUtils.to_native_script(parsed)
|
||||||
except RuntimeException as exc:
|
except RuntimeException as exc:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue