Re: [slim] LMS Plugin Development

2021-06-09 Thread peterw


cliveb wrote: 
> OK, making progress. I decided that all I really needed to do was switch
> the Meridian 218 on & off with the Squeezebox player,

Here's some code from my DenonSerial plugin that I think should help:


Code:


  # outside/before initPlugin() is where I usually put this:
  $serverPrefs = preferences('server');
  
  # inside initPlugin() register to have your code run any time the power 
status changes for any player:
  $serverPrefs->setChange(\&powerChange, 'power');
  # inside initPlugin you might also want to tell LMS to run some code when a 
new player connects (after player reset, network disruption, etc):
  Slim::Control::Request::subscribe( \&newPlayerCheck, [['client']],[['new']]);
  
  # after initPlugin() define the powerChange() function
  sub powerChange {
  my ($pref, $val, $client) = @_;
  my $id = $client->id(); # client ID, e.g. MAC address if normal Squeezbox; 
use this to decide what to do / if you care
  #$val will be 1 if the player just turned on, 0 if it just turned off
  # do your work
  }
  
  # after initPlugin() define newPlayerCheck():
  sub newPlayerCheck {
  my $request = shift;
  my $client = $request->client();
  my $id = $client->id(); # client ID, e.g. MAC address if normal Squeezbox; 
use this to decide what to do / if you care
  #etc
  }
  
  




owner of the stuff at https://tuxreborn.netlify.app/
(which used to reside at *www. tux.org/~peterw/*)
Note: The best way to reach me is email or PM, as I don't spend much
time on the forums.
*Free plugins:* AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu
DenonSerial
FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket
SaverSwitcher
SettingsManager SleepFade StatusFirst SyncOptions VolumeLock

peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread philchillbill


Sorry to be late to the party, but if this plug-in is only for your own
use in your setup, it
might be easier to just ssh into the SBR and run a shell script on it on
a cron schedule to turn your amp on/off together with the player. 

See my post from a few years ago on the Domoticz forum. It reads the Lux
sensor in the SBR and updates Domoticz accordingly. Not quite your
application but might give you some ideas to push from the SBR instead
of push from LMS. 

https://www.domoticz.com/wiki/Logitech_Media_Server#Using_Ambient_Light_Sensor_in_SB-Radio_and_SB-Touch





philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] Streaming radio doesn't play on Transporter

2021-06-09 Thread JJZolx


garym wrote: 
> Hi, I just tried that link and it played on my Transporter

Thanks.

> showed 128kbps AAC stream

In the web interface, it shows that it's being transcoded to FLAC,
though, doesn't it?



JJZolx's Profile: http://forums.slimdevices.com/member.php?userid=10
View this thread: http://forums.slimdevices.com/showthread.php?t=112292

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] Streaming radio doesn't play on Transporter

2021-06-09 Thread garym


Hi, I just tried that link and it played on my Transporter (running LMS
8.1.2 on rPi).  I did notice that everytime I stopped, then restarted
the station, it would show about 3 seconds of nothing, then start over
at 0.  But when it started over, it played fine and showed 128kbps AAC
stream.  It also showed the artist and song title as metadata.



*Home:* Pi4B-8GB/pCP7.x/4TB>LMS 8.1.x>Transporter, Touch, Boom, Radio
(all ethernet)
*Cottage:* rPi4B-4GB/pCP7.x/4TB>LMS 8.1.x>Touch>Benchmark DAC I, Boom,
Radio w/Battery (Radio WIFI)
*Office:* Win10(64)>foobar2000
*The Wild: *rPi3B+/pCP7.x/4TB>LMS 8.1.x>hifiberry Dac+Pro (LMS &
Squeezelite) 
*Controllers:* iPhone11 & iPadAir3 (iPeng), CONTROLLER, Material Skin,
or SqueezePlay 7.8 on Win10(64)
*Files:* -Ripping-: dBpoweramp > FLAC; -Post-rip-: mp3tag, PerfectTunes,
TuneFusion; -Streaming:- Spotify

garym's Profile: http://forums.slimdevices.com/member.php?userid=17325
View this thread: http://forums.slimdevices.com/showthread.php?t=112292

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] Streaming radio doesn't play on Transporter

2021-06-09 Thread JJZolx


Re-examining this... (I just gave up last year.)

Here is the radio stream I'm trying to play on the Transporter, but get
no audio. It shows about 3 seconds of progress in the web UI, then the
counter resets to 0:00. Maybe someone else could try it?

http://kuvo-ice.streamguys.org/kuvo-aac-128

Web page: 'KUVO 89.3 Denver' (https://www.kuvo.org/ways-to-listen/)

It plays on my SB Radio, apparently natively. On the Transporter I see
this info in the web interface:

File Format: AAC
Bitrate: 128kbps CBR (Converted to 705kbps FLAC)
Sample Rate: 44.1 kHz
URL: http://kuvo-ice.streamguys.org/kuvo-aac-128

I'm using the stock convert.conf and types.conf files, no changes to the
streaming formats (shown in a previous post). Both faad.exe and flac.exe
are in place and are the versions installed by LMS. I'm running LMS 8.2
beta, built May 30.



JJZolx's Profile: http://forums.slimdevices.com/member.php?userid=10
View this thread: http://forums.slimdevices.com/showthread.php?t=112292

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread cliveb


mherger wrote: 
> > After restarting LMS, here's what happens:
> 
> You need to initialize the Settings in your plugin. Add
> 
> use Plugins::M218::Settings;
> 
> at the top of it, and in initPlugin() you do:
> 
>   Plugins::M218::Settings->new();
> 
> Instead of dealing with a pCP's folders I'd recommend you run LMS on 
> your local dev machine. This allows you to easily restart LMS without 
> having to copy files around etc.
Got home from being out for the afternoon to see your very quick
response, and tried your suggestion.

Success!
It was as simple as adding those extra lines into my plugin.
I will now start looking at adding the additional configuration settings
that it ought to have, and remove the hard-coded stuff.

Thank you so much for your assistance, much appreciated.

BTW, it's no problem for me to copy files to the pCP server using Samba,
and restarting LMS is no hassle. I'm not planning to be a regular plugin
developer, so this is all pretty much a one-off.



Transporter -> ATC SCM100A

cliveb's Profile: http://forums.slimdevices.com/member.php?userid=348
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Paul Webster


Plus ... running LMS on Windows makes it harder to debug tricky things
when (as I had to do to recently understand the Protocol Handler stuff
better) I need to put extra tracing code in the core LMS.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, supla
finland, abc australia, cbc/radio-canada and rte ireland

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Michael Herger

I don't like running a 2nd LMS on the same LAN because real players used
by others in the house sometimes migrate to it and leads to turmoil.


I do this all the time, in the office as well as at home. AFAIK original 
hardware would never switch server. squeezelite would pick whatever was 
available when starting and the "old" server wasn't available. But none 
of this should happen out of the blue.

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Paul Webster


mherger wrote: 
> > My suggestion (which Michael has said before that he does not like
> but
> > it works great for me) ...
> 
> But it's so much more complicated than needed... and risks to mess with
> 
> the managed plugins folder.
> 
> I never zip the files before release. I edit them right from inside 
> their folder where LMS picks them up whenever I restart LMS.

I don't like running a 2nd LMS on the same LAN because real players used
by others in the house sometimes migrate to it and leads to turmoil.
So LMS on pCP is production and development ... and I tend to write the
code in Windows using Notepad++

It does mean that I can only try out something new when no-one else is
listening to stuff but that is not a big issue since it stops me
spending inordinate amounts of time on it!



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, supla
finland, abc australia, cbc/radio-canada and rte ireland

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Michael Herger

My suggestion (which Michael has said before that he does not like but
it works great for me) ...


But it's so much more complicated than needed... and risks to mess with 
the managed plugins folder.


I never zip the files before release. I edit them right from inside 
their folder where LMS picks them up whenever I restart LMS.

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Michael Herger

Cache/Installed/Plugins is only used for plugin managed by Plugin
manager downloaded from repositories.


Cache/InstalledPlugins is managed, Cache/Plugins is not. It's LMS 
Plugins folder on pCP.


___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Michael Herger

After restarting LMS, here's what happens:


You need to initialize the Settings in your plugin. Add

use Plugins::M218::Settings;

at the top of it, and in initPlugin() you do:

Plugins::M218::Settings->new();

Instead of dealing with a pCP's folders I'd recommend you run LMS on 
your local dev machine. This allows you to easily restart LMS without 
having to copy files around etc.

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Paul Webster


My suggestion (which Michael has said before that he does not like but
it works great for me) ...

Make a real plugin package and a repo file ... and host the repo file on
a web server somewhere.
Configure your LMS to use that (private) repo file and let it install
into Cache/InstalledPlugins/Plugins/

Then when you want to try out some changes ... simply use WinSCP to copy
over the changed files into that folder (overwriting what LMS put there)
and restart LMS (no need to update the install.xml at this point).

If you uninstall the plugin then LMS will remove all of the files ... so
always make the changes that you think you want to keep on your desktop
system.

To do it 100% properly you could package up each speculative change and
update install.xml, make a new zip file and update the repo file (new
checksum and version) but that is a lot of extra work to do while you
are trying out small changes.

There is scope for confusion ... particularly after you have made an
official release where you try something out and then forget to push an
official update to the zip/repo ... but since you have not released
anything to the outside world yet then this does not really matter.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, supla
finland, abc australia, cbc/radio-canada and rte ireland

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread cliveb


bpa wrote: 
> Cache/Installed/Plugins is only used for plugin managed by Plugin
> manager downloaded from repositories.
> 
> If you look at WebUI Settings/Information - it lists the plugins
> directories. - you'll see a number of directories including
> Cached/InstalledPlugins/Plugins and Slim/Plugin. 
> 
> Manaully installed user plugins (what you want) go into a *Plugins*
> directory at a top level (exact location depends on OS)  - do not
> install in Slim/Plugin as that is for LMS supplied plugins.
On my LMS server (running on piCorePlayer, so the OS is piCore Linux),
WebUI/Settings/Information lists these plugin folders:
/USR/LOCAL/SLIMSERVER/CACHE/INSTALLEDPLUGINS/PLUGINS,
/USR/LOCAL/SLIMSERVER/PLUGINS, /USR/LOCAL/SLIMSERVER/CACHE/PLUGINS

So I presume that I should put my plugin into
*/usr/local/slimserver/Plugins* - but no such folder exists.

Is it that LMS is prepared to use plugins if the folder happens to be
there, but that the folder may not exist?
Can I just create that folder and put my plugin there? (I don't want to
just try it without some reassurance, in case it breaks LMS).



Transporter -> ATC SCM100A

cliveb's Profile: http://forums.slimdevices.com/member.php?userid=348
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread cliveb


mherger wrote: 
> 
> I think it would be good to share your code if you wanted some qualified
> 
> help. It's hard to follow what you do by your descriptions only.
OK, I've zipped up what I've created and attached it here.
I placed all of these files in the /usr/local/slimserver/Cache/Plugins
directory.
After restarting LMS, here's what happens:
- The plugins tab on the LMS web interface shows the new plugin as
active, and it has a Settings link
- Clicking the Settings link results in *404 Not Found:
plugins/Extensions/settings/plugins/M218/settings/player.html*
- The plugin is available on a SB3 via the Extras menu, and I can
enable/disable it as hoped
- When it's enabled on the SB3, it works as expected

I think if someone can help me figure out how to integrate the
player.html and Settings.pm files, I may have a chance of enabling the
plugin on other players (eg. SBR, Squeezelite, etc)

mherger wrote: 
> 
> > I tried moving my new plugin to
> > /usr/local/slimserver/Cache/InstalledPlugins/Plugins (which is where
> > PowerSave was installed), but that didn't help.
> 
> Don't mess with that folder. It's managed by LMS' plugin manager. It 
> doesn't like to get confused by you adding/removing stuff there.
OK, understood. I only tried there because that's where I found the
PowerSave plugin.


+---+
|Filename: M218.zip |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=34932|
+---+


Transporter -> ATC SCM100A

cliveb's Profile: http://forums.slimdevices.com/member.php?userid=348
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread bpa


cliveb wrote: 
> OK, understood. I only tried there because that's where I found the
> PowerSave plugin.

Cache/Installed/Plugins is only used for plugin managed by Plugin
manager downloaded from repositories.

If you look at WebUI Settings/Information - it lists the plugins
directories. - you'll see a number of directories including
Cached/InstalledPlugins/Plugins and Slim/Plugin. 

Manaully installed user plugins (what you want) go into a *Plugins*
directory at a top level (exact location depends on OS)  - do not
install in Slim/Plugin as that is for LMS supplied plugins.



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=114585

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss


Re: [slim] LMS Plugin Development

2021-06-09 Thread Michael Herger

So I took a look at the PowerSave plugin (which I already have active on
the SBR) and noticed that it includes a PLAYER.HTML file that presents
the various options in the LMS Settings web interface, and a SETTINGS.PM
file that looks like it processes the settings selected in the
PLAYER.HTML page. So I built a simple equivalent and placed it with the
rest of my plugin. After restarting LMS, a SETTINGS option appeared next
to my new plugin, but clicking it results in:

Code:

 404 Not Found: 
plugins/Extensions/settings/plugins/M218/settings/player.html



I think it would be good to share your code if you wanted some qualified 
help. It's hard to follow what you do by your descriptions only.



I tried moving my new plugin to
/usr/local/slimserver/Cache/InstalledPlugins/Plugins (which is where
PowerSave was installed), but that didn't help.


Don't mess with that folder. It's managed by LMS' plugin manager. It 
doesn't like to get confused by you adding/removing stuff there.

___
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss