
squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
12:56 PM
URL Transfer
I'm grabbing a bunch of graphics when my channel loads. Is this the best way to do it or is there a more efficient or faster way?
thanks
thanks
Function GetAlbumArt()
AT = CreateObject("roUrlTransfer")
AT.SetUrl("http://www.xxxx.com/roku/url/albumcover_hd.png")
AT.GetToFile("tmp:/albumcover_hd.png")
AT2 = CreateObject("roUrlTransfer")
AT2.SetUrl("http://www.xxxx.com/roku/url/albumcover2_hd.png")
AT2.GetToFile("tmp:/albumcover2_hd.png")
AT3 = CreateObject("roUrlTransfer")
AT3.SetUrl("http://www.xxxx.com/roku/url/albumcover3_hd.png")
AT3.GetToFile("tmp:/albumcover3_hd.png")
AT4 = CreateObject("roUrlTransfer")
AT4.SetUrl("http://www.xxxx.com/roku/url/albumcover4_hd.png")
AT4.GetToFile("tmp:/albumcover4_hd.png")
AT5 = CreateObject("roUrlTransfer")
AT5.SetUrl("http://www.xxxx.com/roku/url/screensaver.png")
AT5.GetToFile("tmp:/screensaver.png")
End Function
Kinetics Screensavers
7 REPLIES 7


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
01:04 PM
Re: URL Transfer
To improve launch time, you could...
FYI: When you do a series of downloads synchronously the way you are now, there's no need to create a new roURLTansfer for each one. That won't speed things up much, but calls to CreateObject() are fairly expensive.
- Wait to download each image until you need it rather than doing them all at launch
- Download them all at the same time asynchronously rather than waiting for one to finish before starting the next. http://sdkdocs.roku.com/display/sdkdoc/ ... gasBoolean
FYI: When you do a series of downloads synchronously the way you are now, there's no need to create a new roURLTansfer for each one. That won't speed things up much, but calls to CreateObject() are fairly expensive.

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
01:09 PM
Re: URL Transfer
Thanks Chris, thats the feedback i was looking for.
Kinetics Screensavers

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
01:31 PM
Re: URL Transfer
Ok so whats the format for doing multiple downloads with the same transfer object? The function below gets the first graphic but not the second.
I tried it with commas in between setURL( x,x,x) but no-go.
AT = CreateObject("roUrlTransfer")
aport = CreateObject("roMessagePort")
AT.setmessageport(aport)
AT.SetUrl("http://www.xxxx.com/roku/url/albumcover_hd.png")
AT.AsyncGetToFile("tmp:/albumcover_hd.png")
AT.SetUrl("http://www.xxxx.com/roku/url/albumcover2_hd.png")
AT.AsyncGetToFile("tmp:/albumcover2_hd.png")
I tried it with commas in between setURL( x,x,x) but no-go.
Kinetics Screensavers

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
01:42 PM
Re: URL Transfer
"squirreltown" wrote:
Ok so whats the format for doing multiple downloads with the same transfer object? The function below gets the first graphic but not the second.AT = CreateObject("roUrlTransfer")
aport = CreateObject("roMessagePort")
AT.setmessageport(aport)
AT.SetUrl("http://www.xxxx.com/roku/url/albumcover_hd.png")
AT.AsyncGetToFile("tmp:/albumcover_hd.png")
AT.SetUrl("http://www.xxxx.com/roku/url/albumcover2_hd.png")
AT.AsyncGetToFile("tmp:/albumcover2_hd.png")
I tried it with commas in between setURL( x,x,x) but no-go.
For asynchronous, you need to create new components for each like you were in your original. For synchronous, you can reuse the same component, because the call will block until the download completes.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
01:48 PM
Re: URL Transfer
Thanks TheEndless, So I suppose Async is still preferred, even with separate transfer objects since it doesn't prevent anything else from happening?
Kinetics Screensavers


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2013
02:11 PM
Re: URL Transfer
"squirreltown" wrote:
Thanks TheEndless, So I suppose Async is still preferred, even with separate transfer objects since it doesn't prevent anything else from happening?
Yes, making the requests asynchronous will save much more time than you will incur by creating the additional objects.

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2013
12:38 PM
Re: URL Transfer
If you want to keep track of which transfer is associated with which object, you can use the ifURLTransfer.GetIdentity() and ifURLEvent.GetSourceIdentity() to track the status of each request.
- Joel
- Joel