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: 

MRSS and Thumbnail Images

First time poster, but have used the forums to learn quite a bit so far.. Thanks for sharing!

I started with the MRSS template, and have everything working pretty well except for thumbnails. It's just using the image from the config, not the one specific in the rss feed. Any tips?

Here's the code included with the template:

' thumbnail
tmp = item.GetNamedElements("media:thumbnail")
if tmp.Count() > 0
newItem.sdPosterURL = ValidStr(tmp[0]@url)
newItem.hdPosterURL = ValidStr(tmp[0]@url)
else if xml.channel.image.url.Count() > 0
newItem.sdPosterURL = ValidStr(xml.channel.image.url.GetText())
newItem.hdPosterURL = ValidStr(xml.channel.image.url.GetText())
end if


Here's a sample from my rss feed:

<item>
<title>File 1</title>
<link>http://test.com</link>
<description>This is a great episode.</description>
<pubDate>Sun, 02 Jun 2013 11:00:00 -0000</pubDate>
<guid isPermaLink="false">UIj8YptI</guid>
<enclosure url="http://content.bitsontherun.com/videos/UIj8YptI-EAJYb5n4.mp4" length="1006319379" type="video/mp4" />
<itunes:author>HCC</itunes:author>
<itunes:duration>3763</itunes:duration>
<itunes:keywords>Test</itunes:keywords>
<media:content url="http://content.bitsontherun.com/videos/UIj8YptI-EAJYb5n4.mp4" type="video/mp4" duration="3763.90" fileSize="1006319379">
<media:thumbnail url="http://content.bitsontherun.com/thumbs/UIj8YptI-720.jpg" />
<media:credit>HCC</media:credit>
<media:player url="http://test.com/message/part-1-on-becoming-wise/" />
<media:keywords>Test</media:keywords>
</media:content>
</item>
0 Kudos
7 REPLIES 7

Re: MRSS and Thumbnail Images

I made a change to the config for where the image comes from for that outline, but the graphics within the feed did not change. So I thought about it a little more, and it appears that each item is using the graphic from the itunes 'channel' metadata. Shouldn't it be using the thumbnail from each individual item, and not from the one here?

<channel>
<title>HCC</title>
<link>http://test.com</link>
<description>Testing</description>
<image>
<url>http://content.bitsontherun.com/thumbs/ktUszevN-120.jpg</url>
<title>HCC HD</title>
<link>http://www.test.com</link>
</image>
<itunes:author>HCC</itunes:author>
<itunes:keywords>Messages</itunes:keywords>
<itunes:image href="http://content.bitsontherun.com/thumbs/ktUszevN.jpg" />
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: MRSS and Thumbnail Images

"erik.mitchell" wrote:
it appears that each item is using the graphic from the itunes 'channel' metadata. Shouldn't it be using the thumbnail from each individual item, and not from the one here?


If you look at the thumbnail parsing logic you posted, it first checks for a media:thumbnail element subordinate to the item element. If it doesn't find one, it checks for a channel.image.url element and uses that if it exists. That's the behavior you're seeing.

Your media:thumbnail elements are subordinate to a media:content element, which your parsing logic is not looking for. You can modify the parsing logic to look one level deeper for the thumbnail or you could move the thumbnail element up a level in your MRSS. Either should fix your issue.
0 Kudos

Re: MRSS and Thumbnail Images

That makes total sense. I didn't even pay attention to it being under content.

I've tried looking around the forum, and unless I'm using the wrong search terms, can't find an explanation for how to parse deeper.. Tried a few things I made up, they didn't work..

Thank you!
0 Kudos

Re: MRSS and Thumbnail Images

Any tips on parsing the multilevel nest 1 level down?
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: MRSS and Thumbnail Images

Yahoo seems to have (re)moved the MRSS spec, so I can't link to it from here. If memory serves, the spec allows for an item to have multiple media:content elements and each of those may have multiple media:thumbnail elements. So you need a couple loops to step through them all and maybe some additional logic to decide which to use if you find more than one.

This is untested from memory, so you may have to tweak it here and there to get the desired result.

for each item in rss.channel.item ' stepping through items within the MRSS
mediaContents = item.GetNamedElements("media:content")
for each mediaContent in mediaContents ' stepping through media:content within an item
mediaThumbnails = mediaContent.GetNamedElements("media:thumbnail")
for each mediaThmbnail in mediaThumbnails ' stepping through media:thumbnail within a media:content
? "found thumbnail: " + mediaThumbnail@url
next
next
next
0 Kudos

Re: MRSS and Thumbnail Images

Thanks for the tip. Here's where I ended up, in case anyone else has the same issue..

It's a little slow to load the images, but it's doing some scaling down from the original image size, so maybe i'll come back to that. Just happy to have it working.

		' thumbnail
mediaContentList = item.GetNamedElements ("media:content")
tmp = mediaContentList [0].GetNamedElements("media:thumbnail")
if tmp.Count() > 0
newItem.sdPosterURL = ValidStr(tmp[0]@url)
newItem.hdPosterURL = ValidStr(tmp[0]@url)
else if xml.channel.image.url.Count() > 0
newItem.sdPosterURL = ValidStr(xml.channel.image.url.GetText())
newItem.hdPosterURL = ValidStr(xml.channel.image.url.GetText())
end if
0 Kudos

Re: MRSS and Thumbnail Images

The reason why the Yahoo! MediaRSS page is dead is because MediaRSS has been transferred to the RSS Board where the specs are at: http://www.rssboard.org/media-rss
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.