Your Digital Media Has Never Looked So Good

Topic Author
Posts: 51
Joined: Thu May 21, 2009 8:06 am

HTTP GET to Retrieve and Save Content locally...

Fri Oct 23, 2009 7:58 am



Using HTTP GET, via script, how do you store images locally on the Brightsign's USB Jump Drive to recall, via script, at a latter time.



Fri Oct 23, 2009 8:47 am

The object reference guide covers how the roURLTransfer object works. This is what you would use for doing file downloads.

You can use the GetToFile or AsyncGetToFile command to download a file.

For a script like you describe, you would need to write a custom script.

REM sample code
REM This creates the transfer object, and sets the location of the files

file_downloaded = false
imageplayer = CreateObject("roImagePlayer")
tempURL = ""
xfer = CreateObject("roUrlTransfer")
xfer.SetUrl (tempURL)

REM To download a file, you need to specify the file you want to grab
REM and the file you want the unit to write it to.

filename = "image1.jpg"
xfer.SetURL(tempURL + filename)

REM Now, the URL we're going to grab is:
REM ""

ok = xfer.GetToFile(filename)
if ok = 200 then
file_downloaded = true
print "file downloaded successfully"

REM GetToFile returns 200 if it was able to successfully download the file.

if file_downloaded then
print "No Image Downloaded."

REM infinite loop at end of script
while true
end while

This code downloads one image, and if that image downloads successfully, it plays it.
Topic Author
Posts: 51
Joined: Thu May 21, 2009 8:06 am

How do you store the file locally to USB Drive?

Fri Oct 23, 2009 9:07 am

How do you store the file locally to USB Drive?

Fri Oct 23, 2009 9:09 am

If all you have connected is the USB drive, then that's where this will be stored.
Posts: 8
Joined: Tue Jan 19, 2010 3:50 am
Location: Malaga. Spain

HTTP GET to Retrieve and Save Content locally...

Tue Jan 19, 2010 3:57 am

Hi! This is Alvaro from Spain.

I've tried the "GetToFile" method and it works question is:
Is there a way to retrieve files from the HD1010 remotely?

Thanks in advance,

Tue Jan 19, 2010 10:47 am


Not currently.
Posts: 44
Joined: Wed Nov 04, 2009 2:28 pm
Location: Des Moines, Iowa

Thu Feb 04, 2010 2:33 pm

Rather than opening a new subject line, my question is related enough that I'll tack it on here.

I have a project that will need to gather some data into a text file from a touchscreen with embedded controller that includes a web server that allows access to a file storage area. That controller will also be controlling content to be played back on a separate monitor from a Brightsign HD1010, either through network or serial control.

My question is twofold:

Is it feasible to use the technique described in this thread to grab the text files from the web server, store them on a removable USB drive while still playing content from the SD card?

Assuming that is possible, do I need to completely write my own interactive script to handle both the file grabbing AND the control of playback from the CF card? Or can I use standard authoring procedures to handle the playback functions?



Thu Feb 04, 2010 3:15 pm

Yes, you can use this method to grab a text file. It might be easier to write a script to do this than trying to add this functionality to the existing autorun.

There are built-in text manipulation funtions. So, you can grab it, then read the file into the script, and then process it line by line. If you explain a little more about how this will work, I'll check for sample code.
Posts: 44
Joined: Wed Nov 04, 2009 2:28 pm
Location: Des Moines, Iowa

Thu Feb 04, 2010 3:38 pm

I don't need the Brightsign to act on the text file other than retrieving it from the web host device and putting it on the removable USB drive. So again, the two issues are:

1. Having this removable storage at the same time content plays from the SD card

2. Having the retrieve and storage process independent of the interactive control script.

There is one other possible need which would be to also have the HD1010 update itself from a different web server. I don't know that this would be needed and it wouldn't kill the project if it wasn't possible.


Thu Feb 04, 2010 4:44 pm

Yes to 1 and 2.

You can do a gettofile that saves the file to the USB. The following would download the text file to the USB drive every 5 minutes. If you didn't want to overwrite it, you could generate the name each time through the loop.

p = createobject("roMessagePort")

REM create URL object, and set the URL of the file to grab
rssXfer2 = CreateObject("roUrlTransfer")

REM Download the text file
REM you can also do an AsyncGetToFile

if not ok then print "Unable to get file"

REM Set a timer for the next time to download file
REM In this case 5 minutes.

msg = wait(0,p)
if type(msg) = "roTimerEvent " then goto download_text_file
Posts: 44
Joined: Wed Nov 04, 2009 2:28 pm
Location: Des Moines, Iowa

Thu Feb 04, 2010 5:11 pm

Great! Thanks.

I have to admit that I haven't really dug into brs syntax that much and it is unclear to me whether any brs script completely supercedes the scripts that run from the firmware.

Maybe if my customers would quit bothering me with jobs, I could get some work done. :)


Thu Feb 04, 2010 5:48 pm

If you were to put a script named autorun.brs on the flash card, of the newer models, it overrides what's in memory.

But, the code sample I posted can be added into the autorun that's in memory. You can download and edit that autorun, and then place it on the flash card. It will override what's in memory.

Or, I have script you can use to put a new autorun in memory.

For example, the normal autorun already has a message port object it uses, and already has a function that waits for events.

So, we would need to add the url event, add the timer definition, set the message port object that's used already, and insert the code with the file download under the function that processes events. Both standard playlists(waitforbspevent) and internactive playlsts (waitforcsvevent) have a function that process all events.

It depends on how often you want to grab the file. WE could skip the timer altogether grab the file once through playlist or when a specific file is played. You can insert this behavior.
Posts: 44
Joined: Wed Nov 04, 2009 2:28 pm
Location: Des Moines, Iowa

Thu Feb 04, 2010 6:06 pm


That gives me enough to go on for the moment. This job is still speculative but I wanted to make sure the concept could be pulled off before defining the rest of the hardware in the system. I'm trying to avoid having a Windows based computer in a system that will travel to different sites, have varying connectivity and be subject to getting bounced around in transit. If I can do everything with embedded controller's, I'm a lot more confident that will be running 3 or 6 months down the road.


Who is online

Users browsing this forum: No registered users and 3 guests