-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Automatically detects the format of the output.
Two options here:
- the capture output format is determined by the file name ending, e.g.
%%capture_auto--path "foo.txt"
will detect it is txt. - the capture output format is determined by the cell output, e.g.
%%capture_auto--path "foo"
will save the output tofoo.mp4
if the output is of type video, or tofoo.png
if the output type is an image.
Another thought: Option 2 could be extended in the following way: if there are multiple outputs, they can be all saved in respective files, e.g. foo.txt
, foo.mp4
and foo.png
.
Here is an implementation start point:
@magic_arguments.magic_arguments() ################### Auto
@magic_arguments.argument(
"--path",
"-p",
default=None,
help=(
"Auto detect what to capture based on file ending"
),
)
@cell_magic
def capture_auto(self, line, cell):
args = magic_arguments.parse_argstring(CaptureMagic.capture_auto, line)
path_str = args.path.strip('"')
p_pathlib = path_preprocessing(path_str)
if p_pathlib.suffix == ".png":
pass
if p_pathlib.suffix == ".mp4":
pass
if p_pathlib.suffix == ".txt":
pass
if p_pathlib.suffix == ".py":
pass
Metadata
Metadata
Assignees
Labels
No labels