Skip to content
Snippets Groups Projects
Commit e7ac425c authored by Duncan Macleod's avatar Duncan Macleod Committed by Duncan Macleod
Browse files

api: make URL transforms more generic

parent 9cd5af67
No related branches found
No related tags found
1 merge request!64Add support for OSDF URL transforms
......@@ -251,6 +251,11 @@ def find_latest_url(ext, site, tag, urltype=None):
# -- URL matcher --------------------------------------------------------------
URL_TRANSFORM = {
"file": _file_url,
"gsiftp": _gsiftp_url,
}
def _get_latest_segment(seglist, duration):
"""Get segment for latest file of the given duration in a segment list
......@@ -303,15 +308,18 @@ def _find_urls(
gps += cdur
# convert paths to URLs for various schemes
urltypes = set(URL_TRANSFORM.keys())
if urltype:
urltypes &= {urltype}
allurls = {}
for lfn in lfns:
allurls[lfn] = []
for path in lfns[lfn]:
# build file:// and gsiftp:// URL for each LFN
allurls[lfn].extend((
_file_url(path),
_gsiftp_url(path),
))
# build URL for each urltype
allurls[lfn].extend(
URL_TRANSFORM[_urlt](path)
for _urlt in sorted(urltypes)
)
# filter URLs for each LFN and return
urls = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment