Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dratio
Visitor

Re: Trouble setting theme attributes from a URL.

I'm setting the object ("o" in this case) with those values in a separate function and having it return the object and calling screen.SetContent(o) where screen is the roListScreen object.
0 Kudos
belltown
Roku Guru

Re: Trouble setting theme attributes from a URL.

You could also try examining the GetToFile response code just to make sure the icon file is being read from the url you specified:


responseCode = urlTransferObject.GetToFile(tmpfile)
print responseCode


It should be 200 for a successful response.
0 Kudos
EnTerr
Roku Guru

Re: Trouble setting theme attributes from a URL.

"dratio" wrote:
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.

Wait a minute, you are all over the map!
The topic was about theme attributes, now you are talking about HdBackgroundImageUrl and HdSmallIconUrl of roListScreen - which are not theme-related. Choose one issue and focus on it until resolved - then post separate question on another one.

I have used roListScreen and can tell you those things work fine with remote images, WITHOUT having to download locally.

PS. Meta-dating is finicky. For example your posted code, you are setting o.SDSmallIconUrl to a roUrlTransfer object, which is wrongedy wrong - but the component won't tell you that, instead will quietly* pretend it was set to invalid. You can only put STRINGS in those attributes that expect URL, that is - a text starting with "http://", "tmp:/" etc

(*) setting attribute to a wrong data TYPE should be a runtime error (vs say a warning if metadata item did not load from URL) - but it isn't (yet?)
0 Kudos
dratio
Visitor

Re: Trouble setting theme attributes from a URL.

"EnTerr" wrote:

The topic was about theme attributes, now you are talking about HdBackgroundImageUrl and HdSmallIconUrl of roListScreen - which are not theme-related. Choose one issue and focus on it until resolved - then post separate question on another one.


yeah, you're right. I was talking about setting images on the roListScreen, which isn't a part of a theme, I just associated with the theme because it is set similarly to the way the theme is set.

I recognize that I was setting it to the roUrlTransfer object, and I should have been setting it to the path. However, correcting that still did not work. The thing that I'm not understanding is that I am able to set certain images from a URL, but others I am not and it appears that there is no rhyme or reason for it.
0 Kudos
dratio
Visitor

Re: Trouble setting theme attributes from a URL.

"belltown" wrote:
You could also try examining the GetToFile response code just to make sure the icon file is being read from the url you specified:


responseCode = urlTransferObject.GetToFile(tmpfile)
print responseCode


It should be 200 for a successful response.


I do have it in an if statement that checks if the response code is 200 before assignment, I just put in the relevant code so that it wasn't a massive snippet of code when there were only a couple of lines that matter. I'm pretty baffled as to why it won't work.
0 Kudos
RokuMarkn
Visitor

Re: Trouble setting theme attributes from a URL.

Perhaps the images that don't work are incompatible in some way. Is it always the same files that work and don't work? Can you package one of the non-working images in your app package and see if you can display it from a pkg:// path?

--Mark
0 Kudos
dratio
Visitor

Re: Trouble setting theme attributes from a URL.

"RokuMarkn" wrote:
Perhaps the images that don't work are incompatible in some way. Is it always the same files that work and don't work? Can you package one of the non-working images in your app package and see if you can display it from a pkg:// path?

--Mark


I have put the images in the pkg and calling them from there they display with no problem. It's not always the same files, I have replaced the images I am trying to display from a server with other images, other formats, etc. to no avail. They will not display if they are being called from a URL.
0 Kudos
dratio
Visitor

Re: Trouble setting theme attributes from a URL.

I've also just now noticed something else that is weird... I have assigned the same web-based image to both HDBackgroundImageUrl and HDSmallIconUrl and their SD counterparts, and lo and behold it displays on HDSmallIconUrl! So, when the same web-based image is displayed in both HDBackgroundImageUrl and HDSmallIconUrl, all is well. However, if a different web-based image is assigned to HDSmallIconUrl, it will not display.
To clarify, when I run this it works fine:

'aboutOptions is an XML object containing URLs to images
o.SDSmallIconUrl = aboutOptions.thumbnail
o.HDSmallIconUrl = aboutOptions.thumbnail
o.ShortDescriptionLine1 = aboutOptions.description
o.ShortDescriptionLine2 = aboutOptions.copyright
o.HDBackgroundImageUrl = aboutOptions.thumbnail
o.SDBackgroundImageUrl = aboutOptions.thumbnail

and when I run this, the image will not display for HDSmallIconUrl:

'aboutOptions is an XML object containing URLs to images
o.SDSmallIconUrl = aboutOptions.thumbnail
o.HDSmallIconUrl = aboutOptions.thumbnail
o.ShortDescriptionLine1 = aboutOptions.description
o.ShortDescriptionLine2 = aboutOptions.copyright
o.HDBackgroundImageUrl = aboutOptions.background
o.SDBackgroundImageUrl = aboutOptions.background
0 Kudos
TheEndless
Channel Surfer

Re: Trouble setting theme attributes from a URL.

Do the icons display if you highlight the item then un-highlight it? It sounds like it's just not downloading fast enough.
Either way, my recommendation would still be to download it to tmp: first.
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)
0 Kudos
belltown
Roku Guru

Re: Trouble setting theme attributes from a URL.

I agree with TheEndless. I think your best bet is to read the image url into a tmp: file first, making sure that if you're displaying more than one image on a screen then they're each downloaded to a separate tmp: file.

I suggested that earlier and the your first attempt at coding that was flawed. You haven't showed us the code that supposedly worked (and checked the http response code), so it's possible that code may have been flawed too. Showing us the actual code you're using would be helpful.

It would also help if you could post a link to one of the image urls that doesn't appear to be working.

Another question: are any of the image urls, "https" urls, or could possibly be redirecting to "https" urls?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.