Your Digital Media Has Never Looked So Good

Topic Author
Posts: 14
Joined: Mon Jan 18, 2016 7:41 pm

Downloading images to tmp

Mon Nov 27, 2017 11:25 pm

To reduce latency, I'm looking to pre-cache images used in a Poster node. 
When trying to write to tmp:/ it shows the filename with a ".tmp" extension and then disappears. I assume this means the file is not downloading properly..  Any idea what the issue could be?

From my screen: (this loops every 5 seconds with a new URL)

m.downloadTask = createObject("roSGNode", "urlgrabber")
m.downloadTask.contenturi = url
m.downloadTask.control = "RUN"

From my download Task:

mypath = CreateObject("roPath",
fileObj = myPath.Split()

print "DOWNLOADING: ";
UT = createObject("roUrlTransfer")
UT.AsyncGetToFile( "tmp:/" + fileObj.filename )

fs = CreateObject("roFileSystem")
fslist = fs.GetDirectoryListing("tmp:/")
print fs.Stat("tmp:/" + fileObj.filename + ".tmp")
print "FILESYSTEM: "; fslist

All i ever get it the following:


<Component: roAssociativeArray> =
    ctime: <Component: roDateTime>
    hidden: false
    mtime: <Component: roDateTime>
    permissions: "rw"
    size: 0
    type: "file"
FILSYSTEM: <Component: roList> =

User avatar
Posts: 306
Joined: Fri Mar 31, 2017 2:22 pm

Re: Downloading images to tmp

Tue Nov 28, 2017 7:17 pm

You are doing AsyncGetToFile()... why?
Try a simple GetToFile and that will likely solve your issue.
(Speculation: you start async download but then your thread promptly completes, roUrlTranfer object gets disposed of - and the linked transfer is canceled. The thread will have to hang around checking for events from async xfer - or you can just use the synchronous method, that blocks till xfer is complete)
Topic Author
Posts: 14
Joined: Mon Jan 18, 2016 7:41 pm

Re: Downloading images to tmp

Tue Nov 28, 2017 11:06 pm

I was having issues with GetToFile() as well. I did the AsyncGetToFile as I was thinking this would move the download to the background vs. having to wait. Is this not the correct thinking?
Figured out I was missing:  msg = wait(0, port).  Once I added this, the download was successful.

This all seems really messy to cache some images vs what "roSlideShow" used to do. I think it cached 5-6 images in advance.  I'm I going about this wrong, or is there a better, more obvious way?

Thanks for the help.

Who is online

Users browsing this forum: No registered users and 4 guests