Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 23 FirstFirst 123412 ... LastLast
Results 11 to 20 of 225
  1. #11
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,891
    Quote Originally Posted by plympton View Post
    Also, do we want a configuration screen on the touch? I can envision a nice touch UI that lets you make boxes bigger & smaller, select fonts, etc... but that's a heckuva lot of work. It's not like SqueezeOS has a UI kit (yet?)
    I decided to do it through the SBS web ui in the Custom Clock Helper plugin.

    As long as the Custom Clock screen saver is active with the style you are editing you will see the changes on the Touch display immediately when you save a change in the web ui.
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)

    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  2. #12
    Senior Member
    Join Date
    Aug 2007
    Location
    Portland, OR, USA
    Posts
    219
    Quote Originally Posted by erland View Post
    I decided to do it through the SBS web ui in the Custom Clock Helper plugin.

    As long as the Custom Clock screen saver is active with the style you are editing you will see the changes on the Touch display immediately when you save a change in the web ui.
    Very nice, I'm sold. I played with the helper for a bit today, and was able to get the layout I want.

    Few notes:

    1. When using %I, can you set it to convert using tonumber() so that it truncates the leading 0? (I didn't find a strftime that did that)

    I suppose it's too hard to get access to the Server's date & time format strings?

    2. Is there an AM/PM flag in strftime?

    3. Can you add sizing to the Clockimage (closest thing I could find to an image tag)? I found that zoom is broken, so I was using rotozoom, so I had to calculate a zoom factor with realWidth/requestedWidth

    4. Map each of the SDT weather items to a new WeatherText dropdown, I suppose, right? These:

    Current Condtions: Period Information: wunderground.com:
    Time = %1 (Line 1&2 Only) Period Covered (ie Today) = %y Temperature (░F) = %e
    Date = %2 Brief Forecast (ie Sunny) = %v Temperature (░C) = %E
    Temperature (░F) = %t High/Low (░F) = %z Humidity = %H
    Temperature (░C) = %T High/Low (░C) = %Z Wind Speed (mi/hr) = %j
    Feels-Like Temperature (░F) = %f Precipitation = %x Wind Speed (km/hr) = %J
    Feels-Like Temperature (░C) = %F Average High/Low (░F) = %a Wind Speed (kt/hr) = %k
    Humidity = %h Average High/Low (░C) = %A Wind Speed (m/s) = %K
    Wind Speed (mi/hr) = %w Record High/Low (░F) = %c Barometric Pressure (inHg) = %l
    Wind Speed (km/hr) = %W Record High/Low (░C) = %C Barometric Pressure (hPa) = %L
    Wind Speed (kt/hr) = %q Record High/Low Year = %g Dew Point (░F) = %m
    Wind Speed (m/s) = %Q Sunrise = %s Dew Point (░C) = %M
    Barometric Pressure (inHg) = %p Sunset = %S
    Barometric Pressure (hPa) = %P
    Dew Point (░F) = %d
    Dew Point (░C) = %D
    UV Index (Value) = %u
    UV Index (Text) = %U
    Past 24-hr Precip = %b
    Past 24-hr Snowfall = %B

    I've attached my code - mostly it's in the request/response function. I've been talking to Greg about some other changes. I'll also attach a copy of the sample wetdata structure he sent me.

    Thanks!
    -Dan
    Attached Files Attached Files

  3. #13
    Senior Member tcutting's Avatar
    Join Date
    May 2008
    Location
    Southern California, USA
    Posts
    912
    Erland-
    Would it be possible to have a group of items which rotate through settings? Say I had a clock/screensaver display, but I wanted a section to display weather information, but would "rotate" through display values. For example, set it to display current conditions, then more details (such as "feels like" and humidity), then forecast (maybe near term), then maybe summary of next few days... then repeat with a cycle time between values. Is this asking too much?
    A simpler alternative may be to implement a "ticker" which would be made up of a long string which could continuously scroll across the display?

  4. #14
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,891
    Quote Originally Posted by plympton View Post
    1. When using %I, can you set it to convert using tonumber() so that it truncates the leading 0? (I didn't find a strftime that did that)
    I'll add support for %i1 and %h1 and %m1 in next version that does this.

    Quote Originally Posted by plympton View Post
    I suppose it's too hard to get access to the Server's date & time format strings?
    Should be possible, the only problem is if the perl function uses different % keywords than the lua os.date function. In one of the next versions, the timetext setting in Custom Clock Helper will be a combobox so you can enter your own custom formatting string but you can also select among a number of predefined.

    I realized that I need the combobox support for the color settings in the new spectrummeter item that also comes in the next version.

    Quote Originally Posted by plympton View Post
    2. Is there an AM/PM flag in strftime?
    I'm using lua's os.date, %p indicates am/pm
    http://www.lua.org/pil/22.1.html

    Quote Originally Posted by plympton View Post
    3. Can you add sizing to the Clockimage (closest thing I could find to an image tag)? I found that zoom is broken, so I was using rotozoom, so I had to calculate a zoom factor with realWidth/requestedWidth
    I need to look into this a bit more to see what's the best way, if we are talking about the weather icons I suspect we might want to see if it's possible to use the rescaling functionality in the server. I'll have to dig a bit more.

    Quote Originally Posted by plympton View Post
    4. Map each of the SDT weather items to a new WeatherText dropdown, I suppose, right?
    I suspect we probably want to use something similar to the "timetext" item type where you can specify exactly which keywords you like to combine. In that case, it would be great if it was possible to get a list of available keywords from the Super Date Time plugin. This way new keywords could be added without modifying the Custom Clock/Custom Clock Helper code. To make this possible I think the keyword needs to match the attribute names returned in the JSON requests, so Custom Clock would basically:
    1. When the user has configured a sdtitem, it would issue a 'SuperDateTime', 'all' request
    2. Look in it's configuration formatting string and replace all keywords from the JSON response

    To make this work, we probably need to use keywords that looks something like:
    Current: %temperatureC%░C %1.forecastTOD%: %1.forecastTempC%░C
    Which in the applet would be replaced to:
    Current: 11░C TONIGHT: 7░C

    Note!
    I'm not sure I've understood the structures yet so the above might be completely incorrect. We also need to check what's possible in string.gsub on the lua side regarding replacements, as I've understod it doesn't support all type of regular expressions so we need to make sure the keywords are entered in a way that we can do the replacement fairly easy.
    If you like to help, you can look at this keyword replacement logic and see if you can come up with something that works.

    Quote Originally Posted by plympton View Post
    I've attached my code - mostly it's in the request/response function. I've been talking to Greg about some other changes. I'll also attach a copy of the sample wetdata structure he sent me.
    Doesn't SuperDateTime also provide sport events/games scores ?
    Are these also provided in the JSON response ?
    Another JSON command maybe ?

    I wonder how often we need to update these SDT items ? Do we need to do it once a minute ? Once an hour ?
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)

    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  5. #15
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,891
    Quote Originally Posted by tcutting View Post
    Erland-
    Would it be possible to have a group of items which rotate through settings? Say I had a clock/screensaver display, but I wanted a section to display weather information, but would "rotate" through display values. For example, set it to display current conditions, then more details (such as "feels like" and humidity), then forecast (maybe near term), then maybe summary of next few days... then repeat with a cycle time between values. Is this asking too much?
    Would definitely be possible, it's just a question to decide how to configure them.
    Would it need to switch several items simultaneously or is it enough if it switch item per item ?

    If it's enough to switch item per item we could add a switchinggroup concept so only one item within the same switching group is visible at the time.

    Quote Originally Posted by tcutting View Post
    A simpler alternative may be to implement a "ticker" which would be made up of a long string which could continuously scroll across the display?
    Scrolling text is supported, so that should be possible already today. It's controlled by the "animate" attribute on all *text item types.
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)

    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  6. #16
    Senior Member
    Join Date
    Aug 2007
    Location
    Portland, OR, USA
    Posts
    219
    Ugh! I think I figured it out, so no I can get back to my real job. See below.

    Quote Originally Posted by erland View Post

    I suspect we probably want to use something similar to the "timetext".
    I'm going to try an take a whack at it tomorrow - shouldn't be too difficult. Mainly it's just sending the "text" part to SDT for processing using the code below. Not much more than that - use JSON, send request, get response.

    Doesn't SuperDateTime also provide sport events/games scores ?
    Are these also provided in the JSON response ?
    Another JSON command maybe ?
    Probably - after weather is done, perhaps.

    I wonder how often we need to update these SDT items ? Do we need to do it once a minute ? Once an hour ?
    [/quote]
    I'd say update every minute to keep the clock running OK.

    Only need to do the icon URL code in CustomClock. Probably need a TimeIcon item as well as TimeText. This would fetch the current icon number to fetch and display - it's just an integer 1-45, and it fetches a PNG from a URL (local or internet) I'm going to put that in unless you have a preferred way.

    You can handle the web UI part for these additions, right? :-)

    I added this to the cliQuery of SuperDateTime. This will automagically take standard SDT setting strings (as seem from the web UI), and parse them it. Pretty neat. Only for weather (all I care about). Could do sports, not sure how, probably using a similar method.

    I also have a 120x120 pixel set of icons I'm going to use. The current customclock crashes with local (port 9000) urls, just FYI. I bricked my Touch about a dozen times trying to figure out the damn LUA non-regular expression syntax, to no avail. Anyway, it is what it is - should get fixed.


    sub cliQuery {
    my $request = shift;
    my $client = $request->client();

    # get our parameters
    my $SDTstring = $request->getParam('_p2');
    $log->debug("INSIDE CLI- SDTstring: $SDTstring");
    # my $client = $request->getParam('_p3');
    $log->debug("INSIDE CLI- Client: $client");
    my $period = $request->getParam('_p4');
    $log->debug("INSIDE CLI- Period: $period");
    my $mode = $request->getParam('_mode');
    $log->debug("INSIDE CLI- mode: $mode");

    if ($mode eq 'SDTstring') {
    if (!defined $period) {$period = 0;}
    my $SDTtemp = replaceMacrosPer( $SDTstring, $period, $client );
    $log->debug("Result of replaceMacrosPer: $SDTtemp" );
    $request->addResult( "SDTstring", $SDTtemp );
    $request->addResult( "wetData", \%wetData );
    }
    and this is all you need to CustomClock to get the right timetext from the SDT patterns. You request an SDTstring, pass it the SDT pattern, the period (parameter 4. 0 is current). Parameter 3 was the player, but that's not necessary.

    function request(self)
    local player = appletManager:callService("getCurrentPlayer")
    local playerStatus = player:getPlayerStatus()
    if playerStatus.mode ~= 'play' or self:getSettings()["nowplaying"] == false then
    local player = appletManager:callService("getCurrentPlayer")
    local server = player:getSlimServer()

    server:userRequest(
    function(chunk, err)
    if err then
    log:debug(err)
    elseif chunk then
    self:response(chunk.data)
    end
    end,
    player and player:getId(),
    { 'SuperDateTime', 'SDTstring', '%2 (Sunset %S) %t/%h %1 PREC %x %z %f %a(%c %g)', '0', '0'}
    )
    end
    end
    -Dan

  7. #17
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,891
    Quote Originally Posted by plympton View Post
    Only need to do the icon URL code in CustomClock. Probably need a TimeIcon item as well as TimeText. This would fetch the current icon number to fetch and display - it's just an integer 1-45, and it fetches a PNG from a URL (local or internet) I'm going to put that in unless you have a preferred way.

    You can handle the web UI part for these additions, right? :-)

    I added this to the cliQuery of SuperDateTime. This will automagically take standard SDT setting strings (as seem from the web UI), and parse them it. Pretty neat. Only for weather (all I care about). Could do sports, not sure how, probably using a similar method.
    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.

    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 ?

    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.

    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)

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

    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.

    Would be kind of nice if there was a CLI/JSON command which Custom Clock Helper could call to get SDT to return a set of predefined formatting strings together with the corresponding expanded values, this way I could show these in a list box making it a bit easier for the user to configure it.
    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 ?

    Quote Originally Posted by plympton View Post
    I also have a 120x120 pixel set of icons I'm going to use. The current customclock crashes with local (port 9000) urls, just FYI. I bricked my Touch about a dozen times trying to figure out the damn LUA non-regular expression syntax, to no avail. Anyway, it is what it is - should get fixed.
    Do you have some error messages from the log ?
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)

    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  8. #18
    Senior Member
    Join Date
    Aug 2007
    Location
    Portland, OR, USA
    Posts
    219

    Works REASONABLY well

    Attached is my modified code to get a reasonable approximation of SuperDateTime using CustomClock.

    Included is my:
    Modified SuperDateTime plugin (I had to un-par it)
    Changes include:
    - added a JSON SDTstring method. This accepts a SDT string and returns parsed values (%h -> 78% for humidity)
    - added a JSON SDTicon method. This only returns current conditions icon value (26 -> 26.png, the cloudy icon)

    Modified CustomClockHelper plugin
    Changes include:
    - added weathertext and weatherimage to the dropdown so it would save. Yes, I should have been consistent. I wasn't, sorry!

    Modified CustomClock.lua plugin
    - modified parsing so it works for the 2 new weather items
    - added some code to deal with the random URL extension. It uses the URL stored in prefs, and adds a # + .png extension to get the file. Not 100% it will update as the day goes on, however.
    - added a method to send prefs stored string to SDT and get back a parsed SDT string. Works reasonably well.

    PLEASE feel free to make any changes necessary. Between fighting LUA, and hunting for documentation, I did my best.

    Sample CustomClockHelper.prefs file that works in this case

    -Dan

    PS: The PDF is a renamed ZIP, rename it back. It includes my preferred icon set (120x120 pix, high-contrast).
    Attached Files Attached Files

  9. #19
    Senior Member
    Join Date
    Aug 2007
    Location
    Portland, OR, USA
    Posts
    219
    Quote Originally Posted by erland View Post
    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

  10. #20
    Senior Member GoCubs's Avatar
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,569
    Quote Originally Posted by erland View Post
    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.

    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 ?
    Both options are available. I'm attempting to document all the available SDT API commands. My current evolving copy is online at- http://gregbrown.net/squeeze/sdt-api.htm It doesn't (yet) include the % macro call.
    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.
    I'm not sure you'll have to go the poll route. Basically the plugin updates everything in one batch. If you subscribe to a notification on the data state you can update whenever you're notified a data refresh of everything is complete.
    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)

    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 ?
    The JSON includes both an ID and a URL to the filename. There's a link to an example in the API url I provided above.
    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.
    There's a link to an example of the Sports output for MLB on the API URL above. It's basically raw currently active game data. You'll probably want another API call to retrieve all the teams for each sport so that a user can pick which ones they want displayed. I can add that if desired.
    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.

    Would be kind of nice if there was a CLI/JSON command which Custom Clock Helper could call to get SDT to return a set of predefined formatting strings together with the corresponding expanded values, this way I could show these in a list box making it a bit easier for the user to configure it.

    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 displays a table of all the % macro commands when configuring the display for each player. The user then enters their desired format string. Default formatting strings are provided and vary for different player types.

    I can create another cli command to retrieve all of the % macros and what they represent. They haven't changed much, but I have recently introduced the option for plugins to hook into SDT and add their own.
    Do you have some error messages from the log ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •