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: 
stevelaw18
Visitor

SDPosterUrl - Not Displaying Valid Image Path

I'm parsing some XML. The XML contains an element containing text for a path to an image (e.g. http://path/something.jpg).

<somexml>
<images>
<small>http://path/something.jpg</small>
</images>
</somexml>


I'm correctly parsing the image path from the xml like so:

image = event.images.small.gettext()


I verified this by printing out the value of "image".

When I set the value of SDPosterUrl to image, the the image does not display:

Doesn't work:
eventObj.SDPosterUrl = image


But if I set SDPosterUrl to the value printed out, then the image displays.

Works:
eventObj.SDPosterUrl = "http://path/something.jpg"


What am I missing?
0 Kudos
7 REPLIES 7
bandal
Visitor

Re: SDPosterUrl - Not Displaying Valid Image Path

Maybe I am wrong, but the double quotes need to be removed to get to that path and image.
0 Kudos
destruk
Streaming Star

Re: SDPosterUrl - Not Displaying Valid Image Path

Without more accurate information for your script, it will be difficult to get you the answer you are looking for. My guess...
If you are parsing the xml with a loop, most likely your event.images.small.gettext() is looking at the wrong key as "event" probably doesn't exist within the item tags.
If you are typing "image = event.images.small.gettext()" from outside the loop, in the main entry for the xml then it is pulling the data you want.

When the image fails with your prefere/original way of accessing the image, what shows up when you try printing the sdposterurl value?
0 Kudos
stevelaw18
Visitor

Re: SDPosterUrl - Not Displaying Valid Image Path

Here is the function that I am using to retrieve the XML via HTTP, parsing the XML, and creating a list of objects. The XML parsing is NOT the issue here, as I am printing out all the correct values.

The issue has something to do with setting SDPosterUrl to the image path parsed from the XML. If I print out the image values, and set SDPosterUrl to one of those values, then the image displays, which does not make sense to me. The parsed image path is a String type, just like when I set SDPosterUrl to a literal string value.

I do not receive any bad path errors or anything, the screen just displays loading for the image. It just doesn't make any sense to me.

Function getShowsForCategoryItem(category As Object) As Object
print "getting shows for category "; category

url = "http://somePath?channel=" + category + "&type=live&format=xml"

http = CreateObject("roUrlTransfer")
http.SetUrl(url)

data = http.GetToString()

xml=CreateObject("roXMLElement")
xml.Parse(data)

events = xml.events.event

Dim list[20]
for each event in events
eventObj = CreateObject("roAssociativeArray")
eventObj.ShortDescriptionLine1 = event.startTime.gettext()
eventObj.ShortDescriptionLine2 = event.showName.gettext()

stream = CreateObject("roAssociativeArray")
stream.url = event.videoURL.gettext()
stream.quality = "SD"

image = event.images.small.gettext()
print(image)

eventObj.SDPosterUrl = image

eventObj.Stream = stream

list.Push(eventObj)
end for

return list
End Function
0 Kudos
destruk
Streaming Star

Re: SDPosterUrl - Not Displaying Valid Image Path

I don't know then.
0 Kudos
gonzotek
Visitor

Re: SDPosterUrl - Not Displaying Valid Image Path

Any special characters in the path? Ampersands or brackets, or maybe accented characters that aren't being encoded or interpreted correctly?
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com
0 Kudos
RokuJoel
Binge Watcher

Re: SDPosterUrl - Not Displaying Valid Image Path

First of all, try:

?image
?type(image)

?image="http://path/something.jpg"

to see what the differences are between the value of the variable image and the value you think you are getting.

clearly the value of image isn't the correct value for the path, so take a look at the actual value, compare it to the path that you are expecting, then figure out why it is different.

Also, the assumption that has been made so far in this thread is that by path, you mean servername. If by path you mean actual path to a local image resource, the syntax is different:

image="pkg:/images/something.jpg" would be a good local path or image="tmp:/something.jpg"

http paths are only for connecting to an external server via http protocol.

- Joel
0 Kudos
stevelaw18
Visitor

Re: SDPosterUrl - Not Displaying Valid Image Path

Turns out the image name ended with the following 3 invisible characters, which was causing the issue:

LF TAB TAB
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.