Man page - datalad-addurls(1)
Packages contains this manual
- datalad-download-url(1)
- datalad-no-annex(1)
- datalad-addurls(1)
- datalad-siblings(1)
- datalad-remove(1)
- datalad-drop(1)
- datalad-export-archive(1)
- datalad-export-archive-ora(1)
- datalad-create-sibling-gogs(1)
- datalad-push(1)
- datalad-create-sibling-gitea(1)
- datalad-copy-file(1)
- datalad-sshrun(1)
- datalad-subdatasets(1)
- datalad-check-dates(1)
- datalad-create-sibling-gitlab(1)
- datalad-clone(1)
- datalad-create-test-dataset(1)
- datalad-wtf(1)
- datalad-create-sibling-github(1)
- datalad-shell-completion(1)
- datalad-uninstall(1)
- datalad-create-sibling-gin(1)
- datalad-configuration(1)
- datalad-update(1)
- datalad-get(1)
- datalad(1)
- datalad-clean(1)
- datalad-create-sibling-ria(1)
- datalad-rerun(1)
- datalad-create(1)
- datalad-unlock(1)
- datalad-status(1)
- datalad-run(1)
- datalad-foreach-dataset(1)
- datalad-install(1)
- datalad-add-archive-content(1)
- datalad-create-sibling(1)
- datalad-run-procedure(1)
- datalad-save(1)
- datalad-diff(1)
- datalad-add-readme(1)
- datalad-export-to-figshare(1)
apt-get install datalad
Manual
datalad addurls
NAMESYNOPSIS
DESCRIPTION
Format specification
Examples
OPTIONS
AUTHORS
NAME
datalad addurls - create and update a dataset from a list of URLs.
SYNOPSIS
|
datalad addurls [-h] [-d DATASET] [-t TYPE] [-x REGEXP] [-m FORMAT] [--key FORMAT] [--message MESSAGE] [-n] [--fast] [--ifexists {overwrite|skip}] [--missing-value VALUE] [--nosave] [--version-urls] [-c PROC] [-J NJOBS] [--drop-after] [--on-collision {error|error-if-different|take-first|take-last}] [--version] URL-FILE URL-FORMAT FILENAME-FORMAT |
DESCRIPTION
Format specification
Several arguments take format strings. These are similar to normal Python format strings where the names from âURL-FILEâ (column names for a comma- or tab-separated file or properties for JSON) are available as placeholders. If âURL-FILEâ is a CSV or TSV file, a positional index can also be used (i.e., "{0}" for the first column). Note that a placeholder cannot contain a â:â or â!â.
In addition, the âFILENAME-FORMATâ arguments has a few special placeholders.
- _repindex
The constructed
file names must be unique across all fields rows. To
avoid collisions, the special placeholder
"_repindex" can be added to
the formatter. Its value will start at 0 and increment every
time a
file name repeats.
- _url_hostname, _urlN, _url_basename*
Various parts of
the formatted URL are available. Take
"http://datalad.org/asciicast/seamless_nested_repos.sh"
as an example.
"datalad.org"
is stored as "_url_hostname". Components of the
URLâs
path can be referenced as "_urlN".
"_url0" and "_url1" would map to
"asciicast" and
"seamless_nested_repos.sh", respectively. The
final
part of the path is also available as
"_url_basename".
This name is
broken down further. "_url_basename_root" and
"_url_basename_ext" provide access to the root
name and extension.
These values are similar to the result of os.path.splitext,
but, in the
case of multiple periods, the extension is identified using
the same
length heuristic that git-annex uses. As a result, the
extension of
"file.tar.gz" would be ".tar.gz", not
".gz". In addition, the fields
"_url_basename_root_py" and
"_url_basename_ext_py" provide access to
the result of os.path.splitext.
- _url_filename*
These are
similar to _url_basename* fields, but they are obtained with
a server request. This is useful if the file name is set in
the
Content-Disposition header.
Examples
Consider a file "avatars.csv" that contains::
who,ext,link
neurodebian,png,https://avatars3.githubusercontent.com/u/260793
datalad,png,https://avatars1.githubusercontent.com/u/8927200
To download each link into a file name composed of the âwhoâ and âextâ fields, we could run::
$ datalad addurls -d avatar_ds avatars.csv â{link}â â{who}.{ext}â
The â-d avatar_dsâ is used to create a new dataset in "$PWD/avatar_ds".
If we were already in a dataset and wanted to create a new subdataset in an "avatars" subdirectory, we could use "//" in the âFILENAME-FORMATâ argument::
$ datalad addurls avatars.csv â{link}â âavatars//{who}.{ext}â
If the information is represented as JSON lines instead of comma separated values or a JSON array, you can use a utility like jq to transform the JSON lines into an array that addurls accepts::
$ ... | jq --slurp . | datalad addurls - â{link}â â{who}.{ext}â
|
NOTE |
For users
familiar with âgit annex addurlâ: A large part
of this
pluginâs functionality can be viewed as transforming
data from
âURL-FILEâ into a "url filename"
format that fed to âgit annex addurl
--batch --with-filesâ.
OPTIONS
URL-FILE
A file that contains URLs or information that can be used to construct URLs. Depending on the value of --input-type, this should be a comma- or tab-separated file (with a header as the first row) or a JSON file (structured as a list of objects with string values). If â-â, read from standard input, taking the content as JSON when --input-type is at its default value of âextâ.
URL-FORMAT
A format string that specifies the URL for each entry. See the âFormat Specificationâ section above.
FILENAME-FORMAT
Like âURL-FORMATâ, but this format string specifies the file to which the URLâs content will be downloaded. The name should be a relative path and will be taken as relative to the top-level dataset, regardless of whether it is specified via --dataset or inferred. The file name may contain directories. The separator "//" can be used to indicate that the left-side directory should be created as a new subdataset. See the âFormat Specificationâ section above.
-h , --help , --help-np
show this help message. --help-np forcefully disables the use of a pager for displaying the help message
-d DATASET , --dataset DATASET
Add the URLs to this dataset (or possibly subdatasets of this dataset). An empty or non-existent directory is passed to create a new dataset. New subdatasets can be specified with âFILENAME-FORMATâ. Constraints: Value must be a Dataset or a valid identifier of a Dataset (e.g. a path) or value must be NONE
-t TYPE, --input-type TYPE
Whether âURL-FILEâ should be considered a CSV file, TSV file, or JSON file. The default value, "ext", means to consider âURL-FILEâ as a JSON file if it ends with ".json" or a TSV file if it ends with ".tsv". Otherwise, treat it as a CSV file. Constraints: value must be one of (âextâ, âcsvâ, âtsvâ, âjsonâ) [Default: âextâ]
-x REGEXP, --exclude-autometa REGEXP
By default, metadata field=value pairs are constructed with each column in âURL-FILEâ, excluding any single column that is specified via âURL-FORMATâ. This argument can be used to exclude columns that match a regular expression. If set to â*â or an empty string, automatic metadata extraction is disabled completely. This argument does not affect metadata set explicitly with --meta.
-m FORMAT, --meta FORMAT
A format string that specifies metadata. It should be structured as "<field>=<value>". As an example, "location={3}" would mean that the value for the "location" metadata field should be set the value of the fourth column. This option can be given multiple times.
--key FORMAT
A format string that specifies an annex key for the file content. In this case, the file is not downloaded; instead the key is used to create the file without content. The value should be structured as "[et:]<input backend>[-s<bytes>]--<hash>". The optional "et:" prefix, which requires git-annex 8.20201116 or later, signals to toggle extension state of the input backend (i.e., MD5 vs MD5E). As an example, "et:MD5-s{size}--{md5sum}" would use the âmd5sumâ and âsizeâ columns to construct the key, migrating the key from MD5 to MD5E, with an extension based on the file name. Note: If the *input* backend itself is an annex extension backend (i.e., a backend with a trailing "E"), the keyâs extension will not be updated to match the extension of the corresponding file name. Thus, unless the input keys and file names are generated from git-annex, it is recommended to avoid using extension backends as input. If an extension is desired, use the plain variant as input and prepend "et:" so that git-annex will migrate from the plain backend to the extension variant.
--message MESSAGE
Use this message when committing the URL additions. Constraints: value must be NONE or value must be a string
-n , --dry-run
Report which URLs would be downloaded to which files and then exit.
|
--fast |
If True, add the URLs, but donât download their content. WARNING: ONLY USE THIS OPTION IF YOU UNDERSTAND THE CONSEQUENCES. If the content of the URLs is not downloaded, then datalad will refuse to retrieve the contents with âdatalad get <file>â by default because the content of the URLs is not verified. Add âannex.security.allow-unverified-downloads = ACKTHPPTâ to your git config to bypass the safety check. Underneath, this passes the â--fastâ flag to âgit annex addurlâ. |
--ifexists {overwrite|skip}
What to do if a constructed file name already exists. The default behavior is to proceed with the âgit annex addurlâ, which will fail if the file size has changed. If set to âoverwriteâ, remove the old file before adding the new one. If set to âskipâ, do not add the new file. Constraints: value must be one of (âoverwriteâ, âskipâ)
--missing-value VALUE
When an empty string is encountered, use this value instead. Constraints: value must be NONE or value must be a string
--nosave
by default all modifications to a dataset are immediately saved. Giving this option will disable this behavior.
--version-urls
Try to add a version ID to the URL. This currently only has an effect on HTTP URLs for AWS S3 buckets. s3:// URL versioning is not yet supported, but any URL that already contains a "versionId=" parameter will be used as is.
-c PROC, --cfg-proc PROC
Pass this --cfg_proc value when calling CREATE to make datasets.
-J NJOBS, --jobs NJOBS
how many parallel jobs (where possible) to use. "auto" corresponds to the number defined by âdatalad.runtime.max-annex-jobsâ configuration item. Constraints: value must be convertible to type âintâ or value must be NONE or value must be one of (âautoâ,)
--drop-after
drop files after adding to annex.
--on-collision {error|error-if-different|take-first|take-last}
What to do when more than one row produces the same file name. By default an error is triggered. "error-if-different" suppresses that error if rows for a given file name collision have the same URL and metadata. "take-first" or "take-last" indicate to instead take the first row or last row from each set of colliding rows. Constraints: value must be one of (âerrorâ, âerror-if-differentâ, âtake-firstâ, âtake-lastâ) [Default: âerrorâ]
--version
show the module and its version which provides the command
AUTHORS
datalad is developed by The DataLad Team and Contributors <team@datalad.org>.