INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Weather Page for Theater View  (Read 4919 times)

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Weather Page for Theater View
« on: September 07, 2004, 12:34:23 am »

[Warning:  This is a long post - but I think it's best to be thorough!]

I've put together a weather page for Theater View.  It's HTML that's appropriate for a 10-foot display and looks like this:



The requirements to get this working for you:  Download the appropriate WeatherFeed zip (as described below) and make sure you have the latest v11 beta.

Here's how it works...  Weather.com publishes a Weather XML Data Feed which returns a real time forecast in XML.  Using some javascript, I read variables from WeatherFeedParameters.xml to create the appropriate Data Feed request.  I then retrieve the Data Feed and use XSLT to transform it into HTML appropriate for a 10-foot display.

Here's how to set it up...  Unzip the file
http://pages.sbcglobal.net/scottraymond/WeatherFeedWithIconPack.zip to a directory of your choice.  The majority of this zip is the icon pack of all the weather icons.  You can get just the icon pack from http://pages.sbcglobal.net/scottraymond/Weather.com%20Icon%20Pack.zip and you can get everything but the icon pack from http://pages.sbcglobal.net/scottraymond/WeatherFeedWithoutIconPack.zip

You'll just need to adjust the WeatherFeedParameters.xml for your location and preferences.
The file can be edited with notepad and looks like this:
Code: [Select]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE WeatherFeedParameters [
   <!ELEMENT DaysForecast (#PCDATA)>
   <!ELEMENT Key (#PCDATA)>
   <!ELEMENT LocID (#PCDATA)>
   <!ELEMENT Par (#PCDATA)>
   <!ELEMENT Units (#PCDATA)>
   <!ELEMENT WeatherFeedParameters (LocID, DaysForecast, Par, Key, Units)>
   ]>
<WeatherFeedParameters>
   <LocID>93933</LocID>
   <DaysForecast>6</DaysForecast>
   <Par>1005860981</Par>
   <Key>110cf3973f6a4091</Key>
   <Units>s</Units>
</WeatherFeedParameters>

You must only edit the contents of the <LocID>, <DaysForecast>, <Par>, <Key>, and <Units> elements.  If you're in the U.S., just put your Zip Code into the <LocID> element.  For anywhere else in the world, Weather.com has a search function to get the LocID for your XML feed.  Use a URL similar to
http://xoap.weather.com/search/search?where=montreal and you'll see a return similar to
Code: [Select]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--This document is intended only for use by authorized licensees of The Weather Channel. Unauthorized use is prohibited. Copyright 1995-2004, The Weather Channel Enterprises, Inc. All Rights Reserved.-->
<search ver="2.0">
  <loc id="CAXX0301" type="1">Montreal, Canada</loc>
  <loc id="USMO0602" type="1">Montreal, MO</loc>
  <loc id="USWI0466" type="1">Montreal, WI</loc>
</search>

<DaysForecast> is simply how many days of extended forecast you want (the current day counts as one day, so 6 is really five future days).  The <Par> and <Key> elements are given out by Weather.com.  For now feel free to use my partner id and license key, but I'm not sure if Weather.com will balk after a while because of too many requests from too many different IPs.  You can always get your own partner id and key for free by visiting http://www.weather.com/services/xmloap.html.  The <Units> element is "s" for standard and "m" for metric.

Now you just need to add a "Weather" button to the Theater View.  Do this by choosing Configure Theater View (either from "Tools -> Options -> Tree & View -> Theater View" or right-click when in Theater View and choose "Configure Theater View") and then under "Items to Show" click on "Add" then choose "custom item".   Choose webpage, call it whatever you want, and put in the complete path to the WeatherFeed.htm file you unzipped.

For this to work in IE, you need to have MSXML installed, which is done automatically by IE.  If I've done this right, it shouldn't matter what version of IE you have, but perhaps I didn't do it right :)  You can be double sure by visiting the URL http://www.bayes.co.uk/xml/index.xml?/xml/utils/msxml_sniffer.htm to see what's installed.  You can download the latest MSXML from http://msdn.microsoft.com/XML/XMLDownloads/default.aspx.  I suggest you install the latest version (4.0) only if things aren't working right for you.

A problem you might run into with running "active" content in IE locally was addressed by AnalogRoaming:
Look in your IE options under Security for a setting to allow you to run active content from CDs and local disks.  I don't have SP2 on this machine here but I did run into this at work on Friday and there is a setting similar to that that did fix our problem.

See here for more info.
http://www.phdcc.com/xpsp2.htm
Edit:  The specific setting is at IE's Tools -> Internet Options -> Advanced tab and is called "Allow active content to run in files on My Computer".

Oh...  one last thing.  I've tried my best to separate out the presentation of the HTML by using an external CSS (styles.css).  You can edit styles.css and change the size and color of text pretty easily.  

I may add a few more features:
 - Finish the DTD to prevent users from entering unsuitable values in WeatherFeedParameters.xml.
 - Finish debugging this for Firefox.  For some reason, Sarissa is not working as it should.
edit:  - Convert PNGs to JPG so that the "kludge" for getting around IE's inability to render transparent background doesn't cause a few anomolies which can require a browser refresh to get the image size right.

A feature I wish someone would do for me:
 - Restructure the HTML and css to work better for a given display resolution.  Some have complained that the page is too long.  The best way to fix this would probably be to set up the tables so that the row heights are fixed in pixels and the fonts are set in pixels instead of points.  But CSS drives me crazy and I'm sick of it.  Hopefully there's a webdesigner guru amongst us.

And, finally, if someone has a better idea for the HTML presentatation, I am willing to do two more XSLTs.  So be the first to send me a template (be sure to use external CSS) and it'll get done.

Scott-
Logged

Dragyn

  • Citizen of the Universe
  • *****
  • Posts: 3269
Re:Weather Page for Theater View
« Reply #1 on: September 07, 2004, 01:57:03 am »

This is awesome! Thanks. 8)
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72536
  • Where did I put my teeth?
Re:Weather Page for Theater View
« Reply #2 on: September 07, 2004, 10:28:45 am »

_Very_ nice!  Thanks.
Logged

Michel Lefebvre

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 281
Re:Weather Page for Theater View
« Reply #3 on: September 07, 2004, 05:15:11 pm »

Works beatifully!

I even set up 2 copies associated with two buttons. One for Montreal and one for Boston. Nice!

M.
Logged

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re:Weather Page for Theater View
« Reply #4 on: September 07, 2004, 06:28:38 pm »

I'm glad you all like it.  It will be interesting to see if anyone customizes the presentation using the CSS.

I even set up 2 copies associated with two buttons. One for Montreal and one for Boston. Nice!

This reminds me of the request to be able to focus the browser window by maybe tabbing-right.  'Cause if we can do that, it's a simple task to add a navigation bar at the top of the HTML for choosing different weather locations.
Logged

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re:Weather Page for Theater View
« Reply #5 on: September 08, 2004, 09:16:06 am »

Here's a little tip:  If you add "overflow:hidden" to the body section of the styles.css, like this:

Code: [Select]
body {
   font-family: Arial;
   overflow:hidden;
   }

You won't see the vertical scrollbar.  
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re:Weather Page for Theater View
« Reply #6 on: September 19, 2004, 09:31:19 pm »

What do I need to change to make it use the larger images?
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re:Weather Page for Theater View
« Reply #7 on: September 19, 2004, 09:59:27 pm »

Hmm... weird. When I first star MC and TV, the icons are all small, and the moon-phase icon is actually squished horizontally. Once I play something, though, it all looks correct.
Logged

cncb

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3122
Re:Weather Page for Theater View
« Reply #8 on: October 09, 2004, 12:20:35 pm »

I have a problem that I'm not sure when/why it occurred because I haven't tried to use this for a while (maybe because of XP SP2?).  I get the following message now everytime I try to open it.  Any security settings I can change to fix this?  Thanks.



Logged
-Craig    MO 4Media remote and player:  Android/TV/Auto | iOS | Windows 10/UWP

raym

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3583
Re:Weather Page for Theater View
« Reply #9 on: October 23, 2004, 10:03:29 pm »

Hmm... weird. When I first star MC and TV, the icons are all small, and the moon-phase icon is actually squished horizontally. Once I play something, though, it all looks correct.

Yeah, I get this too. Happens when page is first loaded. Once you refresh though it's ok.
Logged
RKM Smart Home - www.rkmsmarthome.com.au
Z-Wave Home Automation

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re:Weather Page for Theater View
« Reply #10 on: November 26, 2004, 11:36:44 am »

Hmm... weird. When I first star MC and TV, the icons are all small, and the moon-phase icon is actually squished horizontally. Once I play something, though, it all looks correct.

Yeah, I get this too. Happens when page is first loaded. Once you refresh though it's ok.

Blame Microsoft.  IE doesn't handle transparent PNGs but there's a workaround that seems to work for the most part - with the exception that you've already found.
Logged

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re:Weather Page for Theater View
« Reply #11 on: November 26, 2004, 11:52:11 am »

What do I need to change to make it use the larger images?

I think it's already using the larger images...  but anyway, you'll see the following in the .XSL:
Code: [Select]
      <xsl:variable name="small-img-dir">./images/weather/32x32</xsl:variable>
      <xsl:variable name="med-img-dir">./images/weather/64x64</xsl:variable>
      <xsl:variable name="large-img-dir">./images/weather/128x128</xsl:variable>

And then you'll see where these variables are used further down in the XSL, for example:
Code: [Select]
<img src="{$large-img-dir}/{$iconnumber}.{$img-ext}"/>
So you can substitute a different image directory (which is how to change the size) by using something other than $large-img-dir.  I should have put this as a single parameter in the WeatherFeedParameters.xml, huh?
Logged

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re:Weather Page for Theater View
« Reply #12 on: November 26, 2004, 11:53:36 am »

I have a problem that I'm not sure when/why it occurred because I haven't tried to use this for a while (maybe because of XP SP2?).  I get the following message now everytime I try to open it.  Any security settings I can change to fix this?  Thanks.





Yes, there's a fix for this...  it was discussed here on Interact, but I haven't been able to find it quickly.  If my memory is accurate, it had something to do with adding you computer to the trusted zone...  of something like that.  I'll look more a little later on.
Logged
Pages: [1]   Go Up