Player APIs (BrightScript & Ja...
...
Object Reference
Content Management Objects
roAssetCollection
6min
this object is used to represent a collection of assets object creation the roassetcollection object is created with no parameters createobject("roassetcollection") you can populate an asset collection with individual calls to addasset() or addassets() you can also populate an asset collection using the rosyncspec getassets() method, as shown below assetcollection = createobject("roassetcollection") localcurrentsync = createobject("rosyncspec") if localcurrentsync readfromfile("local sync xml") then 	assetcollection = localcurrentsync getassets("download") endif iffailurereason getfailurereason() as string returns additional information if a method fails ifassetcollection addasset(asset info as dynamic) as boolean adds a single asset from an associative array or json formatted string if the argument is a string, it should match the format used for a single asset in a json sync spec returns true to indicate success and false to indicate failure if false is returned more detailed information is available by calling the getfailurereason method addassets(asset info array as dynamic) as boolean adds multiple assets from an enumerable object (an rolist , roarray , or string containing a json formatted array) that contains compatible associative arrays returns true to indicate success and false to indicate failure if false is returned more detailed information is available by calling the getfailurereason method getassetlist() as rolist returns an rolist instance containing associative arrays of asset metadata this method is not efficient and is, therefore, recommended for debugging and diagnostic purposes only each associative array contains the following name string required the name of the asset for a file to be realized, it must have a valid filename (i e no slashes) link string required the download location of the asset size integer/string optional the size of the asset use a string if you want to specify a number that is too large to fit into an integer (this allows file sizes larger than 2 gb) hash string optional a string in the form of "hash algorithm\ hash" see the next table for available hash algorithms change hint string optional any string that will change in conjunction with the file contents this is not necessary if the link or hash is supplied and always changes auth inherit boolean optional indication of whether or not this asset uses roassetfetcher authentication information the default is set to true auth user boolean optional user to utilize for authentication when downloading only this asset this automatically disables "auth inherit" auth password boolean optional password to use when downloading only this asset this automatically disables "auth inherit" headers inherit boolean optional the command to pass any header supplier to roassetfetcher when fetching this asset the default is true any "optional" fields that are specified when populating the pool must also be specified when retrieving assets from the pool (i e they become "mandatory" once they are used for an asset) for example, if the hash value is specified when fetching into the pool, then it must also be specified when attempting to refer to files in the pool hash algorithms sha1 if a sha1 is available, you can validate the hash as the file is downloaded if such a hash is available, it should be used the link and change hint properties have no effect on the pool file name, so the file is shared even if it is downloaded from different locations besha1 this algorithm hashes some of the file along with the file size in order to verify the contents it also moves the link and change hint properties into the pool filename md5 uses the md5 hash algorithm to validate files (none) without any hash, the file cannot be verified as it is downloaded, and the system will rely on the link and change hint properties to give the pool a unique filename