taylorcw
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2017
10:25 PM
Downloading images to tmp
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)
From my download Task:
All i ever get it the following:
Thanks!
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", m.top.contenturi)
fileObj = myPath.Split()
print "DOWNLOADING: "; m.top.contenturi
UT = createObject("roUrlTransfer")
port=CreateObject("roMessagePort")
UT.SetPort(port)
UT.setUrl(m.top.contenturi)
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:
DOWNLOADING: https://lh3.googleusercontent.com/-uAxkRqQIagw/WKOY5CA6xFI/AAAAAAAAGUE/9y4gUaP6OhEX7G2wvT_oMHu2wFKJYiPbACHMYBhgL/s1280/stock-coral-reef-fish-egypt.jpg
<Component: roAssociativeArray> =
{
ctime: <Component: roDateTime>
hidden: false
mtime: <Component: roDateTime>
permissions: "rw"
size: 0
type: "file"
}
FILSYSTEM: <Component: roList> =
(
"stock-coral-reef-fish-egypt.jpg.tmp"
)
Thanks!
2 REPLIES 2
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017
06:17 PM
Re: Downloading images to tmp
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)
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)
taylorcw
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017
10:06 PM
Re: Downloading images to tmp
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.
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.