UrlSynchronization

Inherits ResourceSynchronization

Members

Name

Documentation

Type

Description

Optional

Identifier

This identifier will be part of the used folder structure and, can be used to manually find the downloaded folder in the synchronization folder.

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Url

The URL or urls from where the files are downloaded. If multiple URLs are provided, all files will be downloaded to the same directory and the filename parameter must not be specified simultaneously.

String, or Table

Value of type ‘String’, or Value of type ‘Table’

No

Filename

Optional to provide filename to override the one which is otherwise automatically created from the url. If this value is specified, and the URL parameter contains more than one file, each file will be stored with a prefix of -{i} where i is the zero-based position of the file in the URL array.

String

Value of type ‘String’

Yes

Override

Deprecated, use SecondsUntilResync instead.

Boolean

Value of type ‘Boolean’

Yes

SecondsUntilResync

This variable determines the validity period of a file(s) in seconds before it needs to be re-downloaded. The default value keeps the file permanently cached, while a value of 0 forces the file to be downloaded on every startup. If the symbolic value math.huge is used, a file is never redownloaded after the first time.

Double

Greater or equal to: 0

Yes

UseHash

If this value is set to ‘true’ (the default), the hash of the URL is appended to the directory name to produce a unique directory under all circumstances. If this is not desired, the URLSynchronization use the bare directory name alone if this value is ‘false’. If this value is ‘false’, the identifier has to be specified.

Boolean

Value of type ‘Boolean’

Yes

Asset Examples

 1-- Basic
 2-- Creates a 3D sphere with a video texture mapped onto its surface.
 3
 4-- The video file is here downloaded from a URL. This code returns the path to a folder
 5-- where the file is stored after download
 6local data = asset.resource({
 7  Name = "Example Video",
 8  Type = "UrlSynchronization",
 9  Identifier = "example_video",
10  Url = "https://liu-se.cdn.openspaceproject.com/files/examples/video/chlorophyll_model_2048.mp4"
11})
12
13-- For a local file, use "asset.resource("path/to/local/video.mp4")" here instead
14local video = data .. "chlorophyll_model_2048.mp4"
15
16local Node = {
17  Identifier = "RenderableVideoSphere_Example",
18  Renderable = {
19    Type = "RenderableVideoSphere",
20    Video = video
21  },
22  GUI = {
23    Name = "RenderableVideoSphere - Basic",
24    Path = "/Examples"
25  }
26}
27
28
29asset.onInitialize(function()
30  openspace.addSceneGraphNode(Node)
31end)
32
33asset.onDeinitialize(function()
34  openspace.removeSceneGraphNode(Node)
35end)