From 1f6ef062c2aa8cd2b666a14d1906ccc26369b8ed Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 19 Mar 2019 23:00:50 -0700 Subject: importer for CDL/DASH dat pilot dweb datasets --- python/fatcat_import.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'python/fatcat_import.py') diff --git a/python/fatcat_import.py b/python/fatcat_import.py index ce5063de..aea8c757 100755 --- a/python/fatcat_import.py +++ b/python/fatcat_import.py @@ -65,9 +65,22 @@ def run_wayback_static(args): return print("release_id: {}".format(release_id)) print("editgroup_id: {}".format(editgroup_id)) - print("edit id: {}".format(wc.ident)) + print("webcapture id: {}".format(wc.ident)) print("link: https://fatcat.wiki/webcapture/{}".format(wc.ident)) +def run_cdl_dash_dat(args): + api = args.api + + # create it + (editgroup_id, release, fs) = auto_cdl_dash_dat(api, args.dat_path, + release_id=args.release_id, editgroup_id=args.editgroup_id) + if not fs: + return + print("release_id: {}".format(release.ident)) + print("editgroup_id: {}".format(editgroup_id)) + print("fileset id: {}".format(fs.ident)) + print("link: https://fatcat.wiki/fileset/{}".format(fs.ident)) + def main(): parser = argparse.ArgumentParser() parser.add_argument('--debug', @@ -174,6 +187,21 @@ def main(): type=str, help="use existing editgroup (instead of creating a new one)") + sub_cdl_dash_dat = subparsers.add_parser('cdl-dash-dat') + sub_cdl_dash_dat.set_defaults( + func=run_cdl_dash_dat, + auth_var="FATCAT_API_AUTH_TOKEN", + ) + sub_cdl_dash_dat.add_argument('dat_path', + type=str, + help="local path dat to import (must be the dat discovery key)") + sub_cdl_dash_dat.add_argument('--release-id', + type=str, + help="release entity identifier") + sub_cdl_dash_dat.add_argument('--editgroup-id', + type=str, + help="use existing editgroup (instead of creating a new one)") + args = parser.parse_args() if not args.__dict__.get("func"): print("tell me what to do!") -- cgit v1.2.3