Hey all,
Simple: Can you access Plugin routines/data/preferences in SqueezeOS?
I'm trying to get up to speed on Applet writing - I want to have SuperDateTime on the Touch, simple as that. What I don't want to do is re-write all the downloading and parsing and preference setting that Greg has so masterfully done.
I have glanced through the plugin documentation, and applet documentation, but it's not really clear to me.
Can I access a plugin from a LUA program? Plugin functions? Can LUA call Perl routines like C++ can call Fortran?
What's a good way to access preference data from LUA?
Thanks!
-Dan
Results 1 to 10 of 225
-
2010-04-24, 10:00 #1Senior Member
- Join Date
- Aug 2007
- Location
- Portland, OR, USA
- Posts
- 218
Wanting to port SuperDateTime to Touch - need help
-
2010-04-24, 13:25 #2
Hey Dan-
I covered some of this in an email I sent you earlier today, but I think LUA-based plugins have their own settings separate than traditional plugins.
Yes, LUA can communicate with Perl plugins. In the basic SuperDateTime LUA applet I referred you to it achieves this to retrieve the current weather conditions that the SDT Perl plugin is keeping track of.
-Greg
-
2010-04-24, 22:57 #3
What does SDT expose in the form of CLI/JSON commands to get the data ?
Which can I trust have a stable interface ? Everything registered with addDispatch ?
If it only expose simple text or image items it would be nice to integrate this with the "Custom Clock" applet so anyone can design their own screen and decide where to position things and combine it with other data supported by Custom Clock.
Also, does it send any notifications with notifyFromArray when some value is changed ? This would make it possible to avoid polling from the applet side.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)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.
-
2010-04-24, 23:00 #4
plympton, you can give it a try in a separate applet first and then maybe we could integrate it in Custom Clock as a second step ?
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)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.
-
2010-04-24, 23:42 #5Senior Member
- Join Date
- Aug 2007
- Location
- Portland, OR, USA
- Posts
- 218
Can do. I've got an applet reading the data from the JSON interface from SuperDateTime. I'm spending a lot of time getting my head wrapped around LUA & its weirdnesses, as well as the SqueezeOS object model and how it's all put together (praying to the documentation gods isn't working)
Here's an image of my work-in-progress. It's completely hard-coded for my preferences, but it is getting the data from SuperDateTime (though not using the preferences set in the Web UI)
PS: The code is embarrassingly awful, so I won't upload it yet.
-DanLast edited by plympton; 2010-04-25 at 00:46. Reason: Added Screenshot
-
2010-04-25, 07:08 #6
Hi Erland-
I like the sound of this! I had actually tweaked the custom clock applet to retrieve some SDT content but it would definitely make more sense to have you natively support SDT.
SDT supports several CLI/JSON commands that basically return the hashes that SDT uses internally. The hashes evolved over time as the plugin grew and might not be the most elegant, but I wouldn't expect them to change other than possible additions. I can also make a cleaner API-specific hash if need be.
What would you expect to be provided for images? Where/how do I include the image files in the SBS plugin so that applets can access them via some sort of text url?
I'll try to clean up some API documentation on this.
I wasn't aware of notifyFromArray. Can you provide an example or point me in the direction of an existing plugin that makes use of this in a similar fashion?
Thanks
-Greg
-
2010-04-25, 09:13 #7
A url if it's a image handled by SBS it's enough with the part, if it's an image available someone on Internet I need a complete url including host and port, for for example:
/plugins/SuperDateTime/html/images/someimage.png
Or
http://somesite:1234/folder/someimage.png
An image in the folder (inside your plugin dir):
HTML/EN/html/plugins/SuperDateTime/html/images/someimage.png
Is available as url:
http://localhost:9000/plugins/SuperDateTime/html/images/someimage.png
In this case, since it's a SBS url, it's enough if you provide:
/plugins/SuperDateTime/html/images/someimage.png
Honestly, I'm not 100% sure if this is the correct way, but I know it works because I used it in Custom Clock Helper:
You can specify a $client object in the first parameter if you only want to send it to a specific player.Code:my $data = { 'attr1' => 'value1', 'attr1' => 'value2', }; Slim::Control::Request::notifyFromArray(undef,['superdatetime','somethingupdated',$data);
You will also need to add the notification in initPlugin with addDispatch, as this:
The "superdatetime", "somethingupdated" notification about is just an example, you should of course use names that are relevant in your case.Code:Slim::Control::Request::addDispatch(['superdatetime', 'somethingupdated'],[0, 1, 0, undef]);
The notifyFromArray can take any number of parameters, so the above sample with a single data parameter is just an example, in the TrackStat plugin I for example use:
And the corresponding addDispatch call:Code:Slim::Control::Request::notifyFromArray($client, ['trackstat', 'changedstatistic', $url, $track->id, $playCount, $lastPlayed]);
Code:Slim::Control::Request::addDispatch(['trackstat', 'changedstatistic', '_url', '_trackid', '_playcount',' _lastplayed'],[0, 0, 0, undef]);
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)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.
-
2010-04-26, 09:00 #8
Integration of SDT with Custom Clock would be AWESOME!
-
2010-04-26, 11:28 #9Senior Member
- Join Date
- Aug 2007
- Location
- Portland, OR, USA
- Posts
- 218
Erland,
How can we make custom clock more... custom? I've been struggling with this one. Right now, it looks like custom clock is geared towards a layout of:
Background image
Main text
Top text, centered
2 x bottom text, right and left justified.
Right?
Is there a logical & non-painful to create a method where we can allow for a layout like I have above? It gets more complicated (in my mind) if we want to make it display equally well on a Touch, Radio, and Controller. I can see getting the Touch and Radio to work FAIRLY well, since they're both landscape, but the controller layout doesn't sound fun to wiggle in there.
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?)
Maybe something like.. hmm..
1. Set number of lines, for each line set a size (each a percent of height). Each line is independently set - 5 lines could be 10%, 1%, 5%, 44%, 1%, 19%, 1%, 19%. (1% = buffer lines? Buffer set for each line?)
2. Each line can have columns, each a % of width. Max? 3? 5? 10?
3. Each square can either be an image or a text block.
4. If it's an image, is it scaled or not (zoom doesn't work in my experience, BTW, need to use rotozoom). Is image right, left, center, top, or bottom justified?
5. Text blocks will wrap (possible?) or not. Text is right, left, or center, top or bottom justified. Can text be scaled to fit in its square easily? Can we figure out the width (in pixels) or a text string, and if it's not wrapped, try and fit it in the square?
6. Each square, if it is a text block, can have variables associated with it. I can see a menu displaying -
- standard NowPlaying variables (artist, etc)
- time variables (day, date, etc..)
- weather variables (use SDT's coding scheme)
7. Once the user selects the variables, they'll be dumped into a free-text strung that can be (keyboard?) edited for formatting. Say the user selects Day, Month, and year, they'll be presented with this string, which they can they free-edit.
Dang that seems like a lot of work...
Also, you can't have, say, a single column on the left, with 3 squares on the right over each other with this scheme. That should be addressed.
Thoughts? Ideas?
-Dan
-
2010-04-26, 12:16 #10
No, that was the old version, I changed that some time ago and now you can basically do whatever you want, there are some samples of working clock styles on this wiki page:
http://wiki.slimdevices.com/index.ph...m_Clock_styles
(The Cassetta style shown on that page with spinning wheels when the music playing is pretty cool)
I wish I would have named it differently, the current implementation is a lot more than a clock.
The current SuperDateTime applet is based on the old version and due to this it has the limited layout you describe.
There shouldn't be any problems at all to create a layout similar to your screen dump.
Would you prefer that I made a try at integrating it directly in Custom Clock ?
If you do and already have done some code, I'd love to get it so I can see a bit more how I should send and interpret the JSON commands.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)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

Reply With Quote

