I'm trying to develop a few small applets for SqueezePlay, but I'm having a hell of a time having never programmed in Lua before, and the apparent lack of working example material.
Currently I'm trying to show a 'connecting' screen and set the icon of the menu entry to an icon file within WQVGAsmallSkin. However, the code for the SkinTest applet is rather unfriendly for a Lua newbie and the code in the old TestApplet (which is far easier to comprehend) is broken. I've followed the examples in the 'SqueezePlay Applet Developing Guide' on the wiki, but that only gets you so far.
So, could anyone point me towards some better example materials, or let me know how to display a connecting screen and set the icon for a menu entry properly?
Thanks!
Results 1 to 7 of 7
Thread: Writing Applets
-
2012-03-13, 08:45 #1Junior Member
- Join Date
- Aug 2010
- Posts
- 14
Writing Applets
-
2012-03-13, 10:11 #2
I've always felt that the best samples is the real SqueezePlay source code, so what I do is often find some section in the standard SqueezePlay user interface that does what I like and then try to find the source code that accomplish it.
I'm not sure I understand exactly what you like to do, but if you want a popup dialog while the applet tries to connect to something, it would be something like:
The this would open up a popup with a rotating connecting icon and the text from the strings.txt entry for APPLET_FETCHING and hide it after 2 seconds when the timer triggers. In your scenario you would probably not have a timer, you would probably have some asynchronous network connection code.Code:-- Stupid timer that triggers in a while since I don't want to show real connection code as it's too complex self.timer = Timer(2000, function() self.popup:hide() end, true) self.timer:start() -- create animiation to show while we get data from the servers self.popup = Popup("waiting_popup") self.popup:addWidget(Icon("icon_connecting")) self.popup:addWidget(Label("text", self:string("APPLET_FETCHING"))) self:tieAndShowWindow(self.popup)
The above code section is from the Settings/Advanced/Applet Installer menu which can be found in the SetupAppletInstallerApplet.lua file.
Was it something like this you were looking for ?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.
-
2012-03-15, 04:55 #3Junior Member
- Join Date
- Aug 2010
- Posts
- 14
Yes, pretty much anything I've ever done with SqueezePlay is the result of pulling apart other peoples' code!

That is perfect, thank you! Thanks for the reference too, I'll have a dig around in there for more clues. Actually, one thing that has eluded me so far is how to get SqueezePlay to display system information about the device it is running on. I can see the kind of details I'm after in Settings > Advanced > Squeezebox Information > Player Information, but I can't find the applet that controls this, so I've yet to find out where it gets the IP / MAC details from.
One of the applets I've written needs to execute a shell script - this works fine using os.execute, but it would be nice if there was a way to keep that fullscreen popup on screen only until it has finished it's work. It would be even nicer if there was a neat way to hand the output of said script back into SqueezePlay to display.
Would you (or anyone else here) happen to know the best way to go about it?
Last edited by roobarb!; 2012-03-15 at 07:20.
-
2012-03-15, 11:11 #4
I think that menu comes from the server (from Slim/Control/Jive.pm) on the server side.
But if you just want the MAC address, you can get that through:
System:getMacAddress()
Generally the Diagnostics/DiagnosticsApplet.lua is a good source if you like to see how to read system information, in the user interface you reach it through Settings/Advanced/Diagnostics.
In my Patch Installer applet I've used os.execute and sometimes sent its output to a file using >, not sure if there are better ways to do it. Generally os.execute() is not recommended as I believe it will start a new shell and this use unnecessary amount of memory. However, sometimes there isn't an easy way to do it in lua and then you don't have much choices.
If it's a script that run in background it would probably be possible to use a Timer to check if the script has finished once a second and call the hide() method on the dialog when it has finished.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.
-
2012-03-16, 04:13 #5
Are there any good examples of interfacing with buttons under Jive?
I'm trying to find a way of sticking a button on the now playing screen and then on press it runs some of my plugin code.
You can build the menus from a plugin so must be possible to dynamically build buttons?
Cheerswww.spicefly.com - ** Spicefly SugarCube ** - A hassle free acoustic journey through your music library using MusicIP. Plus the finest MusicIP installation guides, enhanced MIP Interface and SpyGlass MIP the Windows Automated MusicIP Headless Installer.
-
2012-03-16, 09:48 #6
That would be this enhancement request:
http://bugs.slimdevices.com/show_bug.cgi?id=15067
Without that you either have to patch the Now Playing applet or possible write some code to access its internal variables. I don't think any of these solutions are a good idea.
A better solution would be to integrate with the Slim::Menu::TrackInfo on the server side to create your own entry in the context menu that's opened when you hold the track title a while on a Touch or push the +/More button on a Radio/Controller.
To integrate with Slim::Menu::TrackInfo you need to have some registration code in initPlugin like:
And then implement the trackInfoHandler function. You can either look in the TrackStat source (which adds a "Rating" menu) or search in the Squeezebox Server source for other functions that uses TrackInfo to add items in the context menus.Code:Slim::Menu::TrackInfo->registerInfoProvider( sugarcube => ( before => 'artwork', func => \&trackInfoHandler, ) );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.
-
2012-03-17, 03:40 #7
Cheers Erland, I already use trackinfo menus but wanted a single on screen click option. Oh well, I've voted for the feature request maybe one day it will happen

Thanks for your helpwww.spicefly.com - ** Spicefly SugarCube ** - A hassle free acoustic journey through your music library using MusicIP. Plus the finest MusicIP installation guides, enhanced MIP Interface and SpyGlass MIP the Windows Automated MusicIP Headless Installer.

Reply With Quote

