kdf Wrote: > Quoting jonheal <jonheal.25g0dz1143655202 (AT) no-mx (DOT) > forums.slimdevices.com>: > > > > > I added a line to print all values of the $slimCommand to the debug > log > > (within the commandCallback sub). Neither "button, play" nor "button > > play" appeared in the log. > > > > However, if I changed this line: > > > > elsif ($slimCommand eq "play") > > > > to this: > > > > elsif ($slimCommand eq "play" || "button, play") > > that will always be TRUE, since "button, play" is a value and not a > conditional. > it doesn't phrase like spoken language, you have to do the logic each > time: > elsif ($slimCommand eq "play" || $climCommand eq "button, play") > > However, that isn't what you need to find anyway. > what you want to look for is: > > elsif ($slimCommand eq "play || ($slimCommand eq "button" && $paramOne > > eq "play")) > > and that will only work when there is actually a play event. However, > > as it turns out, there isn't always such a thing. if you load a > playlist, it will start playing as part of the load and there is no > play event. However, that's how slimserver works and I really don't > have to motivation to go on a mission to change that. Execute will > still do what is says...run a script on a play event. > > Depending on what your script is doing, you may want to stick with > checking for "newsong" or some other event. "newsong" will at least > be a good one if you want to update a blog entry with the new song > infomation, for example. > > using the 6.2.2 version, the debug needs to be --d_stdio to get the > command watcher output. in 6.5 versions, I changed to the more > standard d_plugins. The point of that was to provide the tools for > people, such as yourself, to easily change the events to be whatever > they want. Simply match the $slimCommand, $paramOne or any other > params at will and you can hijack any of the four events to be > whatever suits your needs. > > as another note, copy line 159 (the setExecuteCallback) to just above > > the last } in the initPlugin function (two lines above "sub lines") to > > make the plugin activate on startup instead of having to activate > manually each time. > -k Kevin,
Thanks for your help with all of this. I will watch the d_stdio log for grins, but for now, I'll probably stick with trapping for "newsong" since what you described is exactly what I'm trying to do -- update a web page with "now playing" info. 95% of my collection is FLAC, and it seems to work with those files. The rest are mp3s. I haven't tried it with those, so I don't know if "newsong" is issued when an mp3 is played or not, but frankly, after listening to FLACs, I can't stand listening to the mp3s any more anyway. I'll put in the change you outlined to keep the script activated. Thanks again. Sorry if I've been a pain in the a$$. -- jonheal Jon Heal says: Have a nice day! http://www.theheals.org/ ------------------------------------------------------------------------ jonheal's Profile: http://forums.slimdevices.com/member.php?userid=2133 View this thread: http://forums.slimdevices.com/showthread.php?t=22479 _______________________________________________ Discuss mailing list [email protected] http://lists.slimdevices.com/lists/listinfo/discuss
