erland;540975 Wrote: 
> Hmm, looks like it works a bit different than I thought, I thought the
> JSON response was like the sample wetdata structure you attatched to an
> earlier post.
With the 'all' request, you do get the whole wetdata table.  What you
don't get is the parsing, which I wanted to not duplicate.  In the end,
though, I think I did myself a disservice.  Parsing locally wouldn't be
too hard.

> So if I understand you correctly, SDT will take a formatting string with
> these %* keywords as input in the JSON request and return the string
> expanded to real values ?
> 
yes, for the most part.  I haven't tested all the keywords, but they
appear to work.  LUA crashes just by looking at it funny, and I
couldn't get squeezeplay to work with CustomClock, so the cycle took
longer.

> Notifications from the plugin when something changes could be tricky if
> this is the case as the plugin has no idea which formatting string the
> applet uses. So with this solution, we probably need to use polling.

Yes, this is a bit of a pain.  Might be good to a pref for when each
item gets polled.  Like I said above, local reformatting would make the
polling go away - I'd be for that.  I upped mine from 1 second to 10
seconds, I believe.  I just noticed that it does auto-update the icon
when the request changes (went from cloudy to rainy. April in Oregon -
gotta love it!)

> I think I'd like to have a separate item type for SDT, probably two of
> them:
> - sdttext (which will be configured with a formatting strings as the
> one in your sample code)
> - sdticon (which will return the url, not sure if it needs to take any
> input data)
> (I'm not sure if it's going to be sdticon or sdtimage yet, need to look
> a bit more how they are handled in the Custom Clock code to know what's
> suitable)
> 
I didn't see much difference.  Though if icon lends itself to making it
actionable in the future, I'd be for that.  Would be cool to, say, touch
the icon and get the 3-day forecast, etc.

> How are icons handled ? 
> If I understand you correctly I can create an url based on a ID ?
> Does the icon need to be rescaled or does it already have the
> appropriate size ?
> 

I create a URL based on what is stored in the prefs file, and add the
icon number that is stored in wetdata table (it's a 1-2 digit integer),
and then add a ".png" to it.  Pretty basic.  The icons are stored in SDT
already, and easily accessible.  The numbering scheme is pretty
standard, too, it turns out.

> I think I'd like to take a look at how sports are handled before
> deciding how to do in the generic Custom Clock applet, you can still
> continue your version if you like to but I like to analyze the sport
> data to make sure we can handle it the same way, at least if it uses
> similar structures.

Go for it!  (I'm not a sports junkie, but I know folks who are. :-))

> I wonder what should be displayed in the combobox in the web ui ?
> The %* keywords are pretty cryptical without any documentation that the
> end user can use to know what they means.
> ..
> Or are all SDT users used to these %* keywords so this isn't a big
> issue ?
> How does it work for the Classic/Boom/Transporter, does it come with
> preconfigured formatting strings ? Does the user also have to enter
> these %* keywords ?
> 

SDT has used the %keywords forever, so if you use it, you know it. 
There's a default set that helps you along, and it's not nearly as
brain-damaging as RegEx is...
> 
> Do you have some error messages from the log ?
Wouldn't be helpful, but the code is here:
> 
> function _retrieveImage(self,url,imageType,dynamic)
>       
> local imagehost = ""
>       local imageport = tonumber("9000")
>       local imagepath = ""
> 
>       local start,stop,value = string.find(url,"http://([^/:]+)")
>       log:debug("url: "..url)
>       if value and value != "" then
>               imagehost = value
>               log:debug("imagehost: "..imagehost)
>       end
> 
>       start,stop,value = string.find(url,"http://[^/]+(.+)")
>       if value and value != "" then
>               imagepath = value
>               log:debug("imagepath: "..imagepath)
>       end
> 

I added the [^/:] hunt, as well as hard-coded the 9000 port.  I
couldn't figure out string.find's pattern syntax - it caused me much
pain without any result, so I moved on.

Without the above fix, with "http://192.168.1.1:9000/my/url";
will result in an imagehost of 192.168.1.1:9000, a port of 80 (on your
version), and a proper imagepath.  Lua barfs on that.

-Dan


-- 
plympton
------------------------------------------------------------------------
plympton's Profile: http://forums.slimdevices.com/member.php?userid=12955
View this thread: http://forums.slimdevices.com/showthread.php?t=77864

_______________________________________________
jive mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive

Reply via email to