Module uri: support for URI providers

This module provides support for more URI providers.

uri_provider [ uri ]

uri: URI provider name (optional, default=module name)

Function for init of modules providing URI functions. Module must define functions {uri}_list and {uri}_get.

NOTE: Any ocurrence of "-" in URI provider part is converted to "_".

${uri_providers[@]}

Array, which contains all registered URI providers.

Module provides function for: function uri {

Module provides function for: pwiz_fatal "uri called without argument outside init"

Module provides function for: pwiz_array_add uris "$uri"

Module provides function for: declare -a uris

uri_exists uri

uri: URI

returns: 0: URI exists, 1: URI does not exist

Check, whether specified URI exists.

uri_get uri file

uri: URI

file: file name to be downloaded to (in case of empty string, backend will choose one, probably last element of path, if last element of path is empty, too, then "uri_index" is used)

Download specified URI to current directory as file.

uri_list uri uri_list_callback

uri: complete URI

uri_list_callback: callback for found items (can be empty - $pwiz_callback is used instead - probably echo)

Call callback for all available hyperlinks in specified URI.

{uri_list_callback} uri uri_type

uri: URI of found hyperlink

uri_type: "list": URI contains sub-URIs (directory, web page), "file": URI is file (downloadable file without links), "link": URI is hyper-reference or alias of different URI, "unknown": unknown type of URI (can be any of previous type)

returns: 0: no action needed, 1: follow this URI

Callback function for uri_list. If it returns 1, list function will suppose, that URI type is a "list" (or "link") and will follow this URI.

NOTE: Real calling of callback is delayed, so back-end can have opened fixed file I/O during call. There is no guarantee of callback order.

{uri}_exists uri provider domain path

uri: complete URI

provider: provider part of URI

domain: domain part of URI

path: path part of URI

returns: 0: URI exists, 1: URI does not exist

Back-end function for URI provider. Check, whether specified URI exists.

{uri}_get uri provider domain path file

uri: complete URI

provider: provider part of URI

domain: domain part of URI

path: path part of URI

file: file name to be downloaded to

Back-end function for URI provider. Download specified URI to current directory as file.

{uri}_list uri provider domain path uri_list_callback

uri: complete URI

provider: provider part of URI

domain: domain part of URI

path: path part of URI

uri_list_callback: callback for found items

Back-end function for URI provider. Call callback for all available hyperlinks in specified URI. Callback function must be called by:

 uri_callback uri_list_callback uri uri_type

uri_callback uri_list_callback uri uri_type

uri_list_callback: callback for found items

uri: URI of found hyperlink

uri_type: "list": URI contains sub-URIs (directory, web page), "file": URI is file (downloadable file without links), "link": URI is hyper-reference or alias of different URI, "unknown": unknown type of URI (can be any of previous type)

Internal function for {uri}_list back-end of URI provider. this function performs calling of uri_list_callback and does recursive calling, if required.