opentimelineio.url_utils
Utilities for conversion between URLs and file paths.
- opentimelineio.url_utils.filepath_from_url(urlstr)
Take a URL and return a filepath.
Handles URLs encoded per RFC 3986, Windows drive letters (
file://C:/...), UNC paths (file://host/share/...), and thefile://localhost/...variant.Returns the input unchanged if it cannot be converted.
- opentimelineio.url_utils.url_from_filepath(fpath)
Convert a filesystem path to a URL in a portable way.
- ensures that fpath conforms to the following pattern:
if it is an absolute path, “file:///path/to/thing”
if it is a relative path, “path/to/thing”
- In other words, if you pass in:
“/var/tmp/thing.otio” -> “file:///var/tmp/thing.otio”
“tmp/thing.otio” -> “tmp/thing.otio”