File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 3535 CONFIG_MAP ,
3636 DEFAULT_JPG_QUALITY ,
3737 DEFAULT_WEBP_QUALITY ,
38- XmlFormat ,
3938)
4039from scenedetect ._cli .context import USER_CONFIG , CliContext , check_split_video_requirements
4140from scenedetect .backends import AVAILABLE_BACKENDS
@@ -1668,11 +1667,9 @@ def save_xml_command(
16681667 ctx = ctx .obj
16691668 assert isinstance (ctx , CliContext )
16701669
1671- # TODO: Change config parser so get_value returns enums directly.
1672- format = XmlFormat [ctx .config .get_value ("save-xml" , "format" , format ).upper ()]
16731670 save_xml_args = {
16741671 "filename" : ctx .config .get_value ("save-xml" , "filename" , filename ),
1675- "format" : format ,
1672+ "format" : ctx . config . get_value ( "save-xml" , " format" , format ) ,
16761673 "output" : ctx .config .get_value ("save-xml" , "output" , output ),
16771674 }
16781675 ctx .add_command (cli_commands .save_xml , save_xml_args )
Original file line number Diff line number Diff line change @@ -450,8 +450,6 @@ class XmlFormat(Enum):
450450The types of these values are used when decoding the configuration file. Valid choices for
451451certain string options are stored in `CHOICE_MAP`."""
452452
453- # TODO: Use the fact that all enums derive from the Enum class to avoid duplicating their values
454- # here in the choice map.
455453CHOICE_MAP : ty .Dict [str , ty .Dict [str , ty .List [str ]]] = {
456454 "backend-pyav" : {
457455 "threading_mode" : [mode .lower () for mode in PYAV_THREADING_MODES ],
@@ -765,8 +763,10 @@ def get_value(
765763 value = self ._config [command ][option ]
766764 else :
767765 value = CONFIG_MAP [command ][option ]
768- if issubclass ( type ( value ) , ValidatedValue ):
766+ if isinstance ( value , ValidatedValue ):
769767 return value .value
768+ if isinstance (CONFIG_MAP [command ][option ], Enum ) and isinstance (override , str ):
769+ return CONFIG_MAP [command ][option ].__class__ [value .upper ().strip ()]
770770 return value
771771
772772 def get_help_string (
You can’t perform that action at this time.
0 commit comments