Player APIs (BrightScript & Ja...
...
Hashing and Storage Objects
roBrightPackage
7 min
an robrightpackage object represents a zip file, which can include arbitrary content or be installed on a storage device to provide content and script updates (for example, to distribute updates via usb thumb drives) the javascript equivalent is the node js zlib api object creation the robrightpackage object is created with a filename parameter that specifies the name of the zip file createobject("robrightpackage", filename as string) limitations the robrightpackage object supports zip files that are smaller than 4gb only supported technologies deflate32 (with default options) ppmd (with default options) winzip (with "no compression", "maximum", and "superfast" options; other options, including "enhanced deflate", are not supported) aes encryption unsupported technologies bzip2 lzma deflate64 zip64 (i e the compression software built in to windows explorer) ifbrightpackage ifbrightpackage is a legacy interface we recommend you use roassetpool instead to achieve better functionality unpack(path as string) as void extracts the zip file to the specified destination path any preexisting files in the target directory will be deleted as part of this operation providing a destination path of "sd /" will wipe all preexisting files from the card and extract the zip contents to the root folder setpassword(password as string) as void provides the password specified when the zip file was created this method supports aes 128 and 256 bit encryption, as generated by winzip the method returns false if the operation fails getfailurereason() as string unpackfile(a as string, b as string) as boolean this method takes two parameters, filename and path the filename is the name of the file to unpack and path is the location to which the file will be unpacked the method returns false if the unpack operation fails example package = createobject("robrightpackage", "myfile zip") setpassok = package setpassword("test") if not setpassok then print "failed to set password "; package getfailurereason() stop end if unpackeddir$ = "sd /unpacked" deletedirectory(unpackeddir$) dirok = createdirectory(unpackeddir$) if not dirok then print "failed to create directory "; unpackeddir$ stop end if ' unpack a specific file from the root of myfile zip ok = package unpackfile("index html", unpackeddir$) if not ok then print "failed to unpack file "; package getfailurereason() stop end if print "file unpacked successfully " using robrightpackage for content updates brightsign players check storage devices for autorun scripts in the following order external usb devices 1 through 9 sd µsd in addition to looking for autorun brs scripts, brightsign players look for autorun zip files that contain the script name autozip brs if an autorun zip file with an autozip brs file is found, and autozip brs can be decrypted, then the player will execute the autozip brs file the autozip brs file cannot reference any external files, as it is the only file to be automatically uncompressed by a brightsign player prior to execution the autozip brs script should unpack the contents of the autorun zip file to an installed storage device and reboot to complete the update example package = createobject("robrightpackage", "sd /autorun zip") package unpack("sd /") movefile("sd /autorun zip", "sd /autorun zip invalid") rebootsystem() unpacking encrypted archives if the autorun zip file is encrypted, then the player uses the password stored in the roregistry docid\ ytpsfntswyfmxx8pcqjlf , in the section "security" under the name "autozipkey," to decrypt the file extended example ' content update application r=createobject("rorectangle", 20, 668, 1240, 80) t=createobject("rotextwidget",r,1,2,1) r=createobject("rorectangle", 20, 20, 1200, 40) t setsafetextregion(r) t setforegroundcolor(\&hff303030) t setbackgroundcolor(\&hffffffff) t pushstring("updating content from usb drive, please wait ") package = createobject("robrightpackage", "autorun zip") package setpassword("test") package unpack("sd /") package = 0 t clear() t pushstring("update complete remove usb drive to restart ") while true sleep(1000) usb key = createobject("roreadfile", "usb1 /autorun zip") if type(usb key) <> "roreadfile" then a=rebootsystem() endif usb key = 0 end while