dratio
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2014
10:59 AM
Trouble setting theme attributes from a URL.
I am trying to set the asset for an overhang slice like so:
app.setThemeAttribute("GridScreenOverhangSliceHD", overhangSlice)
where overhangSlice is a URL to a web hosted image. The image will not actually display with any consistency. Any idea why this would be? Thanks
app.setThemeAttribute("GridScreenOverhangSliceHD", overhangSlice)
where overhangSlice is a URL to a web hosted image. The image will not actually display with any consistency. Any idea why this would be? Thanks
22 REPLIES 22
RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2014
11:54 AM
Re: Trouble setting theme attributes from a URL.
Since you say "with any consistency" I'm going to assume that it is working some of the time.
After you set the them, put in a sleep(500) and see if that helps.
Officially themes don't support loading over the internet, so technically this is unsupported.
- Joel
After you set the them, put in a sleep(500) and see if that helps.
Officially themes don't support loading over the internet, so technically this is unsupported.
- Joel
TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2014
01:16 PM
Re: Trouble setting theme attributes from a URL.
You'd probably be better off downloading the images to tmp:, and using the tmp: path in your theme.
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)
dratio
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014
08:01 AM
Re: Trouble setting theme attributes from a URL.
Thanks a bunch for the replies, I will try putting a sleep on it. It's the oddest thing though, I am able to set certain images anywhere, but then attempting to set the same item with different images the images do not display. I print out the url of each image to ensure that it is being addressed correctly to the object which will be displaying the image, even when the url is correct, only certain images are able to be displayed. In the even that sleep doesn't work, what's the easiest way to download the images to tmp? Is there a method to call?
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014
12:20 PM
Re: Trouble setting theme attributes from a URL.
"dratio" wrote:
Thanks a bunch for the replies, I will try putting a sleep on it. It's the oddest thing though, I am able to set certain images anywhere, but then attempting to set the same item with different images the images do not display. I print out the url of each image to ensure that it is being addressed correctly to the object which will be displaying the image, even when the url is correct, only certain images are able to be displayed. In the even that sleep doesn't work, what's the easiest way to download the images to tmp? Is there a method to call?
The easiest way to download an image to a tmp file is probably using an roUrlTransfer object with method GetToFile:
tmpFile = "tmp:/image.jpg"
ut = CreateObject ("roUrlTransfer")
ut.SetUrl ("... image url ...")
responseCode = ut.GetToFile (tmpFile)
If responseCode = 200
' Success
Else
' Failed
Endif
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014
04:45 PM
Re: Trouble setting theme attributes from a URL.
"dratio" wrote:
It's the oddest thing though, I am able to set certain images anywhere, but then attempting to set the same item with different images the images do not display.
Are you setting the attribute before displaying the component for the first time - or if already shown, are you calling .show() (or equivalent) to refresh it? I don't think that changes to the global theme affect like magic already rendered component - or at least it's YMMV.
dratio
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014
10:22 AM
Re: Trouble setting theme attributes from a URL.
If you don't mind looking, here is part of the function where the problem exists. I am passing in an object that contains parsed XML (aboutOptions), the problem is with SmallIconUrl. If I set it to aboutOptions.background, it displays the image, however, anything else that I try to set it to does not work. I've tried another attribute on the aboutOptions, or a direct url to an image...and I just tried setting it to tmpFile (displayed in the code), which I created using the snippet belltown provided. What am I doing wrong here? Thanks
tmpFile = CreateObject("roUrlTransfer")
tmpFile.SetUrl(aboutOptions.logo)
tmpFile.GetToFile("tmp:/about_small.png")
o.SDSmallIconUrl = tmpFile
o.HDSmallIconUrl = tmpFile
o.HDBackgroundImageUrl = aboutOptions.background
o.SDBackgroundImageUrl = aboutOptions.background
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014
10:27 AM
Re: Trouble setting theme attributes from a URL.
Try this:
tmpfile = "tmp:/about_small.png"
urlTransferObject = CreateObject("roUrlTransfer")
urlTransferObject.SetUrl(aboutOptions.logo)
urlTransferObject.GetToFile(tmpfile)
o.SDSmallIconUrl = tmpFile
o.HDSmallIconUrl = tmpFile
o.HDBackgroundImageUrl = aboutOptions.background
o.SDBackgroundImageUrl = aboutOptions.background
dratio
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014
02:23 PM
Re: Trouble setting theme attributes from a URL.
I've attempted that as well and it is not working. I'm not sure what the deal is. It really just does not want to let me set a remote image on that item.
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014
02:37 PM
Re: Trouble setting theme attributes from a URL.
Did you remember to call SetContent () on your list object after setting these images?