MLRss Plugin Photo Thumbnails

Repository of MainLobby Server plug-ins and updates not available in the current installation.
User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

MLRss Plugin Photo Thumbnails

Postby ronsatter » Fri Oct 03, 2008 4:48 pm

Hi gang,

I just noticed this new feature for Yahoo RSS news feeds:

"NEW: Photo thumbnails in Yahoo! News' RSS feeds! We're now offering thumbnails of related photos for stories in our RSS feeds, giving you an even richer news experience."

So I took a look at the MLRss variables from these feeds, and there is a reference to a jpg file embedded within the feed item description variables.

Example:

{{mlrss_feed_001_item_001_description}} contains this code:

<p><a href='http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20081003/ap_on_go_co/meltdown_tax_breaks'><img src='http://d.yimg.com/us.yimg.com/p/ap/20081002/capt.085c0b3530644486915008002f6c7f8d.congress_financial_meltdown_dclj110.jpg?x=130&y=86&q=85&sig=PXyOAeUwtiz4_UWX2gKSSA--' align='left' height='86' width='130' alt='Senate Majority Leader Sen. Harry Reid, D-Nev., center, with Senate Minority Leader Mitch McConnell, R-KY, right and Sen. Chris Dodd, D-Conn., left, Sen. Max Baucus, R-Mont., second from left, and Sen. Judd Gregg, R-N.H., speak at news conference on Capitol Hill in Washington, Wednesday, Oct. 1, 2008. Senators loaded the economic rescue bill with tax breaks and other sweeteners before passing it by a wide margin, 74-25, a month before the presidential and congressional elections.(AP Photo/Lawrence Jackson)' border='0' /></a>AP - Millions of taxpayers, thousands of businesses and groups as diverse as solar power developers and natural disaster victims will see tax relief with the House vote Friday to approve and send to the president a $700 billion financial rescue plan.</p><br clear='all'/>

The photo image thumbnail portion is:

http://d.yimg.com/us.yimg.com/p/ap/2008 ... clj110.jpg

When I paste this into a browser window it displays the image. Cool!

So far so good. It looks like each feed item has a similar format for the thumbnails and it could easily be parsed.

1. So how do I extract this snippet from the variable using MLStrings
2. Display it in ML (without using MLWebLobby)

This would add a nice visual to our RSS feeds scene.

Ron
If it ain't broke ... don't fix it!

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Fri Oct 03, 2008 9:54 pm

It ain't pretty but... it works. I'm sure there are some scriptors out there that can do a lot cleaner job.

Create a command map named something like YahooNewsImages and use the following:

Macro|
MLStrings|InStr~mlrss_feed_011_item_001_image~{{mlrss_feed_011_item_001_description}}~yimg!
MLMath|Subtract~mlrss_feed_011_item_001_imagestart~{{mlrss_feed_011_item_001_image}}~10!
MLStrings|InStr~mlrss_feed_011_item_001_image~{{mlrss_feed_011_item_001_description}}~jpg!
MLMath|Add~mlrss_feed_011_item_001_imageend~{{mlrss_feed_011_item_001_image}}~3!
MLMath|Subtract~mlrss_feed_011_item_001_imagelength~{{mlrss_feed_011_item_001_imageend}}~{{mlrss_feed_011_item_001_imagestart}}!
MLStrings|Mid~mlrss_feed_011_item_001_imageurl~{{mlrss_feed_011_item_001_description}}~{{mlrss_feed_011_item_001_imagestart}}~{{mlrss_feed_011_item_001_imagelength}}

My goal was to find a common unique phrase for each variable for the start and the end of the snippet you want. So this looks for the unique yimg to find a start and the unique jpg to find the end. Then it adjusts for the actual start of the snippet and end of the snippet and places it in a variable called {{mlrss_feed_011_item_001_imageurl}}

A few notes. I named the variables mlrss... so they would live in the variable list together. You can name them anything if you want to shorten them. My Yahoo feed is 011 so you'd want to change that to match your feed number.

In ML, add any button from Library 1 to a scene and in the JPG image or Flash box put the {{mlrss_feed_011_item_001_imageurl}} variable.

Now you can do this for every image you want to add (that's a lot of command maps) or change the item number to a variable such as {{mlrss_feed_011_item_{{urlcounter}}_imageurl}} and increment that with MLConditional and MLMath.

You can run the macro hourly with MLScheduler or whenever you open the scene to get the latest news.

Hope this helps... at least until someone offers a cleaner solution :D

Rick

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Sat Oct 04, 2008 4:07 am

Wow! Did you just whip this up while watching the playoffs? This is excellent!

I display my feeds one item at a time, so I could substitute the "Active Feed" syntax for the variables in place of the actual feed item number. So your revised command looks like this:

Macro|
MLStrings|InStr~mlrss_active_feed_item_image~{{mlrss_active_feed_item_description}}~yimg!
MLMath|Subtract~mlrss_active_feed_item_imagestart~{{mlrss_active_feed_item_image}}~9!
MLStrings|InStr~mlrss_active_feed_item_image~{{mlrss_active_feed_item_description}}~jpg!
MLMath|Add~mlrss_active_feed_item_imageend~{{mlrss_active_feed_item_image}}~3!
MLMath|Subtract~mlrss_active_feed_item_imagelength~{{mlrss_active_feed_item_imageend}}~{{mlrss_active_feed_item_imagestart}}!
MLStrings|Mid~mlrss_active_feed_item_imageurl~{{mlrss_active_feed_item_description}}~{{mlrss_active_feed_item_imagestart}}~{{mlrss_active_feed_item_imagelength}}

This way, the thumbnail changes dynamically with each display of a new feed item. Very cool!

Note a small change in your parsing routine.

This command is incorrect:

MLMath|Subtract~mlrss_active_feed_item_imagestart~{{mlrss_active_feed_item_image}}~10!

It leaves the "Quote" character at the beginning of the url string. The character delimiter should be "9" not "10".

Like this:

MLMath|Subtract~mlrss_active_feed_item_imagestart~{{mlrss_active_feed_item_image}}~9!

At any rate, your contribution helped me understand the MLStrings plugin better.

Thank You!

Ron


PS - I 'm trying to get these thumbnail jpg's to fit a defined width/height, like the MUL images. Something like this syntax:

{{mlrss_active_feed_item_imageurl}}|width=330|height=220

but they will not display with this syntax. Is it correct? Any ideas? I'm trying to get the images to fit inside a frame.

Here's how my RSS Scene looks :D
You do not have the required permissions to view the files attached to this post.
If it ain't broke ... don't fix it!

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Sat Oct 04, 2008 9:15 am

Glad it worked for you. I also tried adjusting the size that way but no luck so I just decreased the button size to 50% (or whatever size fits your border).

Rick

Oh ya, GO SOX!

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Sun Oct 05, 2008 7:52 pm

I've taken this Yahoo RSS dynamic thumbnail display to the next step on my "Home Scene".

I created the MLCycleStates item called "RSS_Feeds" containing all the Yahoo RSS feeds I wanted to display (See figure 1). Using the MLCycleStates "Next" command in a timer loop using MLTimer, it (See figure 2) sets next feed in the list to "Active" every 60 secs.

Notice the macro "RSS_Photo" at the end of the command string in the figure 2 window. That's parsing code to get the image sources to display dynamically with the correct item.

Here is the macro:

Macro|
MLStrings|InStr~mlrss_active_feed_item_image~{{mlrss_active_feed_item_description}}~yimg!
MLMath|Subtract~mlrss_active_feed_item_imagestart~{{mlrss_active_feed_item_image}}~9!
MLStrings|InStr~mlrss_active_feed_item_image~{{mlrss_active_feed_item_description}}~jpg!
MLMath|Add~mlrss_active_feed_item_imageend~{{mlrss_active_feed_item_image}}~3!
MLMath|Subtract~mlrss_active_feed_item_imagelength~{{mlrss_active_feed_item_imageend}}~{{mlrss_active_feed_item_imagestart}}!
MLStrings|Mid~mlrss_active_feed_item_imageurl~{{mlrss_active_feed_item_description}}~{{mlrss_active_feed_item_imagestart}}~{{mlrss_active_feed_item_imagelength}}

I then created another timing loop using MLTimer to cycle through each of the RSS items within a particular feed group, with an item change every 5 secs (See figure 3)

The timers 1 and 2 get triggered whenever the "Home Scene" is opened. As long as the scene is open, the timers are running. When the scene is closed, the timers are disabled.

End result, Yahoo RSS feed groups change every 60secs and RSS feed items within the active feed group update every 5 secs. It makes the scene come alive with real-time information and photos. (See figure 4 for a snapshot of "Entertainment" feed item about Madonna)

Bye the way, the small "Arrow" button to the left of the feed topic (in this case, ENTERTAINMENT) allows you to quickly cycle through the feed topics using this code:

MLServeCmd.Macro|MLCycleStates|Next~RSS_Feeds!MLRss|NextItem~{{mlrss_active_feed_number}}!RSS_Photo

And if you click on the feed photo, you will go to a separate ML scene with more details about the story (You could also use MLWebLobby to open your browser window to the web page containing the story details).

Thanks again Brandon and Rick for your help. This forum rocks! :D


Ron
You do not have the required permissions to view the files attached to this post.
If it ain't broke ... don't fix it!

djsl
Senior Member
Senior Member
Posts: 236
Joined: Thu Jun 08, 2006 12:56 am
Location: Chicago
Contact:

Postby djsl » Sun Oct 05, 2008 8:13 pm

That looks great Ron. I am going to set it up also on my scenes following your example.

thanks for posting it.

Jim

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

Postby DaveB » Sun Oct 05, 2008 8:47 pm

Ron - Interesting adaptation of the Lodge Interface. Looks good and I like the timer methods used for the RSS.
Thanks!

Dave Bruner
:shock:

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Sun Oct 05, 2008 9:03 pm

DaveB wrote:Ron - Interesting adaptation of the Lodge Interface. Looks good and I like the timer methods used for the RSS.


Thanks Dave. I build my backgrounds and non-026 elements in Paintshop Pro, save then as lossless JPG's, matching object colors as closely as possible to the Lodge color palette.
If it ain't broke ... don't fix it!

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Sun Oct 05, 2008 9:17 pm

djsl wrote:That looks great Ron. I am going to set it up also on my scenes following your example.

thanks for posting it.

Jim


Thanks Jim. The parsing code macro is the key to making all this work. You can thank Rick S for the first go at it and Brandon Higa for the MLStrings plugin which does the string parsing.

One thing I forgot to mention in the posts. Not all of the feed items will have a thumbnail available. In this case, just the text appears. And the orientation/size of the images varies. My solution was to let them just float on the background skin without any frames. That seems to give you the most flexibility as the images change. Also, it may take a moment to fetch the jpg image from the website to display in ML. The delay on my system is not a deal breaker ... only about a second or two. Once it is cached, it appears instantly with the item update. That's another cool thing about letting the timers run on the scene. As it cycles through the feed items, it fetches the thumbnails and caches them until the item is replaced by a new item. So after a couple of cycles through all of the feeds, most of the available images are stored.

Ron
If it ain't broke ... don't fix it!

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Re: MLRss Plugin Photo Thumbnails

Postby mcascio » Tue Oct 07, 2008 5:20 pm

ronsatter wrote:Hi gang,

I just noticed this new feature for Yahoo RSS news feeds:

"NEW: Photo thumbnails in Yahoo! News' RSS feeds! We're now offering thumbnails of related photos for stories in our RSS feeds, giving you an even richer news experience."

So I took a look at the MLRss variables from these feeds, and there is a reference to a jpg file embedded within the feed item description variables.

Example:

{{mlrss_feed_001_item_001_description}} contains this code:

<p><a href='http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20081003/ap_on_go_co/meltdown_tax_breaks'><img src='http://d.yimg.com/us.yimg.com/p/ap/20081002/capt.085c0b3530644486915008002f6c7f8d.congress_financial_meltdown_dclj110.jpg?x=130&y=86&q=85&sig=PXyOAeUwtiz4_UWX2gKSSA--' align='left' height='86' width='130' alt='Senate Majority Leader Sen. Harry Reid, D-Nev., center, with Senate Minority Leader Mitch McConnell, R-KY, right and Sen. Chris Dodd, D-Conn., left, Sen. Max Baucus, R-Mont., second from left, and Sen. Judd Gregg, R-N.H., speak at news conference on Capitol Hill in Washington, Wednesday, Oct. 1, 2008. Senators loaded the economic rescue bill with tax breaks and other sweeteners before passing it by a wide margin, 74-25, a month before the presidential and congressional elections.(AP Photo/Lawrence Jackson)' border='0' /></a>AP - Millions of taxpayers, thousands of businesses and groups as diverse as solar power developers and natural disaster victims will see tax relief with the House vote Friday to approve and send to the president a $700 billion financial rescue plan.</p><br clear='all'/>

The photo image thumbnail portion is:

http://d.yimg.com/us.yimg.com/p/ap/2008 ... clj110.jpg

When I paste this into a browser window it displays the image. Cool!

So far so good. It looks like each feed item has a similar format for the thumbnails and it could easily be parsed.

1. So how do I extract this snippet from the variable using MLStrings
2. Display it in ML (without using MLWebLobby)

This would add a nice visual to our RSS feeds scene.

Ron


Ron,

Is this photo option universal to all RSS feeds or just Yahoo from what you've found?
Mario Cascio
Cinemar, Inc.
http://www.cinemaronline.com

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Wed Oct 08, 2008 11:24 am

It appears to be just Yahoo feeds, and only the feeds related to "News" topics. When you view the Yahoo RSS feeds web page, you'll see a group of feeds in the "News" category. They all have the image url code embedded in the feed string.

After watching these feeds for this last week, I've noticed about a 50% fullfillment ratio on the images. Sometimes there will be thumbnails for most of the "Top Stories", "Sports" and "Business" categories, and very few for "Science", "Technology" and apparently less viewed topics.

Also, somtimes the story details which the MLRSS Plugin parses as "feed item descriptions" do not appear ... not sure why, perhaps a typo in the feed string.

Even with these "blemishes", I think it's nice to add the extra visual to the feed items. Maybe Yahoo could be encouraged to include thumbnails with all of their RSS feeds.

Ron
If it ain't broke ... don't fix it!

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Wed Oct 08, 2008 11:54 am

Gee, I was hoping Mario was hinting at adding a feature to MLRss to scrape the images from websites related to the feed. :D

I use a script that someone wrote for HS that does this for local movie theaters where it gets the image, title, description, rating and show times. Tried converting that to run in MLScripts with no luck. Some day I'll get back to it becuase it really brings a scene to life.

Rick

User avatar
ronsatter
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1304
Joined: Mon Dec 04, 2006 1:40 am
Location: San Leandro, CA
Contact:

Postby ronsatter » Wed Oct 08, 2008 9:50 pm

ricks wrote:Gee, I was hoping Mario was hinting at adding a feature to MLRss to scrape the images from websites related to the feed. :D

I use a script that someone wrote for HS that does this for local movie theaters where it gets the image, title, description, rating and show times. Tried converting that to run in MLScripts with no luck. Some day I'll get back to it becuase it really brings a scene to life.

Rick


Sounds great ... got a feeling it would break a lot with constantly changing web layouts, etc.

But I do feel MLRSS plugin has the potential to pull in more media pieces from RSS feeds, including thumbnails and sound clips. For instance, most NPR RSS feeds have small sound files associated with the story. I think it would be great if someone could figure out a way to include those files in the feed data string. I posted about this idea previously, but it didn't draw much interest. The clips are not podcasts, otherwise they could be accessible through JR Media Center 12 as mp3's.

One thought about the HS movie theaters website script ... perhaps you don't need to get the HS script working in MLScripts. Can you run the script in HS and use the MLHS Plugin to bring over the HS variables into ML?

ML scenes with dynamic photos and sound updating in real time through the internet ... now we're talkin' VERY COOL :D

Ron
If it ain't broke ... don't fix it!

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Thu Oct 09, 2008 12:08 pm

Hi Ron,

Yes, that's what I do now... use HS and MLHSPlugin to bring them into ML. Works fine but trying to get to "one" automation solution. Since there are a few other bigger issues keeping me from the one solution I'm not too worried about this one.

Sure would be a nice feature for MLRss to get those image and sound files though!

Rick

djsl
Senior Member
Senior Member
Posts: 236
Joined: Thu Jun 08, 2006 12:56 am
Location: Chicago
Contact:

Postby djsl » Wed Oct 22, 2008 8:43 pm

How do you handle passing the URL of an item link in the feed to weblobby.

I have seen the script that Mario posted on another thread that replaces all the tilde's in the variables, but that requires to create a server rule for every item on all the feeds.

Is there an easier way?



Jim


Return to “MLServer Plug-Ins”

Who is online

Users browsing this forum: No registered users and 1 guest