Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove requirement for root folder when verifying / adding single files #118

Open
jmccdev opened this issue Feb 15, 2022 · 1 comment
Open
Labels
postpone Not an urgent topic at the moment

Comments

@jmccdev
Copy link

jmccdev commented Feb 15, 2022

The data used for this is under /sources/104_verification_types/104n/ within the dataset on the G-Drive:
https://drive.google.com/drive/folders/1PrAPczRFBQsVfjakbX-fqnDVHsAD-kd1

I created the ASC MHL History with:
ascmhl create -h md5 16421225_Day001/

Using the verify command on a single file in that dataset results in a Missing ASC MHL History error:

$ ascmhl verify 16421225_Day001/Camera_Media/A007_0124J4/A007_0124J4.RDM/A007_C001_0124UA.RDC/A007_C001_0124UA_001.R3D 
Error: Missing ASC MHL history at path /Users/jmccormick/Documents/knowledgebase/asc-mhl/ascmhl_dataset_20220208/expected_results/104/104n/16421225_Day001/Camera_Media/A007_0124J4/A007_0124J4.RDM/A007_C001_0124UA.RDC/A007_C001_0124UA_001.R3D

Using the create command on a single file in that dataset, in order to verify it AND create a new MHL generation to record that verification, results in a NotADirectoryError:

$ ascmhl create -h md5 16421225_Day001/Camera_Media/A007_0124J4/A007_0124J4.RDM/A007_C001_0124UA.RDC/A007_C001_0124UA_001.R3D 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/ascmhl", line 11, in <module>
    sys.exit(mhltool_cli())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ascmhl/commands.py", line 96, in create
    create_for_folder_subcommand(root_path, verbose, hash_format, no_directory_hashes, ignore_list, ignore_spec_file)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ascmhl/commands.py", line 137, in create_for_folder_subcommand
    for folder_path, children in post_order_lexicographic(root_path, session.ignore_spec.get_path_spec()):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ascmhl/traverse.py", line 27, in post_order_lexicographic
    names = os.listdir(top)
NotADirectoryError: [Errno 20] Not a directory: '/Users/jmccormick/Documents/knowledgebase/asc-mhl/ascmhl_dataset_20220208/expected_results/104/104n/16421225_Day001/Camera_Media/A007_0124J4/A007_0124J4.RDM/A007_C001_0124UA.RDC/A007_C001_0124UA_001.R3D'

Maybe it is unreasonable for the ascmhl tool to transverse up the directory tree until it finds an ascmhl directory, so maybe the tool could allow you to specify the location of the appropriate ASC MHL History when trying to verify a single file, or a subset of data.

@ptrpfn
Copy link
Collaborator

ptrpfn commented Feb 16, 2022

Both the verify and the create commands have an option -sf PATH or --single_file PATH to verify or add single files (you can have multiple -sf PATH options in one call). These options are implemented as additional options of the verify and the create commands which require also a root path of the ASC MHL History to be passed in.

This is not the most elegant solution, but the current command line parsing framework Click does not allow to make the root path mandatory for some options and optional for other options (such as the -sf PATH option). We looked at this already, but it would have been a major refactoring and/or redesign of the commands in order to fix this.

So to verify a single file use..

% ascmhl verify -v -sf /path/to/root-folder/and/file.txt /path/to/root-folder

... and add a single file use...

% ascmhl create -v -sf /path/to/root-folder/and/file.txt /path/to/root-folder

As this is more a design question (and the feature works for now as described above and documented with the --help option) I would propose to add a "postpone" tag to this issue for now. I also refined the title of the issue.

@ptrpfn ptrpfn added the postpone Not an urgent topic at the moment label Feb 16, 2022
@ptrpfn ptrpfn changed the title Support for verifying a single file Remove requirement for root folder in support for verifying / adding single files Feb 16, 2022
@ptrpfn ptrpfn changed the title Remove requirement for root folder in support for verifying / adding single files Remove requirement for root folder when verifying / adding single files Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postpone Not an urgent topic at the moment
Projects
None yet
Development

No branches or pull requests

2 participants